Skip to content

Commit

Permalink
GetSecurityGroupWithID
Browse files Browse the repository at this point in the history
  • Loading branch information
tedteng committed Aug 18, 2022
1 parent 193e80b commit 1442dc6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
8 changes: 8 additions & 0 deletions pkg/alicloud/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ func (c *ecsClient) GetSecurityGroup(name string) (*ecs.DescribeSecurityGroupsRe
return c.DescribeSecurityGroups(request)
}

// GetSecurityGroup return security group metadata by security group name
func (c *ecsClient) GetSecurityGroupWithID(id string) (*ecs.DescribeSecurityGroupsResponse, error) {
request := ecs.CreateDescribeSecurityGroupsRequest()
request.SetScheme("HTTPS")
request.SecurityGroupId = id
return c.DescribeSecurityGroups(request)
}

// GetInstances return instance metadata by instance name
func (c *ecsClient) GetInstances(name string) (*ecs.DescribeInstancesResponse, error) {
request := ecs.CreateDescribeInstancesRequest()
Expand Down
1 change: 1 addition & 0 deletions pkg/alicloud/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type ECS interface {
CheckIfImageOwnedByAliCloud(imageID string) (bool, error)
ShareImageToAccount(ctx context.Context, regionID, imageID, accountID string) error
GetSecurityGroup(name string) (*ecs.DescribeSecurityGroupsResponse, error)
GetSecurityGroupWithID(id string) (*ecs.DescribeSecurityGroupsResponse, error)
DescribeSecurityGroups(request *ecs.DescribeSecurityGroupsRequest) (*ecs.DescribeSecurityGroupsResponse, error)
DescribeSecurityGroupAttribute(request *ecs.DescribeSecurityGroupAttributeRequest) (*ecs.DescribeSecurityGroupAttributeResponse, error)
DescribeKeyPairs(request *ecs.DescribeKeyPairsRequest) (*ecs.DescribeKeyPairsResponse, error)
Expand Down
23 changes: 19 additions & 4 deletions pkg/mock/provider-alicloud/alicloud/client/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1442dc6

Please sign in to comment.