Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for SharedMicrosoftAD type in getDirectoryServiceSnapshotLimit and getDirectoryServiceEventTopics Closes #2155 #2156

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ParthaI, in this case, the error did not say that it is not supported for SharedMicrosoftAD.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bigdatasourav, the error message says Snapshot limits can be fetched only for VPC or Microsoft AD directories
but the type value we are getting SharedMicrosoftAD means it is a shared directory. If it is not a shared directory the type would be MicrosoftAD.

return nil, nil
}

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