Skip to content

Commit

Permalink
aws api adding extended and deprecating old resource collection field (
Browse files Browse the repository at this point in the history
…#2463)

Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Apr 10, 2024
1 parent 717f621 commit a24a0bb
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 50 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-10 17:49:46.632329",
"spec_repo_commit": "bb0f8c92"
"regenerated": "2024-04-10 19:45:03.769689",
"spec_repo_commit": "3fb610b5"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-04-10 17:49:46.651626",
"spec_repo_commit": "bb0f8c92"
"regenerated": "2024-04-10 19:45:03.787823",
"spec_repo_commit": "3fb610b5"
}
}
}
11 changes: 9 additions & 2 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ components:
description: Regions to exclude.
type: string
type: array
extended_resource_collection_enabled:
default: false
description: Whether Datadog collects additional attributes and configuration
information about the resources in your AWS account. Required for `cspm_resource_collection`.
example: true
type: boolean
filter_tags:
description: 'The array of EC2 tags (in the form `key:value`) defines a
filter that Datadog uses when collecting metrics from EC2.
Expand Down Expand Up @@ -128,8 +134,9 @@ components:
type: boolean
resource_collection_enabled:
default: false
description: Whether Datadog collects a standard set of resources from your
AWS account.
deprecated: true
description: Deprecated in favor of 'extended_resource_collection_enabled'.
Whether Datadog collects a standard set of resources from your AWS account.
example: true
type: boolean
role_name:
Expand Down
69 changes: 56 additions & 13 deletions api/datadogV1/model_aws_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type AWSAccount struct {
// An array of [AWS regions](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints)
// to exclude from metrics collection.
ExcludedRegions []string `json:"excluded_regions,omitempty"`
// Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Required for `cspm_resource_collection`.
ExtendedResourceCollectionEnabled *bool `json:"extended_resource_collection_enabled,omitempty"`
// The array of EC2 tags (in the form `key:value`) defines a filter that Datadog uses when collecting metrics from EC2.
// Wildcards, such as `?` (for single characters) and `*` (for multiple characters) can also be used.
// Only hosts that match one of the defined tags
Expand All @@ -35,7 +37,8 @@ type AWSAccount struct {
HostTags []string `json:"host_tags,omitempty"`
// Whether Datadog collects metrics for this AWS account.
MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"`
// Whether Datadog collects a standard set of resources from your AWS account.
// Deprecated in favor of 'extended_resource_collection_enabled'. Whether Datadog collects a standard set of resources from your AWS account.
// Deprecated
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
// Your Datadog role delegation name.
RoleName *string `json:"role_name,omitempty"`
Expand All @@ -54,6 +57,8 @@ func NewAWSAccount() *AWSAccount {
this := AWSAccount{}
var cspmResourceCollectionEnabled bool = false
this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled
var extendedResourceCollectionEnabled bool = false
this.ExtendedResourceCollectionEnabled = &extendedResourceCollectionEnabled
var metricsCollectionEnabled bool = true
this.MetricsCollectionEnabled = &metricsCollectionEnabled
var resourceCollectionEnabled bool = false
Expand All @@ -68,6 +73,8 @@ func NewAWSAccountWithDefaults() *AWSAccount {
this := AWSAccount{}
var cspmResourceCollectionEnabled bool = false
this.CspmResourceCollectionEnabled = &cspmResourceCollectionEnabled
var extendedResourceCollectionEnabled bool = false
this.ExtendedResourceCollectionEnabled = &extendedResourceCollectionEnabled
var metricsCollectionEnabled bool = true
this.MetricsCollectionEnabled = &metricsCollectionEnabled
var resourceCollectionEnabled bool = false
Expand Down Expand Up @@ -215,6 +222,34 @@ func (o *AWSAccount) SetExcludedRegions(v []string) {
o.ExcludedRegions = v
}

// GetExtendedResourceCollectionEnabled returns the ExtendedResourceCollectionEnabled field value if set, zero value otherwise.
func (o *AWSAccount) GetExtendedResourceCollectionEnabled() bool {
if o == nil || o.ExtendedResourceCollectionEnabled == nil {
var ret bool
return ret
}
return *o.ExtendedResourceCollectionEnabled
}

// GetExtendedResourceCollectionEnabledOk returns a tuple with the ExtendedResourceCollectionEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AWSAccount) GetExtendedResourceCollectionEnabledOk() (*bool, bool) {
if o == nil || o.ExtendedResourceCollectionEnabled == nil {
return nil, false
}
return o.ExtendedResourceCollectionEnabled, true
}

// HasExtendedResourceCollectionEnabled returns a boolean if a field has been set.
func (o *AWSAccount) HasExtendedResourceCollectionEnabled() bool {
return o != nil && o.ExtendedResourceCollectionEnabled != nil
}

// SetExtendedResourceCollectionEnabled gets a reference to the given bool and assigns it to the ExtendedResourceCollectionEnabled field.
func (o *AWSAccount) SetExtendedResourceCollectionEnabled(v bool) {
o.ExtendedResourceCollectionEnabled = &v
}

// GetFilterTags returns the FilterTags field value if set, zero value otherwise.
func (o *AWSAccount) GetFilterTags() []string {
if o == nil || o.FilterTags == nil {
Expand Down Expand Up @@ -300,6 +335,7 @@ func (o *AWSAccount) SetMetricsCollectionEnabled(v bool) {
}

// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise.
// Deprecated
func (o *AWSAccount) GetResourceCollectionEnabled() bool {
if o == nil || o.ResourceCollectionEnabled == nil {
var ret bool
Expand All @@ -310,6 +346,7 @@ func (o *AWSAccount) GetResourceCollectionEnabled() bool {

// GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
// Deprecated
func (o *AWSAccount) GetResourceCollectionEnabledOk() (*bool, bool) {
if o == nil || o.ResourceCollectionEnabled == nil {
return nil, false
Expand All @@ -323,6 +360,7 @@ func (o *AWSAccount) HasResourceCollectionEnabled() bool {
}

// SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field.
// Deprecated
func (o *AWSAccount) SetResourceCollectionEnabled(v bool) {
o.ResourceCollectionEnabled = &v
}
Expand Down Expand Up @@ -404,6 +442,9 @@ func (o AWSAccount) MarshalJSON() ([]byte, error) {
if o.ExcludedRegions != nil {
toSerialize["excluded_regions"] = o.ExcludedRegions
}
if o.ExtendedResourceCollectionEnabled != nil {
toSerialize["extended_resource_collection_enabled"] = o.ExtendedResourceCollectionEnabled
}
if o.FilterTags != nil {
toSerialize["filter_tags"] = o.FilterTags
}
Expand Down Expand Up @@ -432,24 +473,25 @@ func (o AWSAccount) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
AccessKeyId *string `json:"access_key_id,omitempty"`
AccountId *string `json:"account_id,omitempty"`
AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"`
CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"`
ExcludedRegions []string `json:"excluded_regions,omitempty"`
FilterTags []string `json:"filter_tags,omitempty"`
HostTags []string `json:"host_tags,omitempty"`
MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"`
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
RoleName *string `json:"role_name,omitempty"`
SecretAccessKey *string `json:"secret_access_key,omitempty"`
AccessKeyId *string `json:"access_key_id,omitempty"`
AccountId *string `json:"account_id,omitempty"`
AccountSpecificNamespaceRules map[string]bool `json:"account_specific_namespace_rules,omitempty"`
CspmResourceCollectionEnabled *bool `json:"cspm_resource_collection_enabled,omitempty"`
ExcludedRegions []string `json:"excluded_regions,omitempty"`
ExtendedResourceCollectionEnabled *bool `json:"extended_resource_collection_enabled,omitempty"`
FilterTags []string `json:"filter_tags,omitempty"`
HostTags []string `json:"host_tags,omitempty"`
MetricsCollectionEnabled *bool `json:"metrics_collection_enabled,omitempty"`
ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"`
RoleName *string `json:"role_name,omitempty"`
SecretAccessKey *string `json:"secret_access_key,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"access_key_id", "account_id", "account_specific_namespace_rules", "cspm_resource_collection_enabled", "excluded_regions", "filter_tags", "host_tags", "metrics_collection_enabled", "resource_collection_enabled", "role_name", "secret_access_key"})
datadog.DeleteKeys(additionalProperties, &[]string{"access_key_id", "account_id", "account_specific_namespace_rules", "cspm_resource_collection_enabled", "excluded_regions", "extended_resource_collection_enabled", "filter_tags", "host_tags", "metrics_collection_enabled", "resource_collection_enabled", "role_name", "secret_access_key"})
} else {
return err
}
Expand All @@ -458,6 +500,7 @@ func (o *AWSAccount) UnmarshalJSON(bytes []byte) (err error) {
o.AccountSpecificNamespaceRules = all.AccountSpecificNamespaceRules
o.CspmResourceCollectionEnabled = all.CspmResourceCollectionEnabled
o.ExcludedRegions = all.ExcludedRegions
o.ExtendedResourceCollectionEnabled = all.ExtendedResourceCollectionEnabled
o.FilterTags = all.FilterTags
o.HostTags = all.HostTags
o.MetricsCollectionEnabled = all.MetricsCollectionEnabled
Expand Down
6 changes: 3 additions & 3 deletions examples/v1/aws-integration/CreateAWSAccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func main() {
"us-east-1",
"us-west-2",
},
ExtendedResourceCollectionEnabled: datadog.PtrBool(true),
FilterTags: []string{
"$KEY:$VALUE",
},
HostTags: []string{
"$KEY:$VALUE",
},
MetricsCollectionEnabled: datadog.PtrBool(false),
ResourceCollectionEnabled: datadog.PtrBool(true),
RoleName: datadog.PtrString("DatadogAWSIntegrationRole"),
MetricsCollectionEnabled: datadog.PtrBool(false),
RoleName: datadog.PtrString("DatadogAWSIntegrationRole"),
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
Expand Down
1 change: 1 addition & 0 deletions examples/v1/aws-integration/CreateNewAWSExternalID.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func main() {
"us-east-1",
"us-west-2",
},
ExtendedResourceCollectionEnabled: datadog.PtrBool(true),
FilterTags: []string{
"$KEY:$VALUE",
},
Expand Down
6 changes: 3 additions & 3 deletions examples/v1/aws-integration/UpdateAWSAccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func main() {
"us-east-1",
"us-west-2",
},
ExtendedResourceCollectionEnabled: datadog.PtrBool(true),
FilterTags: []string{
"$KEY:$VALUE",
},
HostTags: []string{
"$KEY:$VALUE",
},
MetricsCollectionEnabled: datadog.PtrBool(true),
ResourceCollectionEnabled: datadog.PtrBool(true),
RoleName: datadog.PtrString("DatadogAWSIntegrationRole"),
MetricsCollectionEnabled: datadog.PtrBool(true),
RoleName: datadog.PtrString("DatadogAWSIntegrationRole"),
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-11-13T14:17:01.291Z
2024-04-05T18:30:30.891Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"account_id":"169988502100","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183000","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand All @@ -12,7 +12,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/integration/aws
response:
body: '{"external_id":"9668e281c0ef4cc8be01710ef7a0ae4c"}
body: '{"external_id":"acb8f6b8a844443dbb726d07dcb1a870"}
'
code: 200
Expand All @@ -23,7 +23,7 @@ interactions:
status: 200 OK
- request:
body: |
{"account_id":"169988502100","role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183000","role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-11-21T19:25:15.118Z
2024-04-05T18:30:32.594Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"account_id":"170059471500","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183200","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand All @@ -12,7 +12,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/integration/aws
response:
body: '{"external_id":"77c77ead62584b0fa1bb6a9fe7d2fa28"}
body: '{"external_id":"6aa1bf95e5dc4c9985593e94169bd2f6"}
'
code: 200
Expand All @@ -23,7 +23,7 @@ interactions:
status: 200 OK
- request:
body: |
{"account_id":"170059471500","role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183200","role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand All @@ -45,7 +45,7 @@ interactions:
status: 200 OK
- request:
body: |
{"account_id":"170059471500","role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183200","role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand All @@ -56,7 +56,7 @@ interactions:
method: DELETE
url: https://api.datadoghq.com/api/v1/integration/aws
response:
body: '{"errors":["AWS account 170059471500 does not exist in integration"]}'
body: '{"errors":["AWS account 171234183200 does not exist in integration"]}'
code: 400
duration: 0ms
headers:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-11-23T18:16:16.323Z
2024-04-05T18:30:34.377Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"account_id":"170076337600","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183400","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":true,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":false,"role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand All @@ -12,7 +12,7 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/integration/aws
response:
body: '{"external_id":"c7298c166e774bf1bd1bc0419e68f1a0"}
body: '{"external_id":"c8ceedec95fc472fb6156f3104d425c9"}
'
code: 200
Expand All @@ -23,7 +23,7 @@ interactions:
status: 200 OK
- request:
body: |
{"account_id":"170076337600","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":false,"excluded_regions":["us-east-1","us-west-2"],"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":true,"resource_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183400","account_specific_namespace_rules":{"auto_scaling":false},"cspm_resource_collection_enabled":false,"excluded_regions":["us-east-1","us-west-2"],"extended_resource_collection_enabled":true,"filter_tags":["$KEY:$VALUE"],"host_tags":["$KEY:$VALUE"],"metrics_collection_enabled":true,"role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand All @@ -32,7 +32,7 @@ interactions:
- application/json
id: 1
method: PUT
url: https://api.datadoghq.com/api/v1/integration/aws?account_id=170076337600&role_name=DatadogAWSIntegrationRole
url: https://api.datadoghq.com/api/v1/integration/aws?account_id=171234183400&role_name=DatadogAWSIntegrationRole
response:
body: '{}
Expand All @@ -45,7 +45,7 @@ interactions:
status: 200 OK
- request:
body: |
{"account_id":"170076337600","role_name":"DatadogAWSIntegrationRole"}
{"account_id":"171234183400","role_name":"DatadogAWSIntegrationRole"}
form: {}
headers:
Accept:
Expand Down
Loading

0 comments on commit a24a0bb

Please sign in to comment.