aws / aws-sdk-go

AWS SDK for the Go programming language.

Home Page:http://aws.amazon.com/sdk-for-go/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[opensearchserverless] SecurityPolicyDetail does not include the policy JSON

FlorianSW opened this issue · comments

Describe the feature

The API operation GetSecurityPolicy contains the policy document of the requested policy in the response. The policy is available in the key policy.

However, when using the GetSecurityPolicy method on an opensearchserverless client of the aws-sdk-go, the return type (GetSecurityPolicyOutput -> SecurityPolicyDetail) does not include the policy document.

See the code:

type SecurityPolicyDetail struct {
_ struct{} `type:"structure"`
// The date the policy was created.
CreatedDate *int64 `locationName:"createdDate" type:"long"`
// The description of the security policy.
Description *string `locationName:"description" type:"string"`
// The timestamp of when the policy was last modified.
LastModifiedDate *int64 `locationName:"lastModifiedDate" type:"long"`
// The name of the policy.
Name *string `locationName:"name" min:"3" type:"string"`
// The version of the policy.
PolicyVersion *string `locationName:"policyVersion" min:"20" type:"string"`
// The type of security policy.
Type *string `locationName:"type" type:"string" enum:"SecurityPolicyType"`
}

This makes it currently impossible to inspect the policy document of, e.g., the network or encryption policy applied to an OpenSearch serverless collection.

Use Case

To automate the workflows when working with OpenSearch Serverless collections, I need to be able to inspect several properties of an encryption or network policy applied to a collection. Based on the applied policies our tool using the AWS Go SDK will recommend changes or auto-remediate them. Without knowing the currently applied policies, this is not possible.

Proposed Solution

Add the policy content to the GetSecurityPolicyOutput type.

Other Information

The policy field is added to the v2 version of the SDK already: https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/opensearchserverless@v1.8.1/types#SecurityPolicyDetail

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

v1.47.11

Environment details (Version of Go (go version)? OS name and version, etc.)

go version go1.21.3 darwin/arm64

Hi @FlorianSW ,

Thanks for opening this issue. This seems like a bug in our model code generation. Specifically there is a discrepancy between the published model and the model the SDK holds for code generation purposes.

We will look into this with priority.
All the best,
Ran~

Hi @FlorianSW ,

https://github.com/aws/aws-sdk-go/releases/tag/v1.43.0
This is a known issue where the Go SDK v1 cannot deserialize JSONValue types.

The solution is to upgrade to Go v2.

Thanks,
Ran~

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.