Skip to content

Commit

Permalink
migrate AWS Redshift Serverless to AWS SDK v2
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinFrazar committed Jan 10, 2025
1 parent 37a71fe commit 26578c9
Show file tree
Hide file tree
Showing 27 changed files with 405 additions and 257 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/organizations v1.37.0
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.8
github.com/aws/aws-sdk-go-v2/service/sns v1.33.8
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ github.com/aws/aws-sdk-go-v2/service/rds v1.93.2 h1:Fv2//DyCH9n6LqEOvpeIFYYRfIhv
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2/go.mod h1:QEpwiX4BS6nos2d/ele6gRGalNW0Hzc1TZMmhkywQb0=
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1 h1:fpuhuF5DuY26w61bBq8YrMYecLVs6eiQK7JbD9womPI=
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1/go.mod h1:Uz+PdLUo8+x/iXFrZGc+j+w/AVAfc7Qmju9XjCiQGHE=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1 h1:anb79RuKbIO8z+SgNiDGCQln5CBI3Edzp9mXTAcZuNg=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1/go.mod h1:u4NPdVb3te3+QB4rdjFGE9Of4V3vPqrPbTk6fAR6qf8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0 h1:SAfh4pNx5LuTafKKWR02Y+hL3A+3TX8cTKG1OIAJaBk=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0/go.mod h1:r+xl5yzMk9083rMR+sJ5TYj9Tihvf/l1oxzZXDgGj2Q=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.8 h1:WT3EPriVEpHE2jeNqHqj7l43JCIWPoZjNNRluZ7agII=
Expand Down
1 change: 1 addition & 0 deletions integrations/event-handler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/organizations v1.37.0 // indirect
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2 // indirect
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1 // indirect
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
Expand Down
2 changes: 2 additions & 0 deletions integrations/event-handler/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ github.com/aws/aws-sdk-go-v2/service/rds v1.93.2 h1:Fv2//DyCH9n6LqEOvpeIFYYRfIhv
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2/go.mod h1:QEpwiX4BS6nos2d/ele6gRGalNW0Hzc1TZMmhkywQb0=
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1 h1:fpuhuF5DuY26w61bBq8YrMYecLVs6eiQK7JbD9womPI=
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1/go.mod h1:Uz+PdLUo8+x/iXFrZGc+j+w/AVAfc7Qmju9XjCiQGHE=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1 h1:anb79RuKbIO8z+SgNiDGCQln5CBI3Edzp9mXTAcZuNg=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1/go.mod h1:u4NPdVb3te3+QB4rdjFGE9Of4V3vPqrPbTk6fAR6qf8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0 h1:SAfh4pNx5LuTafKKWR02Y+hL3A+3TX8cTKG1OIAJaBk=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0/go.mod h1:r+xl5yzMk9083rMR+sJ5TYj9Tihvf/l1oxzZXDgGj2Q=
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.2 h1:MOxvXH2kRP5exvqJxAZ0/H9Ar51VmADJh95SgZE8u60=
Expand Down
1 change: 1 addition & 0 deletions integrations/terraform/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/organizations v1.37.0 // indirect
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2 // indirect
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1 // indirect
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
Expand Down
2 changes: 2 additions & 0 deletions integrations/terraform/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,8 @@ github.com/aws/aws-sdk-go-v2/service/rds v1.93.2 h1:Fv2//DyCH9n6LqEOvpeIFYYRfIhv
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2/go.mod h1:QEpwiX4BS6nos2d/ele6gRGalNW0Hzc1TZMmhkywQb0=
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1 h1:fpuhuF5DuY26w61bBq8YrMYecLVs6eiQK7JbD9womPI=
github.com/aws/aws-sdk-go-v2/service/redshift v1.53.1/go.mod h1:Uz+PdLUo8+x/iXFrZGc+j+w/AVAfc7Qmju9XjCiQGHE=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1 h1:anb79RuKbIO8z+SgNiDGCQln5CBI3Edzp9mXTAcZuNg=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.25.1/go.mod h1:u4NPdVb3te3+QB4rdjFGE9Of4V3vPqrPbTk6fAR6qf8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0 h1:SAfh4pNx5LuTafKKWR02Y+hL3A+3TX8cTKG1OIAJaBk=
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.0/go.mod h1:r+xl5yzMk9083rMR+sJ5TYj9Tihvf/l1oxzZXDgGj2Q=
github.com/aws/aws-sdk-go-v2/service/sns v1.33.8 h1:zKokiUMOfbZSrAUVqw+bSjr6gl9u/JcvPzHTmL+tmdQ=
Expand Down
3 changes: 1 addition & 2 deletions lib/cloud/aws/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
iamtypes "github.com/aws/aws-sdk-go-v2/service/iam/types"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/redshiftserverless"
"github.com/gravitational/trace"
)

Expand Down Expand Up @@ -71,7 +70,7 @@ func convertRequestFailureErrorFromStatusCode(statusCode int, requestErr error)
case http.StatusBadRequest:
// Some services like memorydb, redshiftserverless may return 400 with
// "AccessDeniedException" instead of 403.
if strings.Contains(requestErr.Error(), redshiftserverless.ErrCodeAccessDeniedException) {
if strings.Contains(requestErr.Error(), "AccessDeniedException") {
return trace.AccessDenied(requestErr.Error())
}

Expand Down
6 changes: 3 additions & 3 deletions lib/cloud/aws/tags_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import (
ec2TypesV2 "github.com/aws/aws-sdk-go-v2/service/ec2/types"
rdstypes "github.com/aws/aws-sdk-go-v2/service/rds/types"
redshifttypes "github.com/aws/aws-sdk-go-v2/service/redshift/types"
rsstypes "github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/elasticache"
"github.com/aws/aws-sdk-go/service/memorydb"
"github.com/aws/aws-sdk-go/service/opensearchservice"
"github.com/aws/aws-sdk-go/service/redshiftserverless"
"github.com/aws/aws-sdk-go/service/secretsmanager"
"golang.org/x/exp/maps"

Expand All @@ -48,7 +48,7 @@ type ResourceTag interface {
*ec2.Tag |
*elasticache.Tag |
*memorydb.Tag |
*redshiftserverless.Tag |
rsstypes.Tag |
*opensearchservice.Tag |
*secretsmanager.Tag
}
Expand Down Expand Up @@ -80,7 +80,7 @@ func resourceTagToKeyValue[Tag ResourceTag](tag Tag) (string, string) {
return aws.StringValue(v.Key), aws.StringValue(v.Value)
case *memorydb.Tag:
return aws.StringValue(v.Key), aws.StringValue(v.Value)
case *redshiftserverless.Tag:
case rsstypes.Tag:
return aws.StringValue(v.Key), aws.StringValue(v.Value)
case rdstypes.Tag:
return aws.StringValue(v.Key), aws.StringValue(v.Value)
Expand Down
20 changes: 20 additions & 0 deletions lib/cloud/awstesthelpers/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

rdstypes "github.com/aws/aws-sdk-go-v2/service/rds/types"
redshifttypes "github.com/aws/aws-sdk-go-v2/service/redshift/types"
rsstypes "github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
)

// LabelsToRedshiftTags converts labels into [redshifttypes.Tag] list.
Expand Down Expand Up @@ -63,3 +64,22 @@ func LabelsToRDSTags(labels map[string]string) []rdstypes.Tag {

return ret
}

// LabelsToRedshiftServerlessTags converts labels into a [rsstypes.Tag] list.
func LabelsToRedshiftServerlessTags(labels map[string]string) []rsstypes.Tag {
keys := slices.Collect(maps.Keys(labels))
slices.Sort(keys)

ret := make([]rsstypes.Tag, 0, len(keys))
for _, key := range keys {
key := key
value := labels[key]

ret = append(ret, rsstypes.Tag{
Key: &key,
Value: &value,
})
}

return ret
}
23 changes: 0 additions & 23 deletions lib/cloud/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ import (
"github.com/aws/aws-sdk-go/service/memorydb/memorydbiface"
"github.com/aws/aws-sdk-go/service/opensearchservice"
"github.com/aws/aws-sdk-go/service/opensearchservice/opensearchserviceiface"
"github.com/aws/aws-sdk-go/service/redshiftserverless"
"github.com/aws/aws-sdk-go/service/redshiftserverless/redshiftserverlessiface"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/aws/aws-sdk-go/service/secretsmanager"
Expand Down Expand Up @@ -107,8 +105,6 @@ type GCPClients interface {
type AWSClients interface {
// GetAWSSession returns AWS session for the specified region and any role(s).
GetAWSSession(ctx context.Context, region string, opts ...AWSOptionsFn) (*awssession.Session, error)
// GetAWSRedshiftServerlessClient returns AWS Redshift Serverless client for the specified region.
GetAWSRedshiftServerlessClient(ctx context.Context, region string, opts ...AWSOptionsFn) (redshiftserverlessiface.RedshiftServerlessAPI, error)
// GetAWSElastiCacheClient returns AWS ElastiCache client for the specified region.
GetAWSElastiCacheClient(ctx context.Context, region string, opts ...AWSOptionsFn) (elasticacheiface.ElastiCacheAPI, error)
// GetAWSMemoryDBClient returns AWS MemoryDB client for the specified region.
Expand Down Expand Up @@ -496,15 +492,6 @@ func (c *cloudClients) GetAWSSession(ctx context.Context, region string, opts ..
return c.getAWSSessionForRole(ctx, region, options)
}

// GetAWSRedshiftServerlessClient returns AWS Redshift Serverless client for the specified region.
func (c *cloudClients) GetAWSRedshiftServerlessClient(ctx context.Context, region string, opts ...AWSOptionsFn) (redshiftserverlessiface.RedshiftServerlessAPI, error) {
session, err := c.GetAWSSession(ctx, region, opts...)
if err != nil {
return nil, trace.Wrap(err)
}
return redshiftserverless.New(session), nil
}

// GetAWSElastiCacheClient returns AWS ElastiCache client for the specified region.
func (c *cloudClients) GetAWSElastiCacheClient(ctx context.Context, region string, opts ...AWSOptionsFn) (elasticacheiface.ElastiCacheAPI, error) {
session, err := c.GetAWSSession(ctx, region, opts...)
Expand Down Expand Up @@ -992,7 +979,6 @@ var _ Clients = (*TestCloudClients)(nil)

// TestCloudClients are used in tests.
type TestCloudClients struct {
RedshiftServerless redshiftserverlessiface.RedshiftServerlessAPI
ElastiCache elasticacheiface.ElastiCacheAPI
OpenSearch opensearchserviceiface.OpenSearchServiceAPI
MemoryDB memorydbiface.MemoryDBAPI
Expand Down Expand Up @@ -1060,15 +1046,6 @@ func (c *TestCloudClients) getAWSSessionForRegion(region string) (*awssession.Se
})
}

// GetAWSRedshiftServerlessClient returns AWS Redshift Serverless client for the specified region.
func (c *TestCloudClients) GetAWSRedshiftServerlessClient(ctx context.Context, region string, opts ...AWSOptionsFn) (redshiftserverlessiface.RedshiftServerlessAPI, error) {
_, err := c.GetAWSSession(ctx, region, opts...)
if err != nil {
return nil, trace.Wrap(err)
}
return c.RedshiftServerless, nil
}

// GetAWSElastiCacheClient returns AWS ElastiCache client for the specified region.
func (c *TestCloudClients) GetAWSElastiCacheClient(ctx context.Context, region string, opts ...AWSOptionsFn) (elasticacheiface.ElastiCacheAPI, error) {
_, err := c.GetAWSSession(ctx, region, opts...)
Expand Down
94 changes: 49 additions & 45 deletions lib/cloud/mocks/aws_redshift_serverless.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,123 +19,127 @@
package mocks

import (
"context"
"fmt"
"time"

rss "github.com/aws/aws-sdk-go-v2/service/redshiftserverless"
rsstypes "github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/redshiftserverless"
"github.com/aws/aws-sdk-go/service/redshiftserverless/redshiftserverlessiface"
"github.com/gravitational/trace"
"github.com/jonboulle/clockwork"
)

// RedshiftServerlessMock mocks RedshiftServerless API.
type RedshiftServerlessMock struct {
redshiftserverlessiface.RedshiftServerlessAPI

type RedshiftServerlessClient struct {
Unauth bool
Workgroups []*redshiftserverless.Workgroup
Endpoints []*redshiftserverless.EndpointAccess
TagsByARN map[string][]*redshiftserverless.Tag
GetCredentialsOutput *redshiftserverless.GetCredentialsOutput
Workgroups []rsstypes.Workgroup
Endpoints []rsstypes.EndpointAccess
TagsByARN map[string][]rsstypes.Tag
GetCredentialsOutput *rss.GetCredentialsOutput
}

func (m RedshiftServerlessMock) GetWorkgroupWithContext(_ aws.Context, input *redshiftserverless.GetWorkgroupInput, _ ...request.Option) (*redshiftserverless.GetWorkgroupOutput, error) {
func (m RedshiftServerlessClient) GetWorkgroup(_ context.Context, input *rss.GetWorkgroupInput, _ ...func(*rss.Options)) (*rss.GetWorkgroupOutput, error) {
if m.Unauth {
return nil, trace.AccessDenied("unauthorized")
}

for _, workgroup := range m.Workgroups {
if aws.StringValue(workgroup.WorkgroupName) == aws.StringValue(input.WorkgroupName) {
return new(redshiftserverless.GetWorkgroupOutput).SetWorkgroup(workgroup), nil
return &rss.GetWorkgroupOutput{
Workgroup: &workgroup,
}, nil
}
}
return nil, trace.NotFound("workgroup %q not found", aws.StringValue(input.WorkgroupName))
}
func (m RedshiftServerlessMock) GetEndpointAccessWithContext(_ aws.Context, input *redshiftserverless.GetEndpointAccessInput, _ ...request.Option) (*redshiftserverless.GetEndpointAccessOutput, error) {

func (m RedshiftServerlessClient) GetEndpointAccess(_ context.Context, input *rss.GetEndpointAccessInput, _ ...func(*rss.Options)) (*rss.GetEndpointAccessOutput, error) {
if m.Unauth {
return nil, trace.AccessDenied("unauthorized")
}
for _, endpoint := range m.Endpoints {
if aws.StringValue(endpoint.EndpointName) == aws.StringValue(input.EndpointName) {
return new(redshiftserverless.GetEndpointAccessOutput).SetEndpoint(endpoint), nil
return &rss.GetEndpointAccessOutput{
Endpoint: &endpoint,
}, nil
}
}
return nil, trace.NotFound("endpoint %q not found", aws.StringValue(input.EndpointName))
}
func (m RedshiftServerlessMock) ListWorkgroupsPagesWithContext(_ aws.Context, input *redshiftserverless.ListWorkgroupsInput, fn func(*redshiftserverless.ListWorkgroupsOutput, bool) bool, _ ...request.Option) error {

func (m RedshiftServerlessClient) ListWorkgroups(_ context.Context, input *rss.ListWorkgroupsInput, _ ...func(*rss.Options)) (*rss.ListWorkgroupsOutput, error) {
if m.Unauth {
return trace.AccessDenied("unauthorized")
return nil, trace.AccessDenied("unauthorized")
}
fn(&redshiftserverless.ListWorkgroupsOutput{
return &rss.ListWorkgroupsOutput{
Workgroups: m.Workgroups,
}, true)
return nil
}, nil
}
func (m RedshiftServerlessMock) ListEndpointAccessPagesWithContext(_ aws.Context, input *redshiftserverless.ListEndpointAccessInput, fn func(*redshiftserverless.ListEndpointAccessOutput, bool) bool, _ ...request.Option) error {

func (m RedshiftServerlessClient) ListEndpointAccess(_ context.Context, input *rss.ListEndpointAccessInput, _ ...func(*rss.Options)) (*rss.ListEndpointAccessOutput, error) {
if m.Unauth {
return trace.AccessDenied("unauthorized")
return nil, trace.AccessDenied("unauthorized")
}
fn(&redshiftserverless.ListEndpointAccessOutput{
return &rss.ListEndpointAccessOutput{
Endpoints: m.Endpoints,
}, true)
return nil
}, nil
}
func (m RedshiftServerlessMock) ListTagsForResourceWithContext(_ aws.Context, input *redshiftserverless.ListTagsForResourceInput, _ ...request.Option) (*redshiftserverless.ListTagsForResourceOutput, error) {

func (m RedshiftServerlessClient) ListTagsForResource(_ context.Context, input *rss.ListTagsForResourceInput, _ ...func(*rss.Options)) (*rss.ListTagsForResourceOutput, error) {
if m.Unauth {
return nil, trace.AccessDenied("unauthorized")
}
if m.TagsByARN == nil {
return &redshiftserverless.ListTagsForResourceOutput{}, nil
return &rss.ListTagsForResourceOutput{}, nil
}
return &redshiftserverless.ListTagsForResourceOutput{
return &rss.ListTagsForResourceOutput{
Tags: m.TagsByARN[aws.StringValue(input.ResourceArn)],
}, nil
}
func (m RedshiftServerlessMock) GetCredentialsWithContext(aws.Context, *redshiftserverless.GetCredentialsInput, ...request.Option) (*redshiftserverless.GetCredentialsOutput, error) {

func (m RedshiftServerlessClient) GetCredentials(context.Context, *rss.GetCredentialsInput, ...func(*rss.Options)) (*rss.GetCredentialsOutput, error) {
if m.Unauth || m.GetCredentialsOutput == nil {
return nil, trace.AccessDenied("access denied")
}
return m.GetCredentialsOutput, nil
}

// RedshiftServerlessWorkgroup returns a sample redshiftserverless.Workgroup.
func RedshiftServerlessWorkgroup(name, region string) *redshiftserverless.Workgroup {
return &redshiftserverless.Workgroup{
BaseCapacity: aws.Int64(32),
ConfigParameters: []*redshiftserverless.ConfigParameter{{
// RedshiftServerlessWorkgroup returns a sample rsstypes.Workgroup.
func RedshiftServerlessWorkgroup(name, region string) *rsstypes.Workgroup {
return &rsstypes.Workgroup{
BaseCapacity: aws.Int32(32),
ConfigParameters: []rsstypes.ConfigParameter{{
ParameterKey: aws.String("max_query_execution_time"),
ParameterValue: aws.String("14400"),
}},
CreationDate: aws.Time(sampleTime),
Endpoint: &redshiftserverless.Endpoint{
Endpoint: &rsstypes.Endpoint{
Address: aws.String(fmt.Sprintf("%v.123456789012.%v.redshift-serverless.amazonaws.com", name, region)),
Port: aws.Int64(5439),
VpcEndpoints: []*redshiftserverless.VpcEndpoint{{
Port: aws.Int32(5439),
VpcEndpoints: []rsstypes.VpcEndpoint{{
VpcEndpointId: aws.String("vpc-endpoint-id"),
VpcId: aws.String("vpc-id"),
}},
},
NamespaceName: aws.String("my-namespace"),
PubliclyAccessible: aws.Bool(true),
Status: aws.String("AVAILABLE"),
Status: rsstypes.WorkgroupStatusAvailable,
WorkgroupArn: aws.String(fmt.Sprintf("arn:aws:redshift-serverless:%v:123456789012:workgroup/some-uuid-for-%v", region, name)),
WorkgroupId: aws.String(fmt.Sprintf("some-uuid-for-%v", name)),
WorkgroupName: aws.String(name),
}
}

// RedshiftServerlessEndpointAccess returns a sample redshiftserverless.EndpointAccess.
func RedshiftServerlessEndpointAccess(workgroup *redshiftserverless.Workgroup, name, region string) *redshiftserverless.EndpointAccess {
return &redshiftserverless.EndpointAccess{
// RedshiftServerlessEndpointAccess returns a sample rsstypes.EndpointAccess.
func RedshiftServerlessEndpointAccess(workgroup *rsstypes.Workgroup, name, region string) *rsstypes.EndpointAccess {
return &rsstypes.EndpointAccess{
Address: aws.String(fmt.Sprintf("%s-endpoint-xxxyyyzzz.123456789012.%s.redshift-serverless.amazonaws.com", name, region)),
EndpointArn: aws.String(fmt.Sprintf("arn:aws:redshift-serverless:%s:123456789012:managedvpcendpoint/some-uuid-for-%v", region, name)),
EndpointCreateTime: aws.Time(sampleTime),
EndpointName: aws.String(name),
EndpointStatus: aws.String("AVAILABLE"),
Port: aws.Int64(5439),
VpcEndpoint: &redshiftserverless.VpcEndpoint{
Port: aws.Int32(5439),
VpcEndpoint: &rsstypes.VpcEndpoint{
VpcEndpointId: aws.String("vpce-id"),
VpcId: aws.String("vpc-id"),
},
Expand All @@ -144,11 +148,11 @@ func RedshiftServerlessEndpointAccess(workgroup *redshiftserverless.Workgroup, n
}

// RedshiftServerlessGetCredentialsOutput return a sample redshiftserverless.GetCredentialsOutput.
func RedshiftServerlessGetCredentialsOutput(user, password string, clock clockwork.Clock) *redshiftserverless.GetCredentialsOutput {
func RedshiftServerlessGetCredentialsOutput(user, password string, clock clockwork.Clock) *rss.GetCredentialsOutput {
if clock == nil {
clock = clockwork.NewRealClock()
}
return &redshiftserverless.GetCredentialsOutput{
return &rss.GetCredentialsOutput{
DbUser: aws.String(user),
DbPassword: aws.String(password),
Expiration: aws.Time(clock.Now().Add(15 * time.Minute)),
Expand Down
Loading

0 comments on commit 26578c9

Please sign in to comment.