Skip to content

Commit

Permalink
aws: multi account support (#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecutalo committed Nov 18, 2021
1 parent 6faeb14 commit 05d8f07
Show file tree
Hide file tree
Showing 45 changed files with 1,632 additions and 712 deletions.
10 changes: 8 additions & 2 deletions api/aws/dynamodb/v1/dynamodb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ service DDBAPI {
message Table {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.dynamodb.v1.Table",
pattern : "{region}/{name}"
pattern : "{account}/{region}/{name}"
};

// Enum representing the status of a table.
Expand Down Expand Up @@ -101,6 +101,9 @@ message Table {

// Table billing mode.
BillingMode billing_mode = 6;

// The aws acccount
string account = 7;
}

// A global secondary index.
Expand Down Expand Up @@ -152,6 +155,7 @@ message Throughput {
message DescribeTableRequest {
string table_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
string account = 3 [ (validate.rules).string = {min_bytes : 1} ];
}

// The result of requesting a table.
Expand All @@ -167,13 +171,15 @@ message DescribeTableResponse {
message UpdateCapacityRequest {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.dynamodb.v1.Table",
pattern : "{region}/{table_name}"
pattern : "{account}/{region}/{table_name}"
};

string table_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
Throughput table_throughput = 3;
repeated IndexUpdateAction gsi_updates = 4;
bool ignore_maximums = 5;
string account = 6 [ (validate.rules).string = {min_bytes : 1} ];
}

// The result of requesting a capacity update.
Expand Down
18 changes: 12 additions & 6 deletions api/aws/ec2/v1/ec2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ message AutoscalingGroupSize {
message ResizeAutoscalingGroupRequest {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.ec2.v1.AutoscalingGroup",
pattern : "{region}/{name}"
pattern : "{account}/{region}/{name}"
};

string name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];

AutoscalingGroupSize size = 3 [ (validate.rules).message = {required : true} ];
string account = 4 [ (validate.rules).string = {min_bytes : 1} ];
}

message ResizeAutoscalingGroupResponse {
Expand All @@ -67,7 +68,7 @@ message ResizeAutoscalingGroupResponse {
message AutoscalingGroup {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.ec2.v1.AutoscalingGroup",
pattern : "{region}/{name}"
pattern : "{account}/{region}/{name}"
};

string name = 1;
Expand Down Expand Up @@ -118,16 +119,18 @@ message AutoscalingGroup {
}

repeated Instance instances = 6;
string account = 7;
}

message GetInstanceRequest {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.ec2.v1.Instance",
pattern : "{region}/{instance_id}"
pattern : "{account}{region}/{instance_id}"
};

string instance_id = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
string account = 3 [ (validate.rules).string = {min_bytes : 1} ];
}

message GetInstanceResponse {
Expand All @@ -139,11 +142,12 @@ message GetInstanceResponse {
message TerminateInstanceRequest {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.ec2.v1.Instance",
pattern : "{region}/{instance_id}"
pattern : "{account}/{region}/{instance_id}"
};

string instance_id = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
string account = 3 [ (validate.rules).string = {min_bytes : 1} ];
}

message TerminateInstanceResponse {
Expand All @@ -152,11 +156,12 @@ message TerminateInstanceResponse {
message RebootInstanceRequest {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.ec2.v1.Instance",
pattern : "{region}/{instance_id}"
pattern : "{account}/{region}/{instance_id}"
};

string instance_id = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
string account = 3 [ (validate.rules).string = {min_bytes : 1} ];
}

message RebootInstanceResponse {
Expand All @@ -165,7 +170,7 @@ message RebootInstanceResponse {
message Instance {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.ec2.v1.Instance",
pattern : "{region}/{instance_id}"
pattern : "{account}/{region}/{instance_id}"
};

string instance_id = 1;
Expand All @@ -192,4 +197,5 @@ message Instance {
string availability_zone = 7;

map<string, string> tags = 8;
string account = 9;
}
14 changes: 9 additions & 5 deletions api/aws/kinesis/v1/kinesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package clutch.aws.kinesis.v1;
option go_package = "github.com/lyft/clutch/backend/api/aws/kinesis/v1;kinesisv1";

import "google/api/annotations.proto";
import "validate/validate.proto";

import "api/v1/annotations.proto";

Expand All @@ -27,8 +28,9 @@ service KinesisAPI {
}

message GetStreamRequest {
string stream_name = 1;
string region = 2;
string stream_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
string account = 3 [ (validate.rules).string = {min_bytes : 1} ];
}

message GetStreamResponse {
Expand All @@ -38,9 +40,10 @@ message GetStreamResponse {
}

message UpdateShardCountRequest {
string stream_name = 1;
string region = 2;
string stream_name = 1 [ (validate.rules).string = {min_bytes : 1} ];
string region = 2 [ (validate.rules).string = {min_bytes : 1} ];
int32 target_shard_count = 3;
string account = 4 [ (validate.rules).string = {min_bytes : 1} ];
}

message UpdateShardCountResponse {
Expand All @@ -49,10 +52,11 @@ message UpdateShardCountResponse {
message Stream {
option (clutch.api.v1.id).patterns = {
type_url : "clutch.aws.kinesis.v1.Stream",
pattern : "{region}/{stream_name}"
pattern : "{account}/{region}/{stream_name}"
};

string stream_name = 1;
string region = 2;
int32 current_shard_count = 3;
string account = 4;
}
23 changes: 22 additions & 1 deletion api/resolver/aws/v1/aws.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ message InstanceID {
placeholder : "i-1234567890",
},
} ];

string region = 2 [ (clutch.resolver.v1.schema_field) = {
display_name : "Region",
option_field : {include_all_option : true, include_dynamic_options : "regions"},
} ];

string account = 3 [ (clutch.resolver.v1.schema_field) = {
display_name : "Account",
option_field : {include_all_option : true, include_dynamic_options : "accounts"},
} ];
}

message AutoscalingGroupName {
Expand All @@ -45,6 +51,11 @@ message AutoscalingGroupName {
display_name : "Region",
option_field : {include_all_option : true, include_dynamic_options : "regions"},
} ];

string account = 3 [ (clutch.resolver.v1.schema_field) = {
display_name : "Account",
option_field : {include_all_option : true, include_dynamic_options : "accounts"},
} ];
}

message KinesisStreamName {
Expand All @@ -65,6 +76,11 @@ message KinesisStreamName {
display_name : "Region",
option_field : {include_all_option : true, include_dynamic_options : "regions"},
} ];

string account = 3 [ (clutch.resolver.v1.schema_field) = {
display_name : "Account",
option_field : {include_all_option : true, include_dynamic_options : "accounts"},
} ];
}

message DynamodbTableName {
Expand All @@ -85,4 +101,9 @@ message DynamodbTableName {
display_name : "Region",
option_field : {include_all_option : true, include_dynamic_options : "regions"},
} ];
}

string account = 3 [ (clutch.resolver.v1.schema_field) = {
display_name : "Account",
option_field : {include_all_option : true, include_dynamic_options : "accounts"},
} ];
}

0 comments on commit 05d8f07

Please sign in to comment.