Skip to content

Commit

Permalink
Add check for SharedMicrosoftAD type in getDirectoryServiceSnapshot…
Browse files Browse the repository at this point in the history
…Limit and getDirectoryServiceEventTopics Closes #2155 (#2156)
  • Loading branch information
ParthaI authored Apr 8, 2024
1 parent 799bf9d commit f663b19
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions aws/table_aws_directory_service_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ func getDirectoryServiceDirectory(ctx context.Context, d *plugin.QueryData, _ *p
func getDirectoryServiceEventTopics(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
directory := h.Item.(types.DirectoryDescription)

// This operation is not supported for for Shared MicrosoftAD directories
// Error: aws: operation error Directory Service: DescribeEventTopics, https response error StatusCode: 400, ClientException: Operation is not supported for Shared MicrosoftAD directories.
if directory.Type == "SharedMicrosoftAD" {
return nil, nil
}

// Create service
svc, err := DirectoryServiceClient(ctx, d)
if err != nil {
Expand Down Expand Up @@ -383,6 +389,12 @@ func getDirectoryServiceEventTopics(ctx context.Context, d *plugin.QueryData, h
func getDirectoryServiceSnapshotLimit(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
directory := h.Item.(types.DirectoryDescription)

// This operation is not supported for for Shared MicrosoftAD directories
// Error: aws: operation error Directory Service: GetSnapshotLimits, https response error StatusCode: 400, ClientException: Snapshot limits can be fetched only for VPC or Microsoft AD directories.
if directory.Type == "SharedMicrosoftAD" {
return nil, nil
}

// Create service
svc, err := DirectoryServiceClient(ctx, d)
if err != nil {
Expand Down

0 comments on commit f663b19

Please sign in to comment.