diff options
author | vitalyisaev <vitalyisaev@ydb.tech> | 2023-12-12 21:55:07 +0300 |
---|---|---|
committer | vitalyisaev <vitalyisaev@ydb.tech> | 2023-12-12 22:25:10 +0300 |
commit | 4967f99474a4040ba150eb04995de06342252718 (patch) | |
tree | c9c118836513a8fab6e9fcfb25be5d404338bca7 /vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/arn_test.go | |
parent | 2ce9cccb9b0bdd4cd7a3491dc5cbf8687cda51de (diff) | |
download | ydb-4967f99474a4040ba150eb04995de06342252718.tar.gz |
YQ Connector: prepare code base for S3 integration
1. Кодовая база Коннектора переписана с помощью Go дженериков так, чтобы добавление нового источника данных (в частности S3 + csv) максимально переиспользовало имеющийся код (чтобы сохранялась логика нарезания на блоки данных, учёт трафика и пр.)
2. API Connector расширено для работы с S3, но ещё пока не протестировано.
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/arn_test.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/arn_test.go | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/arn_test.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/arn_test.go new file mode 100644 index 0000000000..bab7f86110 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/arn_test.go @@ -0,0 +1,80 @@ +package awsrulesfn + +import ( + "github.com/google/go-cmp/cmp" + "testing" +) + +func TestParseARN(t *testing.T) { + cases := []struct { + input string + expect *ARN + }{ + { + input: "invalid", + expect: nil, + }, + { + input: "arn:nope", + expect: nil, + }, + { + input: "arn:aws:ecr:us-west-2:123456789012:repository/foo/bar", + expect: &ARN{ + Partition: "aws", + Service: "ecr", + Region: "us-west-2", + AccountId: "123456789012", + ResourceId: []string{"repository", "foo", "bar"}, + }, + }, + { + input: "arn:aws:elasticbeanstalk:us-east-1:123456789012:environment/My App/MyEnvironment", + expect: &ARN{ + Partition: "aws", + Service: "elasticbeanstalk", + Region: "us-east-1", + AccountId: "123456789012", + ResourceId: []string{"environment", "My App", "MyEnvironment"}, + }, + }, + { + input: "arn:aws:iam::123456789012:user/David", + expect: &ARN{ + Partition: "aws", + Service: "iam", + Region: "", + AccountId: "123456789012", + ResourceId: []string{"user", "David"}, + }, + }, + { + input: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db", + expect: &ARN{ + Partition: "aws", + Service: "rds", + Region: "eu-west-1", + AccountId: "123456789012", + ResourceId: []string{"db", "mysql-db"}, + }, + }, + { + input: "arn:aws:s3:::my_corporate_bucket/exampleobject.png", + expect: &ARN{ + Partition: "aws", + Service: "s3", + Region: "", + AccountId: "", + ResourceId: []string{"my_corporate_bucket", "exampleobject.png"}, + }, + }, + } + for _, c := range cases { + t.Run(c.input, func(t *testing.T) { + actual := ParseARN(c.input) + if diff := cmp.Diff(c.expect, actual); diff != "" { + t.Errorf("expect ARN match\n%s", diff) + } + }) + } +} |