From a3585de8e5b8a021056baec97cd2df162ed65156 Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Sun, 23 Apr 2023 01:28:36 +0000 Subject: [PATCH 1/8] add aws lib functions --- .../smithy/aws/go/codegen/AwsFnProvider.java | 23 +++++++++++++++++++ .../aws/go/codegen/AwsGoDependency.java | 3 +++ .../smithy/aws/go/codegen/AwsQuery.java | 10 ++++++++ .../go/codegen/JsonRpcProtocolGenerator.java | 9 ++++++++ .../go/codegen/RestJsonProtocolGenerator.java | 12 ++++++++++ .../go/codegen/RestXmlProtocolGenerator.java | 9 ++++++++ 6 files changed, 66 insertions(+) create mode 100644 codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java new file mode 100644 index 00000000000..b92adc11d78 --- /dev/null +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java @@ -0,0 +1,23 @@ +package software.amazon.smithy.aws.go.codegen; + +import software.amazon.smithy.codegen.core.Symbol; +import software.amazon.smithy.go.codegen.SymbolUtils; +import software.amazon.smithy.go.codegen.endpoints.FnProvider; + + +public class AwsFnProvider implements FnProvider { + @Override + public Symbol fnFor(String name) { + return switch (name) { + case "aws.partition" -> SymbolUtils.createValueSymbolBuilder("GetPartition", + AwsGoDependency.AWS_ENDPOINT_RULESFN).build(); + case "aws.parseArn" -> SymbolUtils.createValueSymbolBuilder("ParseARN", + AwsGoDependency.AWS_ENDPOINT_RULESFN).build(); + case "aws.isVirtualHostableS3Bucket" -> + SymbolUtils.createValueSymbolBuilder("IsVirtualHostableS3Bucket", + AwsGoDependency.AWS_ENDPOINT_RULESFN).build(); + + default -> null; + }; + } +} diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsGoDependency.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsGoDependency.java index 05cd28da080..326dab43240 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsGoDependency.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsGoDependency.java @@ -39,6 +39,9 @@ public class AwsGoDependency { public static final GoDependency SERVICE_INTERNAL_EVENTSTREAMAPI = awsModuleDep("aws/protocol/eventstream", "eventstreamapi", Versions.AWS_PROTOCOL_EVENTSTREAM, "eventstreamapi"); + public static final GoDependency AWS_ENDPOINT_RULESFN = aws("internal/endpoints/awsrulesfn"); + + public static final GoDependency INTERNAL_ENDPOINTS_V2 = awsModuleDep("internal/endpoints/v2", null, Versions.INTERNAL_ENDPOINTS_V2, "endpoints"); public static final GoDependency S3_SHARED_CONFIG = aws("service/internal/s3shared/config", "s3sharedconfig"); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java index 98c70525958..908e3f07992 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java @@ -27,6 +27,8 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.shapes.UnionShape; import software.amazon.smithy.model.traits.ErrorTrait; +import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.FnGenerator; /** * Handles generating the aws query protocol for services. @@ -211,8 +213,16 @@ public void generateEventStreamComponents(GenerationContext context) { throw new CodegenException("event streams not supported with AWS QUERY protocol."); } + @Override + public void generateEndpointRulesEngine(GenerationContext context) { + var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + generator.generate(context); + } + @Override protected void writeOperationSerializerMiddlewareEventStreamSetup(GenerationContext context, EventStreamInfo info) { throw new CodegenException("event streams not supported with AWS QUERY protocol."); } + + } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java index af8bf9c971b..5fa24396211 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java @@ -42,6 +42,9 @@ import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.model.traits.EventHeaderTrait; import software.amazon.smithy.model.traits.EventPayloadTrait; +import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.FnGenerator; + /** * Handles generating the aws.rest-json protocol for services. @@ -360,4 +363,10 @@ protected void generateEventStreamDeserializers( } } + @Override + public void generateEndpointRulesEngine(GenerationContext context) { + var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + generator.generate(context); + } + } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java index 4318ece8be1..2932590b645 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java @@ -58,6 +58,9 @@ import software.amazon.smithy.model.traits.StreamingTrait; import software.amazon.smithy.model.traits.TimestampFormatTrait; import software.amazon.smithy.model.traits.XmlNamespaceTrait; +import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.FnGenerator; + /** * Handles general components across the AWS JSON protocols that have HTTP bindings. @@ -108,6 +111,15 @@ protected void generateOperationDocumentSerializer( .build()); } + + @Override + public void generateEndpointRulesEngine(GenerationContext context) { + var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + generator.generate(context); + } + + + @Override protected void writeMiddlewarePayloadAsDocumentSerializerDelegator( GenerationContext context, diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java index 4364127455b..f6177a53f79 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java @@ -46,6 +46,9 @@ import software.amazon.smithy.model.traits.TimestampFormatTrait; import software.amazon.smithy.model.traits.XmlAttributeTrait; import software.amazon.smithy.model.traits.XmlNamespaceTrait; +import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.FnGenerator; + abstract class RestXmlProtocolGenerator extends HttpBindingProtocolGenerator { private final Set generatedDocumentBodyShapeSerializers = new HashSet<>(); @@ -662,4 +665,10 @@ protected void generateEventStreamDeserializers( eventDocumentShapes.addAll(ProtocolUtils.resolveRequiredDocumentShapeSerde(model, eventDocumentShapes)); generateDocumentBodyShapeDeserializers(context, eventDocumentShapes); } + + @Override + public void generateEndpointRulesEngine(GenerationContext context) { + var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + generator.generate(context); + } } From 8050b2b4df8b5c3afc39483918ec4b305f2b22a8 Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Wed, 26 Apr 2023 22:06:46 +0000 Subject: [PATCH 2/8] fixed partition function --- .../awsrulesfn/internal/partition/codegen.go | 28 ++- internal/endpoints/awsrulesfn/partition.go | 46 ++-- .../endpoints/awsrulesfn/partition_test.go | 47 ++-- internal/endpoints/awsrulesfn/partitions.go | 220 +++++++++--------- 4 files changed, 174 insertions(+), 167 deletions(-) diff --git a/internal/endpoints/awsrulesfn/internal/partition/codegen.go b/internal/endpoints/awsrulesfn/internal/partition/codegen.go index 079745d70c1..899bb9418cf 100644 --- a/internal/endpoints/awsrulesfn/internal/partition/codegen.go +++ b/internal/endpoints/awsrulesfn/internal/partition/codegen.go @@ -38,9 +38,13 @@ var tmpl = template.Must(template.New("generate"). // Code generated by endpoint/awsrulesfn/internal/partition. DO NOT EDIT. package awsrulesfn -import ( - "github.com/aws/smithy-go/ptr" -) + + +// GetPartition returns an AWS [Partition] for the region provided. If the +// partition cannot be determined nil will be returned. +func GetPartition(region string) *PartitionConfig { + return getPartition(partitions, region) +} var partitions = []Partition { @@ -49,18 +53,18 @@ var partitions = []Partition { ID: {{ quote $partition.ID }}, RegionRegex: {{ quote $partition.RegionRegex }}, DefaultConfig: PartitionConfig{ - Name: {{ strOrNil $partition.DefaultConfig.Name }}, - DNSSuffix: {{ strOrNil $partition.DefaultConfig.DNSSuffix }}, - DualStackDNSSuffix: {{ strOrNil $partition.DefaultConfig.DualStackDNSSuffix }}, - SupportsFIPS: {{ boolOrNil $partition.DefaultConfig.SupportsFIPS }}, - SupportsDualStack: {{ boolOrNil $partition.DefaultConfig.SupportsDualStack }}, + Name: {{ quote $partition.DefaultConfig.Name }}, + DnsSuffix: {{ quote $partition.DefaultConfig.DnsSuffix }}, + DualStackDnsSuffix: {{ quote $partition.DefaultConfig.DualStackDnsSuffix }}, + SupportsFIPS: {{ $partition.DefaultConfig.SupportsFIPS }}, + SupportsDualStack: {{ $partition.DefaultConfig.SupportsDualStack }}, }, - Regions: map[string]PartitionConfig { + Regions: map[string]RegionOverrides { {{- range $region, $config := $partition.Regions }} - {{ quote $region }}: PartitionConfig{ + {{ quote $region }}: RegionOverrides{ Name: {{ strOrNil $config.Name }}, - DNSSuffix: {{ strOrNil $config.DNSSuffix }}, - DualStackDNSSuffix: {{ strOrNil $config.DualStackDNSSuffix }}, + DnsSuffix: {{ strOrNil $config.DnsSuffix }}, + DualStackDnsSuffix: {{ strOrNil $config.DualStackDnsSuffix }}, SupportsFIPS: {{ boolOrNil $config.SupportsFIPS }}, SupportsDualStack: {{ boolOrNil $config.SupportsDualStack }}, }, diff --git a/internal/endpoints/awsrulesfn/partition.go b/internal/endpoints/awsrulesfn/partition.go index 23ce26df0ad..ba6032758a5 100644 --- a/internal/endpoints/awsrulesfn/partition.go +++ b/internal/endpoints/awsrulesfn/partition.go @@ -5,33 +5,35 @@ import "regexp" // Partition provides the metadata describing an AWS partition. type Partition struct { ID string `json:"id"` - Regions map[string]PartitionConfig `json:"regions"` + Regions map[string]RegionOverrides `json:"regions"` RegionRegex string `json:"regionRegex"` DefaultConfig PartitionConfig `json:"outputs"` } // PartitionConfig provides the endpoint metadata for an AWS region or partition. type PartitionConfig struct { + Name string `json:"name"` + DnsSuffix string `json:"dnsSuffix"` + DualStackDnsSuffix string `json:"dualStackDnsSuffix"` + SupportsFIPS bool `json:"supportsFIPS"` + SupportsDualStack bool `json:"supportsDualStack"` +} + +type RegionOverrides struct { Name *string `json:"name"` - DNSSuffix *string `json:"dnsSuffix"` - DualStackDNSSuffix *string `json:"dualStackDnsSuffix"` + DnsSuffix *string `json:"dnsSuffix"` + DualStackDnsSuffix *string `json:"dualStackDnsSuffix"` SupportsFIPS *bool `json:"supportsFIPS"` SupportsDualStack *bool `json:"supportsDualStack"` } const defaultPartition = "aws" -// GetPartition returns an AWS [Partition] for the region provided. If the -// partition cannot be determined nil will be returned. -func GetPartition(region string) *PartitionConfig { - return getPartition(partitions, region) -} - func getPartition(partitions []Partition, region string) *PartitionConfig { for _, partition := range partitions { if v, ok := partition.Regions[region]; ok { - v = mergePartition(v, partition.DefaultConfig) - return &v + p := mergeOverrides(partition.DefaultConfig, v) + return &p } } @@ -53,21 +55,21 @@ func getPartition(partitions []Partition, region string) *PartitionConfig { return nil } -func mergePartition(into PartitionConfig, from PartitionConfig) PartitionConfig { - if into.Name == nil { - into.Name = from.Name +func mergeOverrides(into PartitionConfig, from RegionOverrides) PartitionConfig { + if from.Name != nil { + into.Name = *from.Name } - if into.DNSSuffix == nil { - into.DNSSuffix = from.DNSSuffix + if from.DnsSuffix != nil { + into.DnsSuffix = *from.DnsSuffix } - if into.DualStackDNSSuffix == nil { - into.DualStackDNSSuffix = from.DualStackDNSSuffix + if from.DualStackDnsSuffix != nil { + into.DualStackDnsSuffix = *from.DualStackDnsSuffix } - if into.SupportsFIPS == nil { - into.SupportsFIPS = from.SupportsFIPS + if from.SupportsFIPS != nil { + into.SupportsFIPS = *from.SupportsFIPS } - if into.SupportsDualStack == nil { - into.SupportsDualStack = from.SupportsDualStack + if from.SupportsDualStack != nil { + into.SupportsDualStack = *from.SupportsDualStack } return into } diff --git a/internal/endpoints/awsrulesfn/partition_test.go b/internal/endpoints/awsrulesfn/partition_test.go index 1ffa59783e5..94930bd84de 100644 --- a/internal/endpoints/awsrulesfn/partition_test.go +++ b/internal/endpoints/awsrulesfn/partition_test.go @@ -2,7 +2,6 @@ package awsrulesfn import ( "testing" - "github.com/aws/smithy-go/ptr" ) var mockPartitions = []Partition{ @@ -10,24 +9,24 @@ var mockPartitions = []Partition{ ID: "aws", RegionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws"), - DNSSuffix: ptr.String("amazonaws.com"), - DualStackDNSSuffix: ptr.String("api.aws"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(true), + Name: "aws", + DnsSuffix: "amazonaws.com", + DualStackDnsSuffix: "api.aws", + SupportsFIPS: true, + SupportsDualStack: true, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "af-south-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-west-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, @@ -37,31 +36,31 @@ var mockPartitions = []Partition{ ID: "aws-cn", RegionRegex: "^cn\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws-cn"), - DNSSuffix: ptr.String("amazonaws.com.cn"), - DualStackDNSSuffix: ptr.String("api.amazonwebservices.com.cn"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(true), + Name: "aws-cn", + DnsSuffix: "amazonaws.com.cn", + DualStackDnsSuffix: "api.amazonwebservices.com.cn", + SupportsFIPS: true, + SupportsDualStack: true, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "aws-cn-global": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "cn-north-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "cn-northwest-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, @@ -95,7 +94,7 @@ func TestGetPartition(t *testing.T) { p := GetPartition(c.Region) expected := c.PartitionName actual := p.Name - if expected != *actual { + if expected != actual { t.Errorf("expected %v, got %v", expected, actual) } }) diff --git a/internal/endpoints/awsrulesfn/partitions.go b/internal/endpoints/awsrulesfn/partitions.go index 2cb53550b52..7ea49d4ea40 100644 --- a/internal/endpoints/awsrulesfn/partitions.go +++ b/internal/endpoints/awsrulesfn/partitions.go @@ -2,208 +2,210 @@ package awsrulesfn -import ( - "github.com/aws/smithy-go/ptr" -) +// GetPartition returns an AWS [Partition] for the region provided. If the +// partition cannot be determined nil will be returned. +func GetPartition(region string) *PartitionConfig { + return getPartition(partitions, region) +} var partitions = []Partition{ { ID: "aws", RegionRegex: "^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws"), - DNSSuffix: ptr.String("amazonaws.com"), - DualStackDNSSuffix: ptr.String("api.aws"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(true), + Name: "aws", + DnsSuffix: "amazonaws.com", + DualStackDnsSuffix: "api.aws", + SupportsFIPS: true, + SupportsDualStack: true, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "af-south-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-east-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-northeast-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-northeast-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-northeast-3": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-south-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-south-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-southeast-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-southeast-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ap-southeast-3": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "aws-global": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "ca-central-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-central-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-central-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-north-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-south-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-south-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-west-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-west-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "eu-west-3": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "me-central-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "me-south-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "sa-east-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-east-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-east-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-west-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-west-2": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, @@ -213,31 +215,31 @@ var partitions = []Partition{ ID: "aws-cn", RegionRegex: "^cn\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws-cn"), - DNSSuffix: ptr.String("amazonaws.com.cn"), - DualStackDNSSuffix: ptr.String("api.amazonwebservices.com.cn"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(true), + Name: "aws-cn", + DnsSuffix: "amazonaws.com.cn", + DualStackDnsSuffix: "api.amazonwebservices.com.cn", + SupportsFIPS: true, + SupportsDualStack: true, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "aws-cn-global": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "cn-north-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "cn-northwest-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, @@ -247,31 +249,31 @@ var partitions = []Partition{ ID: "aws-us-gov", RegionRegex: "^us\\-gov\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws-us-gov"), - DNSSuffix: ptr.String("amazonaws.com"), - DualStackDNSSuffix: ptr.String("api.aws"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(true), + Name: "aws-us-gov", + DnsSuffix: "amazonaws.com", + DualStackDnsSuffix: "api.aws", + SupportsFIPS: true, + SupportsDualStack: true, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "aws-us-gov-global": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-gov-east-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-gov-west-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, @@ -281,31 +283,31 @@ var partitions = []Partition{ ID: "aws-iso", RegionRegex: "^us\\-iso\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws-iso"), - DNSSuffix: ptr.String("c2s.ic.gov"), - DualStackDNSSuffix: ptr.String("c2s.ic.gov"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(false), + Name: "aws-iso", + DnsSuffix: "c2s.ic.gov", + DualStackDnsSuffix: "c2s.ic.gov", + SupportsFIPS: true, + SupportsDualStack: false, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "aws-iso-global": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-iso-east-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-iso-west-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, @@ -315,24 +317,24 @@ var partitions = []Partition{ ID: "aws-iso-b", RegionRegex: "^us\\-isob\\-\\w+\\-\\d+$", DefaultConfig: PartitionConfig{ - Name: ptr.String("aws-iso-b"), - DNSSuffix: ptr.String("sc2s.sgov.gov"), - DualStackDNSSuffix: ptr.String("sc2s.sgov.gov"), - SupportsFIPS: ptr.Bool(true), - SupportsDualStack: ptr.Bool(false), + Name: "aws-iso-b", + DnsSuffix: "sc2s.sgov.gov", + DualStackDnsSuffix: "sc2s.sgov.gov", + SupportsFIPS: true, + SupportsDualStack: false, }, - Regions: map[string]PartitionConfig{ + Regions: map[string]RegionOverrides{ "aws-iso-b-global": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, "us-isob-east-1": { Name: nil, - DNSSuffix: nil, - DualStackDNSSuffix: nil, + DnsSuffix: nil, + DualStackDnsSuffix: nil, SupportsFIPS: nil, SupportsDualStack: nil, }, From a9e881d2ceb490342b27b60047e8900ff60e8ddb Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Wed, 26 Apr 2023 23:54:48 +0000 Subject: [PATCH 3/8] add optional method in awsfngenerator --- .../amazon/smithy/aws/go/codegen/AwsFnProvider.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java index b92adc11d78..c8f72d400a5 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsFnProvider.java @@ -3,6 +3,7 @@ import software.amazon.smithy.codegen.core.Symbol; import software.amazon.smithy.go.codegen.SymbolUtils; import software.amazon.smithy.go.codegen.endpoints.FnProvider; +import software.amazon.smithy.rulesengine.language.syntax.fn.FunctionDefinition; public class AwsFnProvider implements FnProvider { @@ -20,4 +21,13 @@ public Symbol fnFor(String name) { default -> null; }; } + + static boolean isFnResultOptional(FunctionDefinition fn) { + return switch (fn.getId()) { + case "aws.partition" -> true; + case "aws.parseArn" -> true; + case "aws.isVirtualHostableS3Bucket" -> true; + default -> false; + }; + } } From 86145cb40215b9bdbf9647bd2ddd31e4487af333 Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Wed, 26 Apr 2023 23:55:16 +0000 Subject: [PATCH 4/8] fix casing --- internal/endpoints/awsrulesfn/arn.go | 8 ++++---- internal/endpoints/awsrulesfn/arn_test.go | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/endpoints/awsrulesfn/arn.go b/internal/endpoints/awsrulesfn/arn.go index 32a1a0ac877..e6223dd3b3e 100644 --- a/internal/endpoints/awsrulesfn/arn.go +++ b/internal/endpoints/awsrulesfn/arn.go @@ -9,8 +9,8 @@ type ARN struct { Partition string Service string Region string - AccountID string - ResourceID OptionalStringSlice + AccountId string + ResourceId OptionalStringSlice } const ( @@ -54,8 +54,8 @@ func ParseARN(input string) *ARN { Partition: sections[sectionPartition], Service: sections[sectionService], Region: sections[sectionRegion], - AccountID: sections[sectionAccountID], - ResourceID: splitResource(sections[sectionResource]), + AccountId: sections[sectionAccountID], + ResourceId: splitResource(sections[sectionResource]), } } diff --git a/internal/endpoints/awsrulesfn/arn_test.go b/internal/endpoints/awsrulesfn/arn_test.go index f59f53b31ac..bab7f861100 100644 --- a/internal/endpoints/awsrulesfn/arn_test.go +++ b/internal/endpoints/awsrulesfn/arn_test.go @@ -24,8 +24,8 @@ func TestParseARN(t *testing.T) { Partition: "aws", Service: "ecr", Region: "us-west-2", - AccountID: "123456789012", - ResourceID: []string{"repository", "foo", "bar"}, + AccountId: "123456789012", + ResourceId: []string{"repository", "foo", "bar"}, }, }, { @@ -34,8 +34,8 @@ func TestParseARN(t *testing.T) { Partition: "aws", Service: "elasticbeanstalk", Region: "us-east-1", - AccountID: "123456789012", - ResourceID: []string{"environment", "My App", "MyEnvironment"}, + AccountId: "123456789012", + ResourceId: []string{"environment", "My App", "MyEnvironment"}, }, }, { @@ -44,8 +44,8 @@ func TestParseARN(t *testing.T) { Partition: "aws", Service: "iam", Region: "", - AccountID: "123456789012", - ResourceID: []string{"user", "David"}, + AccountId: "123456789012", + ResourceId: []string{"user", "David"}, }, }, { @@ -54,8 +54,8 @@ func TestParseARN(t *testing.T) { Partition: "aws", Service: "rds", Region: "eu-west-1", - AccountID: "123456789012", - ResourceID: []string{"db", "mysql-db"}, + AccountId: "123456789012", + ResourceId: []string{"db", "mysql-db"}, }, }, { @@ -64,8 +64,8 @@ func TestParseARN(t *testing.T) { Partition: "aws", Service: "s3", Region: "", - AccountID: "", - ResourceID: []string{"my_corporate_bucket", "exampleobject.png"}, + AccountId: "", + ResourceId: []string{"my_corporate_bucket", "exampleobject.png"}, }, }, } From 1cb0faed81979040e6fcd6d712bdf7eba07d5ecf Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Wed, 3 May 2023 23:14:38 +0000 Subject: [PATCH 5/8] renamed upstream file --- .../smithy/aws/go/codegen/AwsQuery.java | 13 +-- .../go/codegen/JsonRpcProtocolGenerator.java | 20 ++-- .../go/codegen/RestJsonProtocolGenerator.java | 61 +++++----- .../go/codegen/RestXmlProtocolGenerator.java | 106 ++++++++---------- 4 files changed, 90 insertions(+), 110 deletions(-) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java index 908e3f07992..8a1632fc766 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java @@ -27,7 +27,7 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.shapes.UnionShape; import software.amazon.smithy.model.traits.ErrorTrait; -import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.EndpointResolutionV2Generator; import software.amazon.smithy.go.codegen.endpoints.FnGenerator; /** @@ -194,8 +194,7 @@ public String getErrorCode(ServiceShape service, StructureShape errorShape) { protected void generateEventStreamSerializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { throw new CodegenException("event streams not supported with AWS QUERY protocol."); } @@ -203,8 +202,7 @@ protected void generateEventStreamSerializers( protected void generateEventStreamDeserializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { throw new CodegenException("event streams not supported with AWS QUERY protocol."); } @@ -214,8 +212,8 @@ public void generateEventStreamComponents(GenerationContext context) { } @Override - public void generateEndpointRulesEngine(GenerationContext context) { - var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + public void generateEndpointResolutionV2(GenerationContext context) { + var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } @@ -224,5 +222,4 @@ protected void writeOperationSerializerMiddlewareEventStreamSetup(GenerationCont throw new CodegenException("event streams not supported with AWS QUERY protocol."); } - } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java index 5fa24396211..b50ed810ecc 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java @@ -42,10 +42,9 @@ import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.model.traits.EventHeaderTrait; import software.amazon.smithy.model.traits.EventPayloadTrait; -import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.EndpointResolutionV2Generator; import software.amazon.smithy.go.codegen.endpoints.FnGenerator; - /** * Handles generating the aws.rest-json protocol for services. * @@ -82,7 +81,8 @@ protected void writeDefaultHeaders(GenerationContext context, OperationShape ope protected void serializeInputDocument(GenerationContext context, OperationShape operation) { GoWriter writer = context.getWriter().get(); - // Stub synthetic inputs mean there never was an input modeled, always serialize empty JSON object + // Stub synthetic inputs mean there never was an input modeled, always serialize + // empty JSON object // as place holder. if (CodegenUtils.isStubSynthetic(ProtocolUtils.expectInput(context.getModel(), operation))) { writer.addUseImports(SmithyGoDependency.STRINGS); @@ -212,8 +212,7 @@ protected void writeOperationSerializerMiddlewareEventStreamSetup(GenerationCont protected void generateEventStreamSerializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { Model model = context.getModel(); AwsEventStreamUtils.generateEventStreamSerializer(context, eventUnion); @@ -279,8 +278,7 @@ protected void generateEventStreamSerializers( protected void generateEventStreamDeserializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { var model = context.getModel(); AwsEventStreamUtils.generateEventStreamDeserializer(context, eventUnion); @@ -317,7 +315,7 @@ protected void generateEventStreamDeserializers( payloadTarget, ctx.getService(), getProtocolName()); var ctxWriter = ctx.getWriter().get(); ctxWriter.openBlock("if err := $L(&$L, shape); err != nil {", "}", functionName, operand, - () -> handleDecodeError(ctxWriter)) + () -> handleDecodeError(ctxWriter)) .write("return nil"); }); @@ -350,7 +348,7 @@ protected void generateEventStreamDeserializers( AwsProtocolUtils.initializeJsonEventMessageDeserializer(ctx, "nil,"); var ctxWriter = ctx.getWriter().get(); ctxWriter.openBlock("if err := $L(&$L, shape); err != nil {", "}", functionName, operand, - () -> handleDecodeError(ctxWriter, "nil,")) + () -> handleDecodeError(ctxWriter, "nil,")) .write("return v, nil"); }); var initialMessageMembers = streamInfo.getInitialMessageMembers() @@ -364,8 +362,8 @@ protected void generateEventStreamDeserializers( } @Override - public void generateEndpointRulesEngine(GenerationContext context) { - var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + public void generateEndpointResolutionV2(GenerationContext context) { + var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java index 2932590b645..c819acb06fa 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java @@ -58,16 +58,17 @@ import software.amazon.smithy.model.traits.StreamingTrait; import software.amazon.smithy.model.traits.TimestampFormatTrait; import software.amazon.smithy.model.traits.XmlNamespaceTrait; -import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.EndpointResolutionV2Generator; import software.amazon.smithy.go.codegen.endpoints.FnGenerator; - /** - * Handles general components across the AWS JSON protocols that have HTTP bindings. + * Handles general components across the AWS JSON protocols that have HTTP + * bindings. * It handles reading and writing from document bodies, including generating any * functions needed for performing serde. * - * @see Smithy HTTP protocol bindings. + * @see Smithy HTTP + * protocol bindings. */ abstract class RestJsonProtocolGenerator extends HttpBindingProtocolGenerator { private final Set generatedDocumentBodyShapeSerializers = new HashSet<>(); @@ -90,8 +91,7 @@ protected TimestampFormatTrait.Format getDocumentTimestampFormat() { @Override protected void generateOperationDocumentSerializer( GenerationContext context, - OperationShape operation - ) { + OperationShape operation) { Model model = context.getModel(); HttpBindingIndex bindingIndex = HttpBindingIndex.of(model); Set documentBindings = bindingIndex.getRequestBindings(operation, HttpBinding.Location.DOCUMENT) @@ -111,21 +111,17 @@ protected void generateOperationDocumentSerializer( .build()); } - @Override - public void generateEndpointRulesEngine(GenerationContext context) { - var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + public void generateEndpointResolutionV2(GenerationContext context) { + var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } - - @Override protected void writeMiddlewarePayloadAsDocumentSerializerDelegator( GenerationContext context, MemberShape memberShape, - String operand - ) { + String operand) { GoWriter writer = context.getWriter().get(); Model model = context.getModel(); Shape payloadShape = model.expectShape(memberShape.getTarget()); @@ -165,7 +161,8 @@ protected void writeMiddlewarePayloadAsDocumentSerializerDelegator( } /** - * Retruns the MediaType for the payload shape derived from the MediaTypeTrait, shape type, or document content type. + * Retruns the MediaType for the payload shape derived from the MediaTypeTrait, + * shape type, or document content type. * * @param payloadShape shape bound to the payload. * @return string for media type. @@ -192,8 +189,7 @@ private String getPayloadShapeMediaType(Shape payloadShape) { protected void writeMiddlewareDocumentSerializerDelegator( GenerationContext context, OperationShape operation, - GoStackStepMiddlewareGenerator generator - ) { + GoStackStepMiddlewareGenerator generator) { GoWriter writer = context.getWriter().get(); writer.addUseImports(SmithyGoDependency.SMITHY); writer.addUseImports(SmithyGoDependency.SMITHY_JSON); @@ -238,8 +234,7 @@ protected void generateDocumentBodyShapeSerializers(GenerationContext context, S protected void writeMiddlewareDocumentDeserializerDelegator( GenerationContext context, OperationShape operation, - GoStackStepMiddlewareGenerator generator - ) { + GoStackStepMiddlewareGenerator generator) { Model model = context.getModel(); GoWriter writer = context.getWriter().get(); Shape targetShape = ProtocolUtils.expectOutput(model, operation); @@ -256,13 +251,15 @@ protected void writeMiddlewareDocumentDeserializerDelegator( Shape payloadShape = model.expectShape(memberShape.getTarget()); - // if target shape is of type String or type Blob, then delegate deserializers for explicit payload shapes + // if target shape is of type String or type Blob, then delegate deserializers + // for explicit payload shapes if (payloadShape.isStringShape() || payloadShape.isBlobShape()) { writeMiddlewarePayloadBindingDeserializerDelegator(writer, context.getService(), targetShape, payloadShape); return; } - // for other payload target types we should deserialize using the appropriate document deserializer + // for other payload target types we should deserialize using the appropriate + // document deserializer targetShape = payloadShape; operand += "." + context.getSymbolProvider().toMemberName(memberShape); } @@ -285,10 +282,10 @@ protected void writeMiddlewareDocumentDeserializerDelegator( writeMiddlewareDocumentBindingDeserializerDelegator(context, writer, targetShape, operand); } - // Writes middleware that delegates to deserializers for shapes that have explicit payload. + // Writes middleware that delegates to deserializers for shapes that have + // explicit payload. private void writeMiddlewarePayloadBindingDeserializerDelegator( - GoWriter writer, ServiceShape service, Shape outputShape, Shape payloadShape - ) { + GoWriter writer, ServiceShape service, Shape outputShape, Shape payloadShape) { String deserFuncName = ProtocolGenerator.getDocumentDeserializerFunctionName(outputShape, service, getProtocolName()); @@ -305,13 +302,13 @@ private void writeMiddlewarePayloadBindingDeserializerDelegator( }); } - // Write middleware that delegates to deserializers for shapes that have implicit payload and deserializer + // Write middleware that delegates to deserializers for shapes that have + // implicit payload and deserializer private void writeMiddlewareDocumentBindingDeserializerDelegator( GenerationContext context, GoWriter writer, Shape shape, - String operand - ) { + String operand) { String functionName = ProtocolGenerator.getDocumentDeserializerFunctionName( shape, context.getService(), context.getProtocolName()); @@ -331,8 +328,7 @@ private void writeMiddlewareDocumentBindingDeserializerDelegator( @Override protected void generateOperationDocumentDeserializer( GenerationContext context, - OperationShape operation - ) { + OperationShape operation) { Model model = context.getModel(); HttpBindingIndex bindingIndex = HttpBindingIndex.of(model); Set documentBindings = bindingIndex.getResponseBindings(operation, HttpBinding.Location.DOCUMENT) @@ -424,8 +420,7 @@ protected void generateDocumentBodyShapeDeserializers(GenerationContext context, private void writePayloadBindingDeserializer( GenerationContext context, Shape shape, - Predicate filterMemberShapes - ) { + Predicate filterMemberShapes) { var writer = context.getWriter().get(); var symbolProvider = context.getSymbolProvider(); var shapeSymbol = symbolProvider.toSymbol(shape); @@ -537,8 +532,7 @@ protected void writeOperationSerializerMiddlewareEventStreamSetup(GenerationCont protected void generateEventStreamSerializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { Model model = context.getModel(); AwsEventStreamUtils.generateEventStreamSerializer(context, eventUnion); @@ -586,8 +580,7 @@ protected void generateEventStreamSerializers( protected void generateEventStreamDeserializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { var model = context.getModel(); AwsEventStreamUtils.generateEventStreamDeserializer(context, eventUnion); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java index f6177a53f79..de0537405a9 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java @@ -46,10 +46,9 @@ import software.amazon.smithy.model.traits.TimestampFormatTrait; import software.amazon.smithy.model.traits.XmlAttributeTrait; import software.amazon.smithy.model.traits.XmlNamespaceTrait; -import software.amazon.smithy.go.codegen.endpoints.EndpointRulesEngineGenerator; +import software.amazon.smithy.go.codegen.endpoints.EndpointResolutionV2Generator; import software.amazon.smithy.go.codegen.endpoints.FnGenerator; - abstract class RestXmlProtocolGenerator extends HttpBindingProtocolGenerator { private final Set generatedDocumentBodyShapeSerializers = new HashSet<>(); private final Set generatedEventMessageSerializers = new HashSet<>(); @@ -96,8 +95,7 @@ protected void generateOperationDocumentSerializer(GenerationContext context, Op protected void writeMiddlewareDocumentSerializerDelegator( GenerationContext context, OperationShape operation, - GoStackStepMiddlewareGenerator generator - ) { + GoStackStepMiddlewareGenerator generator) { GoWriter writer = context.getWriter().get(); writer.addUseImports(SmithyGoDependency.SMITHY); writer.addUseImports(SmithyGoDependency.SMITHY_XML); @@ -119,8 +117,8 @@ protected void writeMiddlewareDocumentSerializerDelegator( writer.openBlock("if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); " + "err != nil {", "}", () -> { - writer.write("return out, metadata, &smithy.SerializationError{Err: err}"); - }); + writer.write("return out, metadata, &smithy.SerializationError{Err: err}"); + }); } private void initalizeXmlEncoder( @@ -128,8 +126,7 @@ private void initalizeXmlEncoder( GoWriter writer, Shape inputShape, String nodeDst, - String inputSrc - ) { + String inputSrc) { writer.addUseImports(SmithyGoDependency.SMITHY_XML); writer.addUseImports(SmithyGoDependency.BYTES); writer.write("xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil))"); @@ -141,8 +138,7 @@ private void initalizeXmlEncoder( if (xmlNamespaceTrait.isPresent()) { XmlNamespaceTrait namespace = xmlNamespaceTrait.get(); writer.write("$L.Attr = append($L.Attr, smithyxml.NewNamespaceAttribute($S, $S))", nodeDst, nodeDst, - namespace.getPrefix().isPresent() ? namespace.getPrefix().get() : "", namespace.getUri() - ); + namespace.getPrefix().isPresent() ? namespace.getPrefix().get() : "", namespace.getUri()); } } @@ -150,8 +146,7 @@ private void initalizeXmlEncoder( protected void writeMiddlewarePayloadAsDocumentSerializerDelegator( GenerationContext context, MemberShape memberShape, - String operand - ) { + String operand) { GoWriter writer = context.getWriter().get(); Model model = context.getModel(); Shape payloadShape = model.expectShape(memberShape.getTarget()); @@ -173,8 +168,8 @@ protected void writeMiddlewarePayloadAsDocumentSerializerDelegator( XmlNamespaceTrait namespace = xmlNamespaceTrait.get(); writer.write( "payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute($S, $S))", - namespace.getPrefix().isPresent() ? namespace.getPrefix().get() : "", namespace.getUri() - ); + namespace.getPrefix().isPresent() ? namespace.getPrefix().get() : "", + namespace.getUri()); } String functionName = ProtocolGenerator.getDocumentSerializerFunctionName( @@ -204,7 +199,8 @@ protected void generateDocumentBodyShapeSerializers(GenerationContext context, S } /** - * Returns the MediaType for the payload shape derived from the MediaTypeTrait, shape type, or document content type. + * Returns the MediaType for the payload shape derived from the MediaTypeTrait, + * shape type, or document content type. * * @param payloadShape shape bound to the payload. * @return string for media type. @@ -227,7 +223,7 @@ private String getPayloadShapeMediaType(Shape payloadShape) { return getDocumentContentType(); } - /* ================Deserializer=========================== */ + /* ================Deserializer=========================== */ @Override protected void deserializeError(GenerationContext context, StructureShape shape) { @@ -289,8 +285,7 @@ protected void writeErrorMessageCodeDeserializer(GenerationContext context) { protected void writeMiddlewareDocumentDeserializerDelegator( GenerationContext context, OperationShape operation, - GoStackStepMiddlewareGenerator generator - ) { + GoStackStepMiddlewareGenerator generator) { Model model = context.getModel(); GoWriter writer = context.getWriter().get(); Shape targetShape = ProtocolUtils.expectOutput(model, operation); @@ -306,13 +301,15 @@ protected void writeMiddlewareDocumentDeserializerDelegator( Shape payloadShape = model.expectShape(memberShape.getTarget()); - // if target shape is of type String or type Blob, then delegate deserializers for explicit payload shapes + // if target shape is of type String or type Blob, then delegate deserializers + // for explicit payload shapes if (payloadShape.isStringShape() || payloadShape.isBlobShape()) { writeMiddlewarePayloadBindingDeserializerDelegator(writer, context.getService(), targetShape, payloadShape); return; } - // for other payload target types we should deserialize using the appropriate document deserializer + // for other payload target types we should deserialize using the appropriate + // document deserializer targetShape = payloadShape; operand += "." + context.getSymbolProvider().toMemberName(memberShape); } @@ -322,8 +319,7 @@ protected void writeMiddlewareDocumentDeserializerDelegator( @Override protected void generateOperationDocumentDeserializer( - GenerationContext context, OperationShape operation - ) { + GenerationContext context, OperationShape operation) { Model model = context.getModel(); HttpBindingIndex bindingIndex = HttpBindingIndex.of(model); Set documentBindings = bindingIndex.getResponseBindings(operation, HttpBinding.Location.DOCUMENT) @@ -367,8 +363,7 @@ protected void generateDocumentBodyShapeDeserializers(GenerationContext context, private void writePayloadBindingDeserializer( GenerationContext context, Shape shape, - Predicate filterMemberShapes - ) { + Predicate filterMemberShapes) { GoWriter writer = context.getWriter().get(); SymbolProvider symbolProvider = context.getSymbolProvider(); Symbol shapeSymbol = symbolProvider.toSymbol(shape); @@ -433,10 +428,10 @@ private void writePayloadBindingDeserializer( } } - // Writes middleware that delegates to deserializers for shapes that have explicit payload. + // Writes middleware that delegates to deserializers for shapes that have + // explicit payload. private void writeMiddlewarePayloadBindingDeserializerDelegator( - GoWriter writer, ServiceShape service, Shape outputShape, Shape payloadShape - ) { + GoWriter writer, ServiceShape service, Shape outputShape, Shape payloadShape) { String deserFuncName = ProtocolGenerator.getDocumentDeserializerFunctionName(outputShape, service, getProtocolName()); @@ -453,13 +448,13 @@ private void writeMiddlewarePayloadBindingDeserializerDelegator( }); } - // Writes middleware that delegates to deserializers for shapes that have implicit payload. + // Writes middleware that delegates to deserializers for shapes that have + // implicit payload. private void writeMiddlewareDocumentBindingDeserializerDelegator( GenerationContext context, GoWriter writer, Shape shape, - String operand - ) { + String operand) { XmlProtocolUtils.initializeXmlDecoder(writer, "response.Body", "out, metadata,", "nil"); String functionName = ProtocolGenerator.getDocumentDeserializerFunctionName( @@ -483,8 +478,7 @@ protected void writeOperationSerializerMiddlewareEventStreamSetup(GenerationCont protected void generateEventStreamSerializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { Model model = context.getModel(); AwsEventStreamUtils.generateEventStreamSerializer(context, eventUnion); @@ -550,8 +544,7 @@ protected void generateEventStreamSerializers( protected void generateEventStreamDeserializers( GenerationContext context, UnionShape eventUnion, - Set eventStreamInfos - ) { + Set eventStreamInfos) { var model = context.getModel(); AwsEventStreamUtils.generateEventStreamDeserializer(context, eventUnion); @@ -562,29 +555,28 @@ protected void generateEventStreamDeserializers( AwsProtocolUtils.initializeJsonDecoder(ctxWriter, "br"); ctxWriter.addUseImports(AwsGoDependency.AWS_XML); ctxWriter.write(""" - errorComponents, err := $T(br, $L) - if err != nil { - return err - } - errorCode := "UnknownError" - errorMessage := errorCode - if ev := exceptionType.String(); len(ev) > 0 { - errorCode = ev - } else if ev := errorComponents.Code; len(ev) > 0 { - errorCode = ev - } - if ev := errorComponents.Message; len(ev) > 0 { - errorMessage = ev - } - return &$T{ - Code: errorCode, - Message: errorMessage, - } - """, + errorComponents, err := $T(br, $L) + if err != nil { + return err + } + errorCode := "UnknownError" + errorMessage := errorCode + if ev := exceptionType.String(); len(ev) > 0 { + errorCode = ev + } else if ev := errorComponents.Code; len(ev) > 0 { + errorCode = ev + } + if ev := errorComponents.Message; len(ev) > 0 { + errorMessage = ev + } + return &$T{ + Code: errorCode, + Message: errorMessage, + } + """, SymbolUtils.createValueSymbolBuilder("GetErrorResponseComponents", AwsGoDependency.AWS_XML).build(), isNoErrorWrapping(context), - SymbolUtils.createValueSymbolBuilder("GenericAPIError", SmithyGoDependency.SMITHY).build() - ); + SymbolUtils.createValueSymbolBuilder("GenericAPIError", SmithyGoDependency.SMITHY).build()); }); final var eventDocumentShapes = new TreeSet(); @@ -667,8 +659,8 @@ protected void generateEventStreamDeserializers( } @Override - public void generateEndpointRulesEngine(GenerationContext context) { - var generator = new EndpointRulesEngineGenerator(new AwsFnProvider()); + public void generateEndpointResolutionV2(GenerationContext context) { + var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } } From dabfe93c7fd13092793bba3a4f43cc44077ef0ab Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Wed, 3 May 2023 23:16:38 +0000 Subject: [PATCH 6/8] regen s3 client endpoints code --- service/s3/endpoints.go | 6592 +++++++++++++++++++++++++++++++ service/s3/go.mod | 39 +- service/s3control/endpoints.go | 1204 ++++++ service/s3control/go.mod | 18 +- service/s3outposts/endpoints.go | 208 + service/s3outposts/go.mod | 14 +- 6 files changed, 8023 insertions(+), 52 deletions(-) diff --git a/service/s3/endpoints.go b/service/s3/endpoints.go index 8df6368cd2f..1278604e4b0 100644 --- a/service/s3/endpoints.go +++ b/service/s3/endpoints.go @@ -8,9 +8,14 @@ import ( "fmt" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/endpoints/private/rulesfn" "github.com/aws/smithy-go/middleware" + smithytransport "github.com/aws/smithy-go/transport" smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" "net/url" "strings" ) @@ -206,3 +211,6590 @@ func finalizeClientEndpointResolverOptions(options *Options) { } } + +// EndpointParameters provides the option parameters for influence how endpoints +// are resolved. +type EndpointParameters struct { + // The S3 bucket used to send the request. This is an optional parameter that will + // be set automatically for operations that are scoped to an S3 bucket. + // + // Parameter + // is required. + Bucket *string + + // The AWS region used to dispatch the request. + // + // Parameter is + // required. + // + // AWS::Region + Region *string + + // When true, send this request to the FIPS-compliant regional endpoint. If the + // configured endpoint does not have a FIPS compliant endpoint, dispatching the + // request will return an error. + // + // Defaults to false if no value is + // provided. + // + // AWS::UseFIPS + UseFIPS *bool + + // When true, use the dual-stack endpoint. If the configured endpoint does not + // support dual-stack, dispatching the request MAY return an error. + // + // Defaults to + // false if no value is provided. + // + // AWS::UseDualStack + UseDualStack *bool + + // Override the endpoint used to send this request + // + // Parameter is + // required. + // + // SDK::Endpoint + Endpoint *string + + // When true, force a path-style endpoint to be used where the bucket name is part + // of the path. + // + // Parameter is required. + // + // AWS::S3::ForcePathStyle + ForcePathStyle *bool + + // When true, use S3 Accelerate. NOTE: Not all regions support S3 + // accelerate. + // + // Defaults to false if no value is provided. + // + // AWS::S3::Accelerate + Accelerate *bool + + // Whether the global endpoint should be used, rather then the regional endpoint + // for us-east-1. + // + // Defaults to false if no value is + // provided. + // + // AWS::S3::UseGlobalEndpoint + UseGlobalEndpoint *bool + + // Internal parameter to use object lambda endpoint for an operation (eg: + // WriteGetObjectResponse) + // + // Parameter is required. + UseObjectLambdaEndpoint *bool + + // Internal parameter to disable Access Point Buckets + // + // Parameter is required. + DisableAccessPoints *bool + + // Whether multi-region access points (MRAP) should be disabled. + // + // Defaults to false + // if no value is provided. + // + // AWS::S3::DisableMultiRegionAccessPoints + DisableMultiRegionAccessPoints *bool + + // When an Access Point ARN is provided and this flag is enabled, the SDK MUST use + // the ARN's region when constructing the endpoint instead of the client's + // configured region. + // + // Parameter is required. + // + // AWS::S3::UseArnRegion + UseArnRegion *bool +} + +// ValidateRequired validates required parameters are set. +func (p EndpointParameters) ValidateRequired() error { + if p.Accelerate == nil { + return fmt.Errorf("parameter Accelerate is required") + } + + if p.DisableMultiRegionAccessPoints == nil { + return fmt.Errorf("parameter DisableMultiRegionAccessPoints is required") + } + + if p.UseDualStack == nil { + return fmt.Errorf("parameter UseDualStack is required") + } + + if p.UseFIPS == nil { + return fmt.Errorf("parameter UseFIPS is required") + } + + if p.UseGlobalEndpoint == nil { + return fmt.Errorf("parameter UseGlobalEndpoint is required") + } + + return nil +} + +// EndpointResolverV2 provides the interface for resolving service endpoints. +type EndpointResolverV2 interface { + // ResolveEndpoint attempts to resolve the endpoint with the provided options, + // returning the endpoint if found. Otherwise an error is returned. + ResolveEndpoint(ctx context.Context, options EndpointParameters) ( + smithytransport.Endpoint, error, + ) +} + +// resolverV2 provides the implementation for resolving endpoints. +type resolverV2 struct{} + +func NewDefaultEndpointResolverV2() *resolverV2 { + return &resolverV2{} +} + +// ResolveEndpoint attempts to resolve the endpoint with the provided options, +// returning the endpoint if found. Otherwise an error is returned. +func (r *resolverV2) ResolveEndpoint( + ctx context.Context, params EndpointParameters, +) ( + endpoint smithytransport.Endpoint, err error, +) { + if err = params.ValidateRequired(); err != nil { + return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) + } + _UseFIPS := *params.UseFIPS + _UseDualStack := *params.UseDualStack + _Accelerate := *params.Accelerate + _UseGlobalEndpoint := *params.UseGlobalEndpoint + _DisableMultiRegionAccessPoints := *params.DisableMultiRegionAccessPoints + + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := params.Bucket; exprVal != nil { + _Bucket := *exprVal + _ = _Bucket + if exprVal := rulesfn.SubString(_Bucket, 49, 50, true); exprVal != nil { + _hardwareType := *exprVal + _ = _hardwareType + if exprVal := rulesfn.SubString(_Bucket, 8, 12, true); exprVal != nil { + _regionPrefix := *exprVal + _ = _regionPrefix + if exprVal := rulesfn.SubString(_Bucket, 0, 7, true); exprVal != nil { + _abbaSuffix := *exprVal + _ = _abbaSuffix + if exprVal := rulesfn.SubString(_Bucket, 32, 49, true); exprVal != nil { + _outpostId := *exprVal + _ = _outpostId + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _regionPartition := *exprVal + _ = _regionPartition + if _abbaSuffix == "--op-s3" { + if rulesfn.IsValidHostLabel(_outpostId, false) { + if _hardwareType == "e" { + if _regionPrefix == "beta" { + if !(params.Endpoint != nil) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Expected a endpoint to be specified but no endpoint was found") + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".ec2.") + out.WriteString(_url.Authority) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".ec2.s3-outposts.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_regionPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + if _hardwareType == "o" { + if _regionPrefix == "beta" { + if !(params.Endpoint != nil) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Expected a endpoint to be specified but no endpoint was found") + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".op-") + out.WriteString(_outpostId) + out.WriteString(".") + out.WriteString(_url.Authority) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".op-") + out.WriteString(_outpostId) + out.WriteString(".s3-outposts.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_regionPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Unrecognized hardware type: \"Expected hardware type o or e but got ") + out.WriteString(_hardwareType) + out.WriteString("\"") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.") + } + } + } + } + } + } + } + if exprVal := params.Bucket; exprVal != nil { + _Bucket := *exprVal + _ = _Bucket + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if !(rulesfn.ParseURL(_Endpoint) != nil) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Custom endpoint `") + out.WriteString(_Endpoint) + out.WriteString("` was not a valid URI") + return out.String() + }()) + } + } + if exprVal := params.ForcePathStyle; exprVal != nil { + _ForcePathStyle := *exprVal + _ = _ForcePathStyle + if _ForcePathStyle == true { + if exprVal := awsrulesfn.ParseARN(_Bucket); exprVal != nil { + _var_18 := *exprVal + _ = _var_18 + return endpoint, fmt.Errorf("endpoint rule error, %s", "Path-style addressing cannot be used with ARN buckets") + } + _uri_encoded_bucket := rulesfn.URIEncode(_Bucket) + _ = _uri_encoded_bucket + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + return endpoint, fmt.Errorf("endpoint rule error, %s", "Cannot set dual-stack in combination with a custom endpoint.") + } + } + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _Accelerate == false { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Path-style addressing cannot be used with S3 Accelerate") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + } + if awsrulesfn.IsVirtualHostableS3Bucket(_Bucket, false) { + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if rulesfn.IsValidHostLabel(_Region, false) { + if _UseFIPS == true { + if _partitionResult.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if _Accelerate == true { + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Accelerate cannot be used with FIPS") + } + } + if _Accelerate == true { + if _partitionResult.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Accelerate cannot be used in this region") + } + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate") + } + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate") + } + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _Accelerate == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate") + } + } + if _UseDualStack == true { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == true { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.dualstack.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.dualstack.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == true { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_Bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_Bucket) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_Bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_Bucket) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_Bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_Bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_Bucket) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_Bucket) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_Bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.IsIp == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_Bucket) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3-accelerate.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if _UseFIPS == false { + if _Accelerate == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_Bucket) + out.WriteString(".s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid region: region was not a valid DNS name.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _url.Scheme == "http" { + if awsrulesfn.IsVirtualHostableS3Bucket(_Bucket, true) { + if _UseFIPS == false { + if _UseDualStack == false { + if _Accelerate == false { + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if rulesfn.IsValidHostLabel(_Region, false) { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_Bucket) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid region: region was not a valid DNS name.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + } + } + } + } + } + } + if exprVal := awsrulesfn.ParseARN(_Bucket); exprVal != nil { + _bucketArn := *exprVal + _ = _bucketArn + if exprVal := _bucketArn.ResourceId.Get(0); exprVal != nil { + _arnType := *exprVal + _ = _arnType + if !(_arnType == "") { + if _bucketArn.Service == "s3-object-lambda" { + if _arnType == "accesspoint" { + if exprVal := _bucketArn.ResourceId.Get(1); exprVal != nil { + _accessPointName := *exprVal + _ = _accessPointName + if !(_accessPointName == "") { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Object Lambda does not support Dual-stack") + } + if _Accelerate == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Object Lambda does not support S3 Accelerate") + } + if !(_bucketArn.Region == "") { + if exprVal := params.DisableAccessPoints; exprVal != nil { + _DisableAccessPoints := *exprVal + _ = _DisableAccessPoints + if _DisableAccessPoints == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Access points are not supported for this operation") + } + } + if !(_bucketArn.ResourceId.Get(2) != nil) { + if exprVal := params.UseArnRegion; exprVal != nil { + _UseArnRegion := *exprVal + _ = _UseArnRegion + if _UseArnRegion == false { + if !(_bucketArn.Region == _Region) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid configuration: region from ARN `") + out.WriteString(_bucketArn.Region) + out.WriteString("` does not match client region `") + out.WriteString(_Region) + out.WriteString("` and UseArnRegion is `false`") + return out.String() + }()) + } + } + } + if exprVal := awsrulesfn.GetPartition(_bucketArn.Region); exprVal != nil { + _bucketPartition := *exprVal + _ = _bucketPartition + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _bucketPartition.Name == _partitionResult.Name { + if rulesfn.IsValidHostLabel(_bucketArn.Region, true) { + if _bucketArn.AccountId == "" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Missing account id") + } + if rulesfn.IsValidHostLabel(_bucketArn.AccountId, false) { + if rulesfn.IsValidHostLabel(_accessPointName, false) { + if _UseFIPS == true { + if _bucketPartition.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-object-lambda", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".s3-object-lambda-fips.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-object-lambda", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".s3-object-lambda.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-object-lambda", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_accessPointName) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_bucketArn.AccountId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid region in ARN: `") + out.WriteString(_bucketArn.Region) + out.WriteString("` (invalid DNS name)") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Client was configured for partition `") + out.WriteString(_partitionResult.Name) + out.WriteString("` but ARN (`") + out.WriteString(_Bucket) + out.WriteString("`) has `") + out.WriteString(_bucketPartition.Name) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Could not load partition for ARN region `") + out.WriteString(_bucketArn.Region) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: bucket ARN is missing a region") + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Expected a resource of the format `accesspoint:` but no name was provided") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `") + out.WriteString(_arnType) + out.WriteString("`") + return out.String() + }()) + } + if _arnType == "accesspoint" { + if exprVal := _bucketArn.ResourceId.Get(1); exprVal != nil { + _accessPointName := *exprVal + _ = _accessPointName + if !(_accessPointName == "") { + if !(_bucketArn.Region == "") { + if _arnType == "accesspoint" { + if !(_bucketArn.Region == "") { + if exprVal := params.DisableAccessPoints; exprVal != nil { + _DisableAccessPoints := *exprVal + _ = _DisableAccessPoints + if _DisableAccessPoints == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Access points are not supported for this operation") + } + } + if !(_bucketArn.ResourceId.Get(2) != nil) { + if exprVal := params.UseArnRegion; exprVal != nil { + _UseArnRegion := *exprVal + _ = _UseArnRegion + if _UseArnRegion == false { + if !(_bucketArn.Region == _Region) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid configuration: region from ARN `") + out.WriteString(_bucketArn.Region) + out.WriteString("` does not match client region `") + out.WriteString(_Region) + out.WriteString("` and UseArnRegion is `false`") + return out.String() + }()) + } + } + } + if exprVal := awsrulesfn.GetPartition(_bucketArn.Region); exprVal != nil { + _bucketPartition := *exprVal + _ = _bucketPartition + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _bucketPartition.Name == _partitionResult.Name { + if rulesfn.IsValidHostLabel(_bucketArn.Region, true) { + if _bucketArn.Service == "s3" { + if rulesfn.IsValidHostLabel(_bucketArn.AccountId, false) { + if rulesfn.IsValidHostLabel(_accessPointName, false) { + if _Accelerate == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Access Points do not support S3 Accelerate") + } + if _UseFIPS == true { + if _bucketPartition.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack cannot be combined with a Host override (PrivateLink)") + } + } + if _UseFIPS == true { + if _UseDualStack == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".s3-accesspoint-fips.dualstack.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == true { + if _UseDualStack == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".s3-accesspoint-fips.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == false { + if _UseDualStack == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".s3-accesspoint.dualstack.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".s3-accesspoint.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_accessPointName) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_bucketArn.AccountId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The ARN was not for the S3 service, found: ") + out.WriteString(_bucketArn.Service) + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid region in ARN: `") + out.WriteString(_bucketArn.Region) + out.WriteString("` (invalid DNS name)") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Client was configured for partition `") + out.WriteString(_partitionResult.Name) + out.WriteString("` but ARN (`") + out.WriteString(_Bucket) + out.WriteString("`) has `") + out.WriteString(_bucketPartition.Name) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Could not load partition for ARN region `") + out.WriteString(_bucketArn.Region) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: bucket ARN is missing a region") + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + if rulesfn.IsValidHostLabel(_accessPointName, true) { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 MRAP does not support dual-stack") + } + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 MRAP does not support FIPS") + } + if _Accelerate == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 MRAP does not support S3 Accelerate") + } + if _DisableMultiRegionAccessPoints == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid configuration: Multi-Region Access Point ARNs are disabled.") + } + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _mrapPartition := *exprVal + _ = _mrapPartition + if _mrapPartition.Name == _bucketArn.Partition { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString(".accesspoint.s3-global.") + out.WriteString(_mrapPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4a", + "signingName": "s3", + "signingRegionSet": []interface{}{ + "*", + }, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Client was configured for partition `") + out.WriteString(_mrapPartition.Name) + out.WriteString("` but bucket referred to partition `") + out.WriteString(_bucketArn.Partition) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString(_Region) + out.WriteString(" was not a valid region") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Access Point Name") + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Expected a resource of the format `accesspoint:` but no name was provided") + } + if _bucketArn.Service == "s3-outposts" { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Outposts does not support Dual-stack") + } + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Outposts does not support FIPS") + } + if _Accelerate == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Outposts does not support S3 Accelerate") + } + if exprVal := _bucketArn.ResourceId.Get(4); exprVal != nil { + _var_405 := *exprVal + _ = _var_405 + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Arn: Outpost Access Point ARN contains sub resources") + } + if exprVal := _bucketArn.ResourceId.Get(1); exprVal != nil { + _outpostId := *exprVal + _ = _outpostId + if rulesfn.IsValidHostLabel(_outpostId, false) { + if exprVal := params.UseArnRegion; exprVal != nil { + _UseArnRegion := *exprVal + _ = _UseArnRegion + if _UseArnRegion == false { + if !(_bucketArn.Region == _Region) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid configuration: region from ARN `") + out.WriteString(_bucketArn.Region) + out.WriteString("` does not match client region `") + out.WriteString(_Region) + out.WriteString("` and UseArnRegion is `false`") + return out.String() + }()) + } + } + } + if exprVal := awsrulesfn.GetPartition(_bucketArn.Region); exprVal != nil { + _bucketPartition := *exprVal + _ = _bucketPartition + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _bucketPartition.Name == _partitionResult.Name { + if rulesfn.IsValidHostLabel(_bucketArn.Region, true) { + if rulesfn.IsValidHostLabel(_bucketArn.AccountId, false) { + if exprVal := _bucketArn.ResourceId.Get(2); exprVal != nil { + _outpostType := *exprVal + _ = _outpostType + if exprVal := _bucketArn.ResourceId.Get(3); exprVal != nil { + _accessPointName := *exprVal + _ = _accessPointName + if _outpostType == "accesspoint" { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".") + out.WriteString(_outpostId) + out.WriteString(".") + out.WriteString(_url.Authority) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_accessPointName) + out.WriteString("-") + out.WriteString(_bucketArn.AccountId) + out.WriteString(".") + out.WriteString(_outpostId) + out.WriteString(".s3-outposts.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_bucketPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Expected an outpost type `accesspoint`, found ") + out.WriteString(_outpostType) + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: expected an access point name") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Expected a 4-component resource") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_bucketArn.AccountId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid region in ARN: `") + out.WriteString(_bucketArn.Region) + out.WriteString("` (invalid DNS name)") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Client was configured for partition `") + out.WriteString(_partitionResult.Name) + out.WriteString("` but ARN (`") + out.WriteString(_Bucket) + out.WriteString("`) has `") + out.WriteString(_bucketPartition.Name) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Could not load partition for ARN region ") + out.WriteString(_bucketArn.Region) + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_outpostId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: The Outpost Id was not set") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: Unrecognized format: ") + out.WriteString(_Bucket) + out.WriteString(" (type: ") + out.WriteString(_arnType) + out.WriteString(")") + return out.String() + }()) + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: No ARN type specified") + } + if exprVal := rulesfn.SubString(_Bucket, 0, 4, false); exprVal != nil { + _arnPrefix := *exprVal + _ = _arnPrefix + if _arnPrefix == "arn:" { + if !(awsrulesfn.ParseARN(_Bucket) != nil) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: `") + out.WriteString(_Bucket) + out.WriteString("` was not a valid ARN") + return out.String() + }()) + } + } + } + _uri_encoded_bucket := rulesfn.URIEncode(_Bucket) + _ = _uri_encoded_bucket + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + return endpoint, fmt.Errorf("endpoint rule error, %s", "Cannot set dual-stack in combination with a custom endpoint.") + } + } + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _Accelerate == false { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == true { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.NormalizedPath) + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _UseFIPS == false { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + out.WriteString("/") + out.WriteString(_uri_encoded_bucket) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Path-style addressing cannot be used with S3 Accelerate") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + if exprVal := params.UseObjectLambdaEndpoint; exprVal != nil { + _UseObjectLambdaEndpoint := *exprVal + _ = _UseObjectLambdaEndpoint + if _UseObjectLambdaEndpoint == true { + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if rulesfn.IsValidHostLabel(_Region, true) { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Object Lambda does not support Dual-stack") + } + if _Accelerate == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "S3 Object Lambda does not support S3 Accelerate") + } + if _UseFIPS == true { + if _partitionResult.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-object-lambda", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-object-lambda-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-object-lambda", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-object-lambda.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-object-lambda", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid region: region was not a valid DNS name.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + } + if !(params.Bucket != nil) { + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if rulesfn.IsValidHostLabel(_Region, true) { + if _UseFIPS == true { + if _partitionResult.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.us-east-1.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if _Region == "aws-global" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": "us-east-1", + }, + }) + return out + }(), + }, nil + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == true { + if _Region == "us-east-1" { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if !(params.Endpoint != nil) { + if !(_Region == "aws-global") { + if _UseGlobalEndpoint == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid region: region was not a valid DNS name.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A region must be set when sending requests to S3.") +} diff --git a/service/s3/go.mod b/service/s3/go.mod index 7bc86910915..a868e2b42d0 100644 --- a/service/s3/go.mod +++ b/service/s3/go.mod @@ -3,33 +3,14 @@ module github.com/aws/aws-sdk-go-v2/service/s3 go 1.15 require ( - github.com/aws/aws-sdk-go-v2 v1.17.7 - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 - github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.23 - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.26 - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.0 - github.com/aws/smithy-go v1.13.5 - github.com/google/go-cmp v0.5.8 + github.com/aws/smithy-go v1.4.0 + github.com/aws/aws-sdk-go-v2 v1.4.0 + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v0.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/internal/v4a v0.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/service/internal/checksum v0.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.0.5 + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.7 + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.2.3 ) - -replace github.com/aws/aws-sdk-go-v2 => ../../ - -replace github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream => ../../aws/protocol/eventstream/ - -replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ - -replace github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 => ../../internal/endpoints/v2/ - -replace github.com/aws/aws-sdk-go-v2/internal/v4a => ../../internal/v4a/ - -replace github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => ../../service/internal/accept-encoding/ - -replace github.com/aws/aws-sdk-go-v2/service/internal/checksum => ../../service/internal/checksum/ - -replace github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => ../../service/internal/presigned-url/ - -replace github.com/aws/aws-sdk-go-v2/service/internal/s3shared => ../../service/internal/s3shared/ diff --git a/service/s3control/endpoints.go b/service/s3control/endpoints.go index 6dd40effad0..208a9fd696f 100644 --- a/service/s3control/endpoints.go +++ b/service/s3control/endpoints.go @@ -8,9 +8,14 @@ import ( "fmt" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3control/internal/endpoints" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/endpoints/private/rulesfn" "github.com/aws/smithy-go/middleware" + smithytransport "github.com/aws/smithy-go/transport" smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" "net/url" "strings" ) @@ -206,3 +211,1202 @@ func finalizeClientEndpointResolverOptions(options *Options) { } } + +// EndpointParameters provides the option parameters for influence how endpoints +// are resolved. +type EndpointParameters struct { + // The AWS region used to dispatch the request. + // + // Parameter is + // required. + // + // AWS::Region + Region *string + + // When true, send this request to the FIPS-compliant regional endpoint. If the + // configured endpoint does not have a FIPS compliant endpoint, dispatching the + // request will return an error. + // + // Defaults to false if no value is + // provided. + // + // AWS::UseFIPS + UseFIPS *bool + + // When true, use the dual-stack endpoint. If the configured endpoint does not + // support dual-stack, dispatching the request MAY return an error. + // + // Defaults to + // false if no value is provided. + // + // AWS::UseDualStack + UseDualStack *bool + + // Override the endpoint used to send this request + // + // Parameter is + // required. + // + // SDK::Endpoint + Endpoint *string + + // The Account ID used to send the request. This is an optional parameter that will + // be set automatically for operations that require it. + // + // Parameter is required. + AccountId *string + + // Internal parameter for operations that require account id host + // prefix. + // + // Parameter is required. + RequiresAccountId *bool + + // The Outpost ID. Some operations have an optional OutpostId which should be used + // in endpoint construction. + // + // Parameter is required. + OutpostId *string + + // The S3 bucket used to send the request. This is an optional parameter that will + // be set automatically for operations that are scoped to an S3 bucket. + // + // Parameter + // is required. + Bucket *string + + // The S3 AccessPointName used to send the request. This is an optional parameter + // that will be set automatically for operations that are scoped to an S3 + // AccessPoint. + // + // Parameter is required. + AccessPointName *string + + // When an Access Point ARN is provided and this flag is enabled, the SDK MUST use + // the ARN's region when constructing the endpoint instead of the client's + // configured region. + // + // Parameter is required. + // + // AWS::S3Control::UseArnRegion + UseArnRegion *bool +} + +// ValidateRequired validates required parameters are set. +func (p EndpointParameters) ValidateRequired() error { + if p.UseDualStack == nil { + return fmt.Errorf("parameter UseDualStack is required") + } + + if p.UseFIPS == nil { + return fmt.Errorf("parameter UseFIPS is required") + } + + return nil +} + +// EndpointResolverV2 provides the interface for resolving service endpoints. +type EndpointResolverV2 interface { + // ResolveEndpoint attempts to resolve the endpoint with the provided options, + // returning the endpoint if found. Otherwise an error is returned. + ResolveEndpoint(ctx context.Context, options EndpointParameters) ( + smithytransport.Endpoint, error, + ) +} + +// resolverV2 provides the implementation for resolving endpoints. +type resolverV2 struct{} + +func NewDefaultEndpointResolverV2() *resolverV2 { + return &resolverV2{} +} + +// ResolveEndpoint attempts to resolve the endpoint with the provided options, +// returning the endpoint if found. Otherwise an error is returned. +func (r *resolverV2) ResolveEndpoint( + ctx context.Context, params EndpointParameters, +) ( + endpoint smithytransport.Endpoint, err error, +) { + if err = params.ValidateRequired(); err != nil { + return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) + } + _UseFIPS := *params.UseFIPS + _UseDualStack := *params.UseDualStack + + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := params.OutpostId; exprVal != nil { + _OutpostId := *exprVal + _ = _OutpostId + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _UseFIPS == true { + if _partitionResult.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if !(params.AccountId != nil) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountId is required but not set") + } + } + } + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + if !(rulesfn.IsValidHostLabel(_AccountId, false)) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountId must only contain a-z, A-Z, 0-9 and `-`.") + } + } + if !(rulesfn.IsValidHostLabel(_OutpostId, false)) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "OutpostId must only contain a-z, A-Z, 0-9 and `-`.") + } + if rulesfn.IsValidHostLabel(_Region, true) { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid configuration: Outposts do not support dual-stack") + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid region: region was not a valid DNS name.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + if exprVal := params.AccessPointName; exprVal != nil { + _AccessPointName := *exprVal + _ = _AccessPointName + if exprVal := awsrulesfn.ParseARN(_AccessPointName); exprVal != nil { + _accessPointArn := *exprVal + _ = _accessPointArn + if exprVal := _accessPointArn.ResourceId.Get(0); exprVal != nil { + _arnType := *exprVal + _ = _arnType + if !(_arnType == "") { + if _accessPointArn.Service == "s3-outposts" { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid configuration: Outpost Access Points do not support dual-stack") + } + if exprVal := _accessPointArn.ResourceId.Get(1); exprVal != nil { + _outpostId := *exprVal + _ = _outpostId + if rulesfn.IsValidHostLabel(_outpostId, false) { + if exprVal := params.UseArnRegion; exprVal != nil { + _UseArnRegion := *exprVal + _ = _UseArnRegion + if _UseArnRegion == false { + if !(_accessPointArn.Region == _Region) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid configuration: region from ARN `") + out.WriteString(_accessPointArn.Region) + out.WriteString("` does not match client region `") + out.WriteString(_Region) + out.WriteString("` and UseArnRegion is `false`") + return out.String() + }()) + } + } + } + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if exprVal := awsrulesfn.GetPartition(_accessPointArn.Region); exprVal != nil { + _arnPartition := *exprVal + _ = _arnPartition + if _arnPartition.Name == _partitionResult.Name { + if rulesfn.IsValidHostLabel(_accessPointArn.Region, true) { + if !(_accessPointArn.AccountId == "") { + if rulesfn.IsValidHostLabel(_accessPointArn.AccountId, false) { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + if !(_AccountId == _accessPointArn.AccountId) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: the accountId specified in the ARN (`") + out.WriteString(_accessPointArn.AccountId) + out.WriteString("`) does not match the parameter (`") + out.WriteString(_AccountId) + out.WriteString("`)") + return out.String() + }()) + } + } + if exprVal := _accessPointArn.ResourceId.Get(2); exprVal != nil { + _outpostType := *exprVal + _ = _outpostType + if exprVal := _accessPointArn.ResourceId.Get(3); exprVal != nil { + _accessPointName := *exprVal + _ = _accessPointName + if _outpostType == "accesspoint" { + if _UseFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts-fips.") + out.WriteString(_accessPointArn.Region) + out.WriteString(".") + out.WriteString(_arnPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: func() *http.Header { + headers := http.Header{} + headers.Set("x-amz-account-id", _accessPointArn.AccountId) + headers.Set("x-amz-outpost-id", _outpostId) + return &headers + }(), + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _accessPointArn.Region, + }, + }) + return out + }(), + }, nil + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: func() *http.Header { + headers := http.Header{} + headers.Set("x-amz-account-id", _accessPointArn.AccountId) + headers.Set("x-amz-outpost-id", _outpostId) + return &headers + }(), + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _accessPointArn.Region, + }, + }) + return out + }(), + }, nil + } + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts.") + out.WriteString(_accessPointArn.Region) + out.WriteString(".") + out.WriteString(_arnPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: func() *http.Header { + headers := http.Header{} + headers.Set("x-amz-account-id", _accessPointArn.AccountId) + headers.Set("x-amz-outpost-id", _outpostId) + return &headers + }(), + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _accessPointArn.Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Expected an outpost type `accesspoint`, found `") + out.WriteString(_outpostType) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: expected an access point name") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Expected a 4-component resource") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_accessPointArn.AccountId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: missing account ID") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid region in ARN: `") + out.WriteString(_accessPointArn.Region) + out.WriteString("` (invalid DNS name)") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Client was configured for partition `") + out.WriteString(_partitionResult.Name) + out.WriteString("` but ARN has `") + out.WriteString(_arnPartition.Name) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Could not load partition for ARN region `") + out.WriteString(_accessPointArn.Region) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`., found: `") + out.WriteString(_outpostId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: The Outpost Id was not set") + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: No ARN type specified") + } + } + if exprVal := params.Bucket; exprVal != nil { + _Bucket := *exprVal + _ = _Bucket + if exprVal := awsrulesfn.ParseARN(_Bucket); exprVal != nil { + _bucketArn := *exprVal + _ = _bucketArn + if exprVal := _bucketArn.ResourceId.Get(0); exprVal != nil { + _arnType := *exprVal + _ = _arnType + if !(_arnType == "") { + if _bucketArn.Service == "s3-outposts" { + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid configuration: Outpost buckets do not support dual-stack") + } + if exprVal := _bucketArn.ResourceId.Get(1); exprVal != nil { + _outpostId := *exprVal + _ = _outpostId + if rulesfn.IsValidHostLabel(_outpostId, false) { + if exprVal := params.UseArnRegion; exprVal != nil { + _UseArnRegion := *exprVal + _ = _UseArnRegion + if _UseArnRegion == false { + if !(_bucketArn.Region == _Region) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid configuration: region from ARN `") + out.WriteString(_bucketArn.Region) + out.WriteString("` does not match client region `") + out.WriteString(_Region) + out.WriteString("` and UseArnRegion is `false`") + return out.String() + }()) + } + } + } + if exprVal := awsrulesfn.GetPartition(_bucketArn.Region); exprVal != nil { + _arnPartition := *exprVal + _ = _arnPartition + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if _arnPartition.Name == _partitionResult.Name { + if rulesfn.IsValidHostLabel(_bucketArn.Region, true) { + if !(_bucketArn.AccountId == "") { + if rulesfn.IsValidHostLabel(_bucketArn.AccountId, false) { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + if !(_AccountId == _bucketArn.AccountId) { + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: the accountId specified in the ARN (`") + out.WriteString(_bucketArn.AccountId) + out.WriteString("`) does not match the parameter (`") + out.WriteString(_AccountId) + out.WriteString("`)") + return out.String() + }()) + } + } + if exprVal := _bucketArn.ResourceId.Get(2); exprVal != nil { + _outpostType := *exprVal + _ = _outpostType + if exprVal := _bucketArn.ResourceId.Get(3); exprVal != nil { + _bucketName := *exprVal + _ = _bucketName + if _outpostType == "bucket" { + if _UseFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts-fips.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_arnPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: func() *http.Header { + headers := http.Header{} + headers.Set("x-amz-account-id", _bucketArn.AccountId) + headers.Set("x-amz-outpost-id", _outpostId) + return &headers + }(), + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: func() *http.Header { + headers := http.Header{} + headers.Set("x-amz-account-id", _bucketArn.AccountId) + headers.Set("x-amz-outpost-id", _outpostId) + return &headers + }(), + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts.") + out.WriteString(_bucketArn.Region) + out.WriteString(".") + out.WriteString(_arnPartition.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: func() *http.Header { + headers := http.Header{} + headers.Set("x-amz-account-id", _bucketArn.AccountId) + headers.Set("x-amz-outpost-id", _outpostId) + return &headers + }(), + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3-outposts", + "signingRegion": _bucketArn.Region, + }, + }) + return out + }(), + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: Expected an outpost type `bucket`, found `") + out.WriteString(_outpostType) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: expected a bucket name") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Expected a 4-component resource") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `") + out.WriteString(_bucketArn.AccountId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: missing account ID") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid region in ARN: `") + out.WriteString(_bucketArn.Region) + out.WriteString("` (invalid DNS name)") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Client was configured for partition `") + out.WriteString(_partitionResult.Name) + out.WriteString("` but ARN has `") + out.WriteString(_arnPartition.Name) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Could not load partition for ARN region `") + out.WriteString(_bucketArn.Region) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`., found: `") + out.WriteString(_outpostId) + out.WriteString("`") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: The Outpost Id was not set") + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: No ARN type specified") + } + } + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _partitionResult := *exprVal + _ = _partitionResult + if rulesfn.IsValidHostLabel(_Region, true) { + if _UseFIPS == true { + if _partitionResult.Name == "aws-cn" { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Partition does not support FIPS") + } + } + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if !(params.AccountId != nil) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountId is required but not set") + } + } + } + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + if !(rulesfn.IsValidHostLabel(_AccountId, false)) { + return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountId must only contain a-z, A-Z, 0-9 and `-`.") + } + } + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if exprVal := rulesfn.ParseURL(_Endpoint); exprVal != nil { + _url := *exprVal + _ = _url + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported") + } + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_AccountId) + out.WriteString(".") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + uriString := func() string { + var out strings.Builder + out.WriteString(_url.Scheme) + out.WriteString("://") + out.WriteString(_url.Authority) + out.WriteString(_url.Path) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == true { + if _UseDualStack == true { + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_AccountId) + out.WriteString(".s3-control-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-control-fips.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == true { + if _UseDualStack == false { + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_AccountId) + out.WriteString(".s3-control-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == true { + if _UseDualStack == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-control-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == false { + if _UseDualStack == true { + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_AccountId) + out.WriteString(".s3-control.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-control.dualstack.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + if _UseFIPS == false { + if _UseDualStack == false { + if exprVal := params.RequiresAccountId; exprVal != nil { + _RequiresAccountId := *exprVal + _ = _RequiresAccountId + if _RequiresAccountId == true { + if exprVal := params.AccountId; exprVal != nil { + _AccountId := *exprVal + _ = _AccountId + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_AccountId) + out.WriteString(".s3-control.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + } + } + } + if _UseFIPS == false { + if _UseDualStack == false { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-control.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_partitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + Properties: func() smithy.Properties { + var out smithy.Properties + out.Set("authSchemes", []interface{}{ + map[string]interface{}{ + "disableDoubleEncoding": true, + "name": "sigv4", + "signingName": "s3", + "signingRegion": _Region, + }, + }) + return out + }(), + }, nil + } + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid region: region was not a valid DNS name.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "A valid partition could not be determined") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Region must be set") +} diff --git a/service/s3control/go.mod b/service/s3control/go.mod index 0e93fdf7f95..8a8240d6f44 100644 --- a/service/s3control/go.mod +++ b/service/s3control/go.mod @@ -3,17 +3,9 @@ module github.com/aws/aws-sdk-go-v2/service/s3control go 1.15 require ( - github.com/aws/aws-sdk-go-v2 v1.17.7 - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.0 - github.com/aws/smithy-go v1.13.5 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.2.3 + github.com/aws/smithy-go v1.4.0 + github.com/aws/aws-sdk-go-v2 v1.4.0 ) - -replace github.com/aws/aws-sdk-go-v2 => ../../ - -replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ - -replace github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 => ../../internal/endpoints/v2/ - -replace github.com/aws/aws-sdk-go-v2/service/internal/s3shared => ../../service/internal/s3shared/ diff --git a/service/s3outposts/endpoints.go b/service/s3outposts/endpoints.go index 9d7f2d72a8a..ce32bda46fa 100644 --- a/service/s3outposts/endpoints.go +++ b/service/s3outposts/endpoints.go @@ -8,9 +8,12 @@ import ( "fmt" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3outposts/internal/endpoints" "github.com/aws/smithy-go/middleware" + smithytransport "github.com/aws/smithy-go/transport" smithyhttp "github.com/aws/smithy-go/transport/http" + "net/http" "net/url" "strings" ) @@ -198,3 +201,208 @@ func finalizeClientEndpointResolverOptions(options *Options) { } } + +// EndpointParameters provides the option parameters for influence how endpoints +// are resolved. +type EndpointParameters struct { + // The AWS region used to dispatch the request. + // + // Parameter is + // required. + // + // AWS::Region + Region *string + + // When true, use the dual-stack endpoint. If the configured endpoint does not + // support dual-stack, dispatching the request MAY return an error. + // + // Defaults to + // false if no value is provided. + // + // AWS::UseDualStack + UseDualStack *bool + + // When true, send this request to the FIPS-compliant regional endpoint. If the + // configured endpoint does not have a FIPS compliant endpoint, dispatching the + // request will return an error. + // + // Defaults to false if no value is + // provided. + // + // AWS::UseFIPS + UseFIPS *bool + + // Override the endpoint used to send this request + // + // Parameter is + // required. + // + // SDK::Endpoint + Endpoint *string +} + +// ValidateRequired validates required parameters are set. +func (p EndpointParameters) ValidateRequired() error { + if p.UseDualStack == nil { + return fmt.Errorf("parameter UseDualStack is required") + } + + if p.UseFIPS == nil { + return fmt.Errorf("parameter UseFIPS is required") + } + + return nil +} + +// EndpointResolverV2 provides the interface for resolving service endpoints. +type EndpointResolverV2 interface { + // ResolveEndpoint attempts to resolve the endpoint with the provided options, + // returning the endpoint if found. Otherwise an error is returned. + ResolveEndpoint(ctx context.Context, options EndpointParameters) ( + smithytransport.Endpoint, error, + ) +} + +// resolverV2 provides the implementation for resolving endpoints. +type resolverV2 struct{} + +func NewDefaultEndpointResolverV2() *resolverV2 { + return &resolverV2{} +} + +// ResolveEndpoint attempts to resolve the endpoint with the provided options, +// returning the endpoint if found. Otherwise an error is returned. +func (r *resolverV2) ResolveEndpoint( + ctx context.Context, params EndpointParameters, +) ( + endpoint smithytransport.Endpoint, err error, +) { + if err = params.ValidateRequired(); err != nil { + return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) + } + _UseDualStack := *params.UseDualStack + _UseFIPS := *params.UseFIPS + + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported") + } + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported") + } + uriString := _Endpoint + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + }, nil + } + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _PartitionResult := *exprVal + _ = _PartitionResult + if _UseFIPS == true { + if _UseDualStack == true { + if true == _PartitionResult.SupportsFIPS { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + }, nil + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both") + } + } + if _UseFIPS == true { + if true == _PartitionResult.SupportsFIPS { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") + } + if _UseDualStack == true { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://s3-outposts.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithytransport.Endpoint{ + URI: *uri, + Headers: &http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region") +} diff --git a/service/s3outposts/go.mod b/service/s3outposts/go.mod index 1de0815d8cf..ee26a48ce76 100644 --- a/service/s3outposts/go.mod +++ b/service/s3outposts/go.mod @@ -3,14 +3,8 @@ module github.com/aws/aws-sdk-go-v2/service/s3outposts go 1.15 require ( - github.com/aws/aws-sdk-go-v2 v1.17.7 - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 - github.com/aws/smithy-go v1.13.5 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 + github.com/aws/smithy-go v1.4.0 + github.com/aws/aws-sdk-go-v2 v1.4.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 ) - -replace github.com/aws/aws-sdk-go-v2 => ../../ - -replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ - -replace github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 => ../../internal/endpoints/v2/ From 8502f06594150fecbc703dc5cd7aaa4196d6348a Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Fri, 5 May 2023 21:32:09 +0000 Subject: [PATCH 7/8] change method name --- .../java/software/amazon/smithy/aws/go/codegen/AwsQuery.java | 2 +- .../amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java | 2 +- .../amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java | 2 +- .../amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java index 8a1632fc766..9288f9092b4 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsQuery.java @@ -212,7 +212,7 @@ public void generateEventStreamComponents(GenerationContext context) { } @Override - public void generateEndpointResolutionV2(GenerationContext context) { + public void generateEndpointResolution(GenerationContext context) { var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java index b50ed810ecc..c91738e90b6 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java @@ -362,7 +362,7 @@ protected void generateEventStreamDeserializers( } @Override - public void generateEndpointResolutionV2(GenerationContext context) { + public void generateEndpointResolution(GenerationContext context) { var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java index c819acb06fa..d775ad8f3b7 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java @@ -112,7 +112,7 @@ protected void generateOperationDocumentSerializer( } @Override - public void generateEndpointResolutionV2(GenerationContext context) { + public void generateEndpointResolution(GenerationContext context) { var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java index de0537405a9..0cae177abb4 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java @@ -659,7 +659,7 @@ protected void generateEventStreamDeserializers( } @Override - public void generateEndpointResolutionV2(GenerationContext context) { + public void generateEndpointResolution(GenerationContext context) { var generator = new EndpointResolutionV2Generator(new AwsFnProvider()); generator.generate(context); } From 43ab8323120e48072f30969b80821d54a0bbb93d Mon Sep 17 00:00:00 2001 From: Isaiah Vita Date: Fri, 5 May 2023 23:03:23 +0000 Subject: [PATCH 8/8] update s3 regen --- service/s3/endpoints.go | 586 ++++++++++++++++---------------- service/s3/go.mod | 8 +- service/s3control/endpoints.go | 98 +++--- service/s3control/go.mod | 2 +- service/s3outposts/endpoints.go | 42 +-- service/s3outposts/go.mod | 4 +- 6 files changed, 370 insertions(+), 370 deletions(-) diff --git a/service/s3/endpoints.go b/service/s3/endpoints.go index 1278604e4b0..a75164d5016 100644 --- a/service/s3/endpoints.go +++ b/service/s3/endpoints.go @@ -11,9 +11,9 @@ import ( "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints" smithy "github.com/aws/smithy-go" + smithyendpoints "github.com/aws/smithy-go/endpoints" "github.com/aws/smithy-go/endpoints/private/rulesfn" "github.com/aws/smithy-go/middleware" - smithytransport "github.com/aws/smithy-go/transport" smithyhttp "github.com/aws/smithy-go/transport/http" "net/http" "net/url" @@ -212,8 +212,8 @@ func finalizeClientEndpointResolverOptions(options *Options) { } -// EndpointParameters provides the option parameters for influence how endpoints -// are resolved. +// EndpointParameters provides the parameters that influence how endpoints are +// resolved. type EndpointParameters struct { // The S3 bucket used to send the request. This is an optional parameter that will // be set automatically for operations that are scoped to an S3 bucket. @@ -340,24 +340,24 @@ func (p EndpointParameters) ValidateRequired() error { type EndpointResolverV2 interface { // ResolveEndpoint attempts to resolve the endpoint with the provided options, // returning the endpoint if found. Otherwise an error is returned. - ResolveEndpoint(ctx context.Context, options EndpointParameters) ( - smithytransport.Endpoint, error, + ResolveEndpoint(ctx context.Context, params EndpointParameters) ( + smithyendpoints.Endpoint, error, ) } -// resolverV2 provides the implementation for resolving endpoints. -type resolverV2 struct{} +// resolver provides the implementation for resolving endpoints. +type resolver struct{} -func NewDefaultEndpointResolverV2() *resolverV2 { - return &resolverV2{} +func NewDefaultEndpointResolverV2() EndpointResolverV2 { + return &resolver{} } // ResolveEndpoint attempts to resolve the endpoint with the provided options, // returning the endpoint if found. Otherwise an error is returned. -func (r *resolverV2) ResolveEndpoint( +func (r *resolver) ResolveEndpoint( ctx context.Context, params EndpointParameters, ) ( - endpoint smithytransport.Endpoint, err error, + endpoint smithyendpoints.Endpoint, err error, ) { if err = params.ValidateRequired(); err != nil { return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) @@ -416,9 +416,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -452,9 +452,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -496,9 +496,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -534,9 +534,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -623,9 +623,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -661,9 +661,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -702,9 +702,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -744,9 +744,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -789,9 +789,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -834,9 +834,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -880,9 +880,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -927,9 +927,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -967,9 +967,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1005,9 +1005,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1046,9 +1046,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1088,9 +1088,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1127,9 +1127,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1165,9 +1165,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1206,9 +1206,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1248,9 +1248,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1293,9 +1293,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1338,9 +1338,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1385,9 +1385,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1417,9 +1417,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1464,9 +1464,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1504,9 +1504,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1542,9 +1542,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1582,9 +1582,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1615,9 +1615,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1657,9 +1657,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1746,9 +1746,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1786,9 +1786,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1829,9 +1829,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1873,9 +1873,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1914,9 +1914,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1954,9 +1954,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1997,9 +1997,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2041,9 +2041,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2082,9 +2082,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2122,9 +2122,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2163,9 +2163,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2205,9 +2205,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2246,9 +2246,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2286,9 +2286,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2329,9 +2329,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2373,9 +2373,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2421,9 +2421,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2471,9 +2471,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2520,9 +2520,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2570,9 +2570,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2621,9 +2621,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2653,9 +2653,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2706,9 +2706,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2739,9 +2739,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2790,9 +2790,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2842,9 +2842,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2885,9 +2885,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2925,9 +2925,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2967,9 +2967,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -2998,9 +2998,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3040,9 +3040,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3081,9 +3081,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3121,9 +3121,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3163,9 +3163,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3196,9 +3196,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3240,9 +3240,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3299,9 +3299,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3413,9 +3413,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3450,9 +3450,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3485,9 +3485,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3642,9 +3642,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3680,9 +3680,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3718,9 +3718,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3762,9 +3762,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3802,9 +3802,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -3912,9 +3912,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4029,9 +4029,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4067,9 +4067,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4201,9 +4201,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4239,9 +4239,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4280,9 +4280,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4322,9 +4322,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4367,9 +4367,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4412,9 +4412,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4458,9 +4458,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4505,9 +4505,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4545,9 +4545,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4583,9 +4583,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4624,9 +4624,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4666,9 +4666,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4705,9 +4705,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4743,9 +4743,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4784,9 +4784,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4826,9 +4826,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4871,9 +4871,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4916,9 +4916,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4963,9 +4963,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -4995,9 +4995,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5042,9 +5042,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5082,9 +5082,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5120,9 +5120,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5160,9 +5160,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5193,9 +5193,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5235,9 +5235,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5302,9 +5302,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5335,9 +5335,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5366,9 +5366,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5421,9 +5421,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5465,9 +5465,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5510,9 +5510,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5556,9 +5556,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5594,9 +5594,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5630,9 +5630,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5669,9 +5669,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5709,9 +5709,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5753,9 +5753,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5797,9 +5797,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5842,9 +5842,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5888,9 +5888,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5926,9 +5926,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -5962,9 +5962,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6001,9 +6001,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6041,9 +6041,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6085,9 +6085,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6129,9 +6129,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6174,9 +6174,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6220,9 +6220,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6258,9 +6258,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6294,9 +6294,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6333,9 +6333,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6373,9 +6373,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6417,9 +6417,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6461,9 +6461,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6507,9 +6507,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6538,9 +6538,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6584,9 +6584,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6622,9 +6622,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6658,9 +6658,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6696,9 +6696,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6727,9 +6727,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -6767,9 +6767,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ diff --git a/service/s3/go.mod b/service/s3/go.mod index a868e2b42d0..8ee03ff566b 100644 --- a/service/s3/go.mod +++ b/service/s3/go.mod @@ -3,14 +3,14 @@ module github.com/aws/aws-sdk-go-v2/service/s3 go 1.15 require ( - github.com/aws/smithy-go v1.4.0 github.com/aws/aws-sdk-go-v2 v1.4.0 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v0.0.0-00010101000000-000000000000 - github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.7 + github.com/aws/smithy-go v1.4.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/internal/v4a v0.0.0-00010101000000-000000000000 - github.com/aws/aws-sdk-go-v2/service/internal/checksum v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.0.5 - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.7 + github.com/aws/aws-sdk-go-v2/service/internal/checksum v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.2.3 ) diff --git a/service/s3control/endpoints.go b/service/s3control/endpoints.go index 208a9fd696f..d53662cdcfb 100644 --- a/service/s3control/endpoints.go +++ b/service/s3control/endpoints.go @@ -11,9 +11,9 @@ import ( "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3control/internal/endpoints" smithy "github.com/aws/smithy-go" + smithyendpoints "github.com/aws/smithy-go/endpoints" "github.com/aws/smithy-go/endpoints/private/rulesfn" "github.com/aws/smithy-go/middleware" - smithytransport "github.com/aws/smithy-go/transport" smithyhttp "github.com/aws/smithy-go/transport/http" "net/http" "net/url" @@ -212,8 +212,8 @@ func finalizeClientEndpointResolverOptions(options *Options) { } -// EndpointParameters provides the option parameters for influence how endpoints -// are resolved. +// EndpointParameters provides the parameters that influence how endpoints are +// resolved. type EndpointParameters struct { // The AWS region used to dispatch the request. // @@ -309,24 +309,24 @@ func (p EndpointParameters) ValidateRequired() error { type EndpointResolverV2 interface { // ResolveEndpoint attempts to resolve the endpoint with the provided options, // returning the endpoint if found. Otherwise an error is returned. - ResolveEndpoint(ctx context.Context, options EndpointParameters) ( - smithytransport.Endpoint, error, + ResolveEndpoint(ctx context.Context, params EndpointParameters) ( + smithyendpoints.Endpoint, error, ) } -// resolverV2 provides the implementation for resolving endpoints. -type resolverV2 struct{} +// resolver provides the implementation for resolving endpoints. +type resolver struct{} -func NewDefaultEndpointResolverV2() *resolverV2 { - return &resolverV2{} +func NewDefaultEndpointResolverV2() EndpointResolverV2 { + return &resolver{} } // ResolveEndpoint attempts to resolve the endpoint with the provided options, // returning the endpoint if found. Otherwise an error is returned. -func (r *resolverV2) ResolveEndpoint( +func (r *resolver) ResolveEndpoint( ctx context.Context, params EndpointParameters, ) ( - endpoint smithytransport.Endpoint, err error, + endpoint smithyendpoints.Endpoint, err error, ) { if err = params.ValidateRequired(); err != nil { return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) @@ -391,9 +391,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -424,9 +424,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -455,9 +455,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -558,13 +558,13 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, Headers: func() *http.Header { headers := http.Header{} headers.Set("x-amz-account-id", _accessPointArn.AccountId) headers.Set("x-amz-outpost-id", _outpostId) - return &headers + return headers }(), Properties: func() smithy.Properties { var out smithy.Properties @@ -600,13 +600,13 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, Headers: func() *http.Header { headers := http.Header{} headers.Set("x-amz-account-id", _accessPointArn.AccountId) headers.Set("x-amz-outpost-id", _outpostId) - return &headers + return headers }(), Properties: func() smithy.Properties { var out smithy.Properties @@ -637,13 +637,13 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, Headers: func() *http.Header { headers := http.Header{} headers.Set("x-amz-account-id", _accessPointArn.AccountId) headers.Set("x-amz-outpost-id", _outpostId) - return &headers + return headers }(), Properties: func() smithy.Properties { var out smithy.Properties @@ -807,13 +807,13 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, Headers: func() *http.Header { headers := http.Header{} headers.Set("x-amz-account-id", _bucketArn.AccountId) headers.Set("x-amz-outpost-id", _outpostId) - return &headers + return headers }(), Properties: func() smithy.Properties { var out smithy.Properties @@ -849,13 +849,13 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, Headers: func() *http.Header { headers := http.Header{} headers.Set("x-amz-account-id", _bucketArn.AccountId) headers.Set("x-amz-outpost-id", _outpostId) - return &headers + return headers }(), Properties: func() smithy.Properties { var out smithy.Properties @@ -886,13 +886,13 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, Headers: func() *http.Header { headers := http.Header{} headers.Set("x-amz-account-id", _bucketArn.AccountId) headers.Set("x-amz-outpost-id", _outpostId) - return &headers + return headers }(), Properties: func() smithy.Properties { var out smithy.Properties @@ -1031,9 +1031,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1064,9 +1064,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1107,9 +1107,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1144,9 +1144,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1187,9 +1187,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1224,9 +1224,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1267,9 +1267,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1304,9 +1304,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1347,9 +1347,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ @@ -1384,9 +1384,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, Properties: func() smithy.Properties { var out smithy.Properties out.Set("authSchemes", []interface{}{ diff --git a/service/s3control/go.mod b/service/s3control/go.mod index 8a8240d6f44..63edf7e247b 100644 --- a/service/s3control/go.mod +++ b/service/s3control/go.mod @@ -3,9 +3,9 @@ module github.com/aws/aws-sdk-go-v2/service/s3control go 1.15 require ( - github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.2.3 github.com/aws/smithy-go v1.4.0 github.com/aws/aws-sdk-go-v2 v1.4.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 ) diff --git a/service/s3outposts/endpoints.go b/service/s3outposts/endpoints.go index ce32bda46fa..c14f92f698e 100644 --- a/service/s3outposts/endpoints.go +++ b/service/s3outposts/endpoints.go @@ -10,8 +10,8 @@ import ( awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3outposts/internal/endpoints" + smithyendpoints "github.com/aws/smithy-go/endpoints" "github.com/aws/smithy-go/middleware" - smithytransport "github.com/aws/smithy-go/transport" smithyhttp "github.com/aws/smithy-go/transport/http" "net/http" "net/url" @@ -202,8 +202,8 @@ func finalizeClientEndpointResolverOptions(options *Options) { } -// EndpointParameters provides the option parameters for influence how endpoints -// are resolved. +// EndpointParameters provides the parameters that influence how endpoints are +// resolved. type EndpointParameters struct { // The AWS region used to dispatch the request. // @@ -258,24 +258,24 @@ func (p EndpointParameters) ValidateRequired() error { type EndpointResolverV2 interface { // ResolveEndpoint attempts to resolve the endpoint with the provided options, // returning the endpoint if found. Otherwise an error is returned. - ResolveEndpoint(ctx context.Context, options EndpointParameters) ( - smithytransport.Endpoint, error, + ResolveEndpoint(ctx context.Context, params EndpointParameters) ( + smithyendpoints.Endpoint, error, ) } -// resolverV2 provides the implementation for resolving endpoints. -type resolverV2 struct{} +// resolver provides the implementation for resolving endpoints. +type resolver struct{} -func NewDefaultEndpointResolverV2() *resolverV2 { - return &resolverV2{} +func NewDefaultEndpointResolverV2() EndpointResolverV2 { + return &resolver{} } // ResolveEndpoint attempts to resolve the endpoint with the provided options, // returning the endpoint if found. Otherwise an error is returned. -func (r *resolverV2) ResolveEndpoint( +func (r *resolver) ResolveEndpoint( ctx context.Context, params EndpointParameters, ) ( - endpoint smithytransport.Endpoint, err error, + endpoint smithyendpoints.Endpoint, err error, ) { if err = params.ValidateRequired(); err != nil { return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) @@ -299,9 +299,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, }, nil } if exprVal := params.Region; exprVal != nil { @@ -328,9 +328,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, }, nil } } @@ -353,9 +353,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, }, nil } return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") @@ -376,9 +376,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, }, nil } return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") @@ -397,9 +397,9 @@ func (r *resolverV2) ResolveEndpoint( return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) } - return smithytransport.Endpoint{ + return smithyendpoints.Endpoint{ URI: *uri, - Headers: &http.Header{}, + Headers: http.Header{}, }, nil } return endpoint, fmt.Errorf("no rules matched these parameters. This is a bug, %#v", params) diff --git a/service/s3outposts/go.mod b/service/s3outposts/go.mod index ee26a48ce76..612c92cae5b 100644 --- a/service/s3outposts/go.mod +++ b/service/s3outposts/go.mod @@ -3,8 +3,8 @@ module github.com/aws/aws-sdk-go-v2/service/s3outposts go 1.15 require ( - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 - github.com/aws/smithy-go v1.4.0 github.com/aws/aws-sdk-go-v2 v1.4.0 github.com/aws/aws-sdk-go-v2/internal/configsources v0.0.0-00010101000000-000000000000 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.0-00010101000000-000000000000 + github.com/aws/smithy-go v1.4.0 )