Rename CAPool to CaPool.

This commit is contained in:
Mariano Cano 2021-06-07 19:20:23 -07:00
parent 9db68db509
commit 529eb4bae9
3 changed files with 8 additions and 7 deletions

View file

@ -49,7 +49,7 @@ type Options struct {
// certificate authority. // certificate authority.
Project string `json:"-"` Project string `json:"-"`
Location string `json:"-"` Location string `json:"-"`
CAPool string `json:"-"` CaPool string `json:"-"`
} }
// CertificateIssuer contains the properties used to use the StepCAS certificate // CertificateIssuer contains the properties used to use the StepCAS certificate

View file

@ -100,9 +100,10 @@ func New(ctx context.Context, opts apiv1.Options) (*CloudCAS, error) {
return nil, errors.New("cloudCAS 'project' cannot be empty") return nil, errors.New("cloudCAS 'project' cannot be empty")
case opts.Location == "": case opts.Location == "":
return nil, errors.New("cloudCAS 'location' cannot be empty") return nil, errors.New("cloudCAS 'location' cannot be empty")
case opts.CAPool == "": case opts.CaPool == "":
return nil, errors.New("cloudCAS 'caPool' cannot be empty") return nil, errors.New("cloudCAS 'caPool' cannot be empty")
} }
} else { } else {
if opts.CertificateAuthority == "" { if opts.CertificateAuthority == "" {
return nil, errors.New("cloudCAS 'certificateAuthority' cannot be empty") return nil, errors.New("cloudCAS 'certificateAuthority' cannot be empty")
@ -118,8 +119,8 @@ func New(ctx context.Context, opts apiv1.Options) (*CloudCAS, error) {
if opts.Location == "" { if opts.Location == "" {
opts.Location = parts[3] opts.Location = parts[3]
} }
if opts.CAPool == "" { if opts.CaPool == "" {
opts.CAPool = parts[5] opts.CaPool = parts[5]
} }
} }
} }
@ -134,7 +135,7 @@ func New(ctx context.Context, opts apiv1.Options) (*CloudCAS, error) {
certificateAuthority: opts.CertificateAuthority, certificateAuthority: opts.CertificateAuthority,
project: opts.Project, project: opts.Project,
location: opts.Location, location: opts.Location,
caPool: opts.CAPool, caPool: opts.CaPool,
}, nil }, nil
} }

View file

@ -290,7 +290,7 @@ func TestNew(t *testing.T) {
caPool: testCaPool, caPool: testCaPool,
}, false}, }, false},
{"ok creator", args{context.Background(), apiv1.Options{ {"ok creator", args{context.Background(), apiv1.Options{
IsCreator: true, Project: testProject, Location: testLocation, CAPool: testCaPool, IsCreator: true, Project: testProject, Location: testLocation, CaPool: testCaPool,
}}, &CloudCAS{ }}, &CloudCAS{
client: &testClient{}, client: &testClient{},
project: testProject, project: testProject,
@ -311,7 +311,7 @@ func TestNew(t *testing.T) {
IsCreator: true, Project: testProject, Location: "", IsCreator: true, Project: testProject, Location: "",
}}, nil, true}, }}, nil, true},
{"fail caPool", args{context.Background(), apiv1.Options{ {"fail caPool", args{context.Background(), apiv1.Options{
IsCreator: true, Project: testProject, Location: testLocation, CAPool: "", IsCreator: true, Project: testProject, Location: testLocation, CaPool: "",
}}, nil, true}, }}, nil, true},
} }
for _, tt := range tests { for _, tt := range tests {