Skip to content

Commit

Permalink
Use string pointer functions from pkg/clients
Browse files Browse the repository at this point in the history
crossplane/crossplane-runtime#1

Per the above issue the utils package is deprecated. As best I can tell these
are the only uses of these functions, which duplicate existing client functions.
  • Loading branch information
negz committed Jan 31, 2020
1 parent 50115a5 commit cdc9b2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.15.78 h1:LaXy6lWR0YK7LKyuU0QWy2ws/LWTPfYV/UgfiBu4tvY=
github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM=
github.com/aws/aws-sdk-go-v2 v0.5.0 h1:EYMvJVajBzaGlPb8z761lkejQKsz0FM6+78lfQ/UexA=
github.com/aws/aws-sdk-go-v2 v0.5.0/go.mod h1:5/URWM5KZOrZ0sp9aiPT0FrXgFJFPJ143F6SGgnTfXY=
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/s3/s3bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

bucketv1alpha3 "github.com/crossplaneio/stack-aws/apis/storage/v1alpha3"
aws "github.com/crossplaneio/stack-aws/pkg/clients"
"github.com/crossplaneio/stack-aws/pkg/clients/s3"
"github.com/crossplaneio/stack-aws/pkg/controller/utils"

Expand All @@ -37,7 +38,6 @@ import (
"github.com/crossplaneio/crossplane-runtime/pkg/meta"
"github.com/crossplaneio/crossplane-runtime/pkg/reconciler/managed"
"github.com/crossplaneio/crossplane-runtime/pkg/resource"
"github.com/crossplaneio/crossplane-runtime/pkg/util"
)

const (
Expand Down Expand Up @@ -146,8 +146,8 @@ func (r *Reconciler) _create(bucket *bucketv1alpha3.S3Bucket, client s3.Service)
}

if err := r.PublishConnection(ctx, bucket, managed.ConnectionDetails{
runtimev1alpha1.ResourceCredentialsSecretUserKey: []byte(util.StringValue(accessKeys.AccessKeyId)),
runtimev1alpha1.ResourceCredentialsSecretPasswordKey: []byte(util.StringValue(accessKeys.SecretAccessKey)),
runtimev1alpha1.ResourceCredentialsSecretUserKey: []byte(aws.StringValue(accessKeys.AccessKeyId)),
runtimev1alpha1.ResourceCredentialsSecretPasswordKey: []byte(aws.StringValue(accessKeys.SecretAccessKey)),
runtimev1alpha1.ResourceCredentialsSecretEndpointKey: []byte(bucket.Spec.Region),
}); err != nil {
return r.fail(bucket, err)
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/s3/s3bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"errors"
"testing"

"github.com/crossplaneio/stack-aws/apis"

"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/google/go-cmp/cmp"
. "github.com/onsi/gomega"
Expand All @@ -33,8 +31,10 @@ import (
. "sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/crossplaneio/stack-aws/apis"
"github.com/crossplaneio/stack-aws/apis/storage/v1alpha3"
. "github.com/crossplaneio/stack-aws/apis/storage/v1alpha3"
aws "github.com/crossplaneio/stack-aws/pkg/clients"
client "github.com/crossplaneio/stack-aws/pkg/clients/s3"
. "github.com/crossplaneio/stack-aws/pkg/clients/s3/fake"

Expand Down Expand Up @@ -283,8 +283,8 @@ func TestCreate(t *testing.T) {
MockCreateUser: func(username string, bucket *S3Bucket) (*iam.AccessKey, string, error) {
createUserCalled = true
fakeKey := &iam.AccessKey{
AccessKeyId: util.String("fake-string"),
SecretAccessKey: util.String(""),
AccessKeyId: aws.String("fake-string"),
SecretAccessKey: aws.String(""),
}
return fakeKey, "v2", nil
},
Expand Down

0 comments on commit cdc9b2b

Please sign in to comment.