diff --git a/cas/apiv1/options.go b/cas/apiv1/options.go index e1adcecb..80d42d90 100644 --- a/cas/apiv1/options.go +++ b/cas/apiv1/options.go @@ -49,7 +49,7 @@ type Options struct { // certificate authority. Project string `json:"-"` Location string `json:"-"` - CAPool string `json:"-"` + CaPool string `json:"-"` } // CertificateIssuer contains the properties used to use the StepCAS certificate diff --git a/cas/cloudcas/cloudcas.go b/cas/cloudcas/cloudcas.go index 9df8b5c6..a4e1552c 100644 --- a/cas/cloudcas/cloudcas.go +++ b/cas/cloudcas/cloudcas.go @@ -100,9 +100,10 @@ func New(ctx context.Context, opts apiv1.Options) (*CloudCAS, error) { return nil, errors.New("cloudCAS 'project' cannot be empty") case opts.Location == "": return nil, errors.New("cloudCAS 'location' cannot be empty") - case opts.CAPool == "": + case opts.CaPool == "": return nil, errors.New("cloudCAS 'caPool' cannot be empty") } + } else { if opts.CertificateAuthority == "" { 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 == "" { opts.Location = parts[3] } - if opts.CAPool == "" { - opts.CAPool = parts[5] + if opts.CaPool == "" { + opts.CaPool = parts[5] } } } @@ -134,7 +135,7 @@ func New(ctx context.Context, opts apiv1.Options) (*CloudCAS, error) { certificateAuthority: opts.CertificateAuthority, project: opts.Project, location: opts.Location, - caPool: opts.CAPool, + caPool: opts.CaPool, }, nil } diff --git a/cas/cloudcas/cloudcas_test.go b/cas/cloudcas/cloudcas_test.go index e6e89ce3..6fb5e520 100644 --- a/cas/cloudcas/cloudcas_test.go +++ b/cas/cloudcas/cloudcas_test.go @@ -290,7 +290,7 @@ func TestNew(t *testing.T) { caPool: testCaPool, }, false}, {"ok creator", args{context.Background(), apiv1.Options{ - IsCreator: true, Project: testProject, Location: testLocation, CAPool: testCaPool, + IsCreator: true, Project: testProject, Location: testLocation, CaPool: testCaPool, }}, &CloudCAS{ client: &testClient{}, project: testProject, @@ -311,7 +311,7 @@ func TestNew(t *testing.T) { IsCreator: true, Project: testProject, Location: "", }}, nil, true}, {"fail caPool", args{context.Background(), apiv1.Options{ - IsCreator: true, Project: testProject, Location: testLocation, CAPool: "", + IsCreator: true, Project: testProject, Location: testLocation, CaPool: "", }}, nil, true}, } for _, tt := range tests {