From 65bddfb0b258635420b916b9d730976c91e387e8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 18 Dec 2024 15:34:49 +0000 Subject: [PATCH] Regenerate client from commit 4c33d00e of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 209 ++++++++++++++ api/datadogV2/api_csm_coverage_analysis.go | 239 ++++++++++++++++ api/datadogV2/doc.go | 3 + ...d_accounts_coverage_analysis_attributes.go | 260 ++++++++++++++++++ ...m_cloud_accounts_coverage_analysis_data.go | 185 +++++++++++++ ...oud_accounts_coverage_analysis_response.go | 111 ++++++++ api/datadogV2/model_csm_coverage_analysis.go | 207 ++++++++++++++ ...containers_coverage_analysis_attributes.go | 260 ++++++++++++++++++ ...s_and_containers_coverage_analysis_data.go | 185 +++++++++++++ ...d_containers_coverage_analysis_response.go | 111 ++++++++ ...serverless_coverage_analysis_attributes.go | 184 +++++++++++++ ...l_csm_serverless_coverage_analysis_data.go | 185 +++++++++++++ ...m_serverless_coverage_analysis_response.go | 111 ++++++++ .../GetCSMCloudAccountsCoverageAnalysis.go | 29 ++ ...etCSMHostsAndContainersCoverageAnalysis.go | 29 ++ .../GetCSMServerlessCoverageAnalysis.go | 29 ++ tests/scenarios/api_mappings.go | 1 + .../features/v2/csm_coverage_analysis.feature | 31 +++ tests/scenarios/features/v2/undo.json | 18 ++ 20 files changed, 2391 insertions(+), 4 deletions(-) create mode 100644 api/datadogV2/api_csm_coverage_analysis.go create mode 100644 api/datadogV2/model_csm_cloud_accounts_coverage_analysis_attributes.go create mode 100644 api/datadogV2/model_csm_cloud_accounts_coverage_analysis_data.go create mode 100644 api/datadogV2/model_csm_cloud_accounts_coverage_analysis_response.go create mode 100644 api/datadogV2/model_csm_coverage_analysis.go create mode 100644 api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_attributes.go create mode 100644 api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_data.go create mode 100644 api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_response.go create mode 100644 api/datadogV2/model_csm_serverless_coverage_analysis_attributes.go create mode 100644 api/datadogV2/model_csm_serverless_coverage_analysis_data.go create mode 100644 api/datadogV2/model_csm_serverless_coverage_analysis_response.go create mode 100644 examples/v2/csm-coverage-analysis/GetCSMCloudAccountsCoverageAnalysis.go create mode 100644 examples/v2/csm-coverage-analysis/GetCSMHostsAndContainersCoverageAnalysis.go create mode 100644 examples/v2/csm-coverage-analysis/GetCSMServerlessCoverageAnalysis.go create mode 100644 tests/scenarios/features/v2/csm_coverage_analysis.feature diff --git a/.apigentools-info b/.apigentools-info index d599b5420be..9821f6ced36 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-17 15:50:58.956034", - "spec_repo_commit": "b82d3677" + "regenerated": "2024-12-18 15:33:11.212198", + "spec_repo_commit": "4c33d00e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-12-17 15:50:58.973652", - "spec_repo_commit": "b82d3677" + "regenerated": "2024-12-18 15:33:11.227249", + "spec_repo_commit": "4c33d00e" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c19d456f413..78d2653266b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -7159,6 +7159,140 @@ components: meta: $ref: '#/components/schemas/CSMAgentsMetadata' type: object + CsmCloudAccountsCoverageAnalysisAttributes: + description: CSM Cloud Accounts Coverage Analysis attributes. + properties: + aws_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + azure_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + gcp_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + org_id: + description: The Organization ID. + example: 123456 + format: int64 + type: integer + total_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + type: object + CsmCloudAccountsCoverageAnalysisData: + description: CSM Cloud Accounts Coverage Analysis data. + properties: + attributes: + $ref: '#/components/schemas/CsmCloudAccountsCoverageAnalysisAttributes' + id: + description: The ID of your organization. + example: 66b3c6b5-5c9a-457e-b1c3-f247ca23afa3 + type: string + type: + default: get_cloud_accounts_coverage_analysis_response_public_v0 + description: The type of the resource. The value should always be `get_cloud_accounts_coverage_analysis_response_public_v0`. + example: get_cloud_accounts_coverage_analysis_response_public_v0 + type: string + type: object + CsmCloudAccountsCoverageAnalysisResponse: + description: CSM Cloud Accounts Coverage Analysis response. + properties: + data: + $ref: '#/components/schemas/CsmCloudAccountsCoverageAnalysisData' + type: object + CsmCoverageAnalysis: + description: CSM Coverage Analysis. + properties: + configured_resources_count: + description: The number of fully configured resources. + example: 8 + format: int64 + type: integer + coverage: + description: The coverage percentage. + example: 0.8 + format: double + type: number + partially_configured_resources_count: + description: The number of partially configured resources. + example: 0 + format: int64 + type: integer + total_resources_count: + description: The total number of resources. + example: 10 + format: int64 + type: integer + type: object + CsmHostsAndContainersCoverageAnalysisAttributes: + description: CSM Hosts and Containers Coverage Analysis attributes. + properties: + cspm_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + cws_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + org_id: + description: The Organization ID. + example: 123456 + format: int64 + type: integer + total_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + vm_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + type: object + CsmHostsAndContainersCoverageAnalysisData: + description: CSM Hosts and Containers Coverage Analysis data. + properties: + attributes: + $ref: '#/components/schemas/CsmHostsAndContainersCoverageAnalysisAttributes' + id: + description: The ID of your organization. + example: 66b3c6b5-5c9a-457e-b1c3-f247ca23afa3 + type: string + type: + default: get_hosts_and_containers_coverage_analysis_response_public_v0 + description: The type of the resource. The value should always be `get_hosts_and_containers_coverage_analysis_response_public_v0`. + example: get_hosts_and_containers_coverage_analysis_response_public_v0 + type: string + type: object + CsmHostsAndContainersCoverageAnalysisResponse: + description: CSM Hosts and Containers Coverage Analysis response. + properties: + data: + $ref: '#/components/schemas/CsmHostsAndContainersCoverageAnalysisData' + type: object + CsmServerlessCoverageAnalysisAttributes: + description: CSM Serverless Resources Coverage Analysis attributes. + properties: + cws_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + org_id: + description: The Organization ID. + example: 123456 + format: int64 + type: integer + total_coverage: + $ref: '#/components/schemas/CsmCoverageAnalysis' + type: object + CsmServerlessCoverageAnalysisData: + description: CSM Serverless Resources Coverage Analysis data. + properties: + attributes: + $ref: '#/components/schemas/CsmServerlessCoverageAnalysisAttributes' + id: + description: The ID of your organization. + example: 66b3c6b5-5c9a-457e-b1c3-f247ca23afa3 + type: string + type: + default: get_serverless_coverage_analysis_response_public_v0 + description: The type of the resource. The value should always be `get_serverless_coverage_analysis_response_public_v0`. + example: get_serverless_coverage_analysis_response_public_v0 + type: string + type: object + CsmServerlessCoverageAnalysisResponse: + description: CSM Serverless Resources Coverage Analysis response. + properties: + data: + $ref: '#/components/schemas/CsmServerlessCoverageAnalysisData' + type: object CustomConnection: description: The definition of `CustomConnection` object. properties: @@ -32790,6 +32924,72 @@ paths: summary: Get all CSM Agents tags: - CSM Agents + /api/v2/csm/onboarding/coverage_analysis/cloud_accounts: + get: + description: 'Get the CSM Coverage Analysis of your Cloud Accounts. + + This is calculated based on the number of your Cloud Accounts that are + + scanned for security issues.' + operationId: GetCSMCloudAccountsCoverageAnalysis + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CsmCloudAccountsCoverageAnalysisResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get the CSM Cloud Accounts Coverage Analysis + tags: + - CSM Coverage Analysis + /api/v2/csm/onboarding/coverage_analysis/hosts_and_containers: + get: + description: 'Get the CSM Coverage Analysis of your Hosts and Containers. + + This is calculated based on the number of agents running on your Hosts + + and Containers with CSM feature(s) enabled.' + operationId: GetCSMHostsAndContainersCoverageAnalysis + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CsmHostsAndContainersCoverageAnalysisResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get the CSM Hosts and Containers Coverage Analysis + tags: + - CSM Coverage Analysis + /api/v2/csm/onboarding/coverage_analysis/serverless: + get: + description: 'Get the CSM Coverage Analysis of your Serverless Resources. + + This is calculated based on the number of agents running on your Serverless + + Resources with CSM feature(s) enabled.' + operationId: GetCSMServerlessCoverageAnalysis + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CsmServerlessCoverageAnalysisResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get the CSM Serverless Coverage Analysis + tags: + - CSM Coverage Analysis /api/v2/csm/onboarding/serverless/agents: get: description: Get the list of all CSM Serverless Agents running on your hosts @@ -46559,6 +46759,15 @@ tags: Go to https://docs.datadoghq.com/security/cloud_security_management to learn more' name: CSM Agents +- description: 'Datadog Cloud Security Management (CSM) delivers real-time threat + detection + + and continuous configuration audits across your entire cloud infrastructure, + + all in a unified view for seamless collaboration and faster remediation. + + Go to https://docs.datadoghq.com/security/cloud_security_management to learn more' + name: CSM Coverage Analysis - description: Cloud Security Management Threats (CSM Threats) monitors file, network, and process activity across your environment to detect real-time threats to your infrastructure. See [Cloud Security Management Threats](https://docs.datadoghq.com/security/threats/) diff --git a/api/datadogV2/api_csm_coverage_analysis.go b/api/datadogV2/api_csm_coverage_analysis.go new file mode 100644 index 00000000000..861388c6a86 --- /dev/null +++ b/api/datadogV2/api_csm_coverage_analysis.go @@ -0,0 +1,239 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CSMCoverageAnalysisApi service type +type CSMCoverageAnalysisApi datadog.Service + +// GetCSMCloudAccountsCoverageAnalysis Get the CSM Cloud Accounts Coverage Analysis. +// Get the CSM Coverage Analysis of your Cloud Accounts. +// This is calculated based on the number of your Cloud Accounts that are +// scanned for security issues. +func (a *CSMCoverageAnalysisApi) GetCSMCloudAccountsCoverageAnalysis(ctx _context.Context) (CsmCloudAccountsCoverageAnalysisResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CsmCloudAccountsCoverageAnalysisResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CSMCoverageAnalysisApi.GetCSMCloudAccountsCoverageAnalysis") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/csm/onboarding/coverage_analysis/cloud_accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetCSMHostsAndContainersCoverageAnalysis Get the CSM Hosts and Containers Coverage Analysis. +// Get the CSM Coverage Analysis of your Hosts and Containers. +// This is calculated based on the number of agents running on your Hosts +// and Containers with CSM feature(s) enabled. +func (a *CSMCoverageAnalysisApi) GetCSMHostsAndContainersCoverageAnalysis(ctx _context.Context) (CsmHostsAndContainersCoverageAnalysisResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CsmHostsAndContainersCoverageAnalysisResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CSMCoverageAnalysisApi.GetCSMHostsAndContainersCoverageAnalysis") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/csm/onboarding/coverage_analysis/hosts_and_containers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetCSMServerlessCoverageAnalysis Get the CSM Serverless Coverage Analysis. +// Get the CSM Coverage Analysis of your Serverless Resources. +// This is calculated based on the number of agents running on your Serverless +// Resources with CSM feature(s) enabled. +func (a *CSMCoverageAnalysisApi) GetCSMServerlessCoverageAnalysis(ctx _context.Context) (CsmServerlessCoverageAnalysisResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CsmServerlessCoverageAnalysisResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CSMCoverageAnalysisApi.GetCSMServerlessCoverageAnalysis") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/csm/onboarding/coverage_analysis/serverless" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewCSMCoverageAnalysisApi Returns NewCSMCoverageAnalysisApi. +func NewCSMCoverageAnalysisApi(client *datadog.APIClient) *CSMCoverageAnalysisApi { + return &CSMCoverageAnalysisApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 72016bb2933..21a620cadd0 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -46,6 +46,9 @@ // - [CIVisibilityTestsApi.SearchCIAppTestEvents] // - [CSMAgentsApi.ListAllCSMAgents] // - [CSMAgentsApi.ListAllCSMServerlessAgents] +// - [CSMCoverageAnalysisApi.GetCSMCloudAccountsCoverageAnalysis] +// - [CSMCoverageAnalysisApi.GetCSMHostsAndContainersCoverageAnalysis] +// - [CSMCoverageAnalysisApi.GetCSMServerlessCoverageAnalysis] // - [CSMThreatsApi.CreateCSMThreatsAgentRule] // - [CSMThreatsApi.CreateCloudWorkloadSecurityAgentRule] // - [CSMThreatsApi.DeleteCSMThreatsAgentRule] diff --git a/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_attributes.go b/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_attributes.go new file mode 100644 index 00000000000..a6c3e8eaa6a --- /dev/null +++ b/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_attributes.go @@ -0,0 +1,260 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmCloudAccountsCoverageAnalysisAttributes CSM Cloud Accounts Coverage Analysis attributes. +type CsmCloudAccountsCoverageAnalysisAttributes struct { + // CSM Coverage Analysis. + AwsCoverage *CsmCoverageAnalysis `json:"aws_coverage,omitempty"` + // CSM Coverage Analysis. + AzureCoverage *CsmCoverageAnalysis `json:"azure_coverage,omitempty"` + // CSM Coverage Analysis. + GcpCoverage *CsmCoverageAnalysis `json:"gcp_coverage,omitempty"` + // The Organization ID. + OrgId *int64 `json:"org_id,omitempty"` + // CSM Coverage Analysis. + TotalCoverage *CsmCoverageAnalysis `json:"total_coverage,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmCloudAccountsCoverageAnalysisAttributes instantiates a new CsmCloudAccountsCoverageAnalysisAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmCloudAccountsCoverageAnalysisAttributes() *CsmCloudAccountsCoverageAnalysisAttributes { + this := CsmCloudAccountsCoverageAnalysisAttributes{} + return &this +} + +// NewCsmCloudAccountsCoverageAnalysisAttributesWithDefaults instantiates a new CsmCloudAccountsCoverageAnalysisAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmCloudAccountsCoverageAnalysisAttributesWithDefaults() *CsmCloudAccountsCoverageAnalysisAttributes { + this := CsmCloudAccountsCoverageAnalysisAttributes{} + return &this +} + +// GetAwsCoverage returns the AwsCoverage field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetAwsCoverage() CsmCoverageAnalysis { + if o == nil || o.AwsCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.AwsCoverage +} + +// GetAwsCoverageOk returns a tuple with the AwsCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetAwsCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.AwsCoverage == nil { + return nil, false + } + return o.AwsCoverage, true +} + +// HasAwsCoverage returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) HasAwsCoverage() bool { + return o != nil && o.AwsCoverage != nil +} + +// SetAwsCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the AwsCoverage field. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) SetAwsCoverage(v CsmCoverageAnalysis) { + o.AwsCoverage = &v +} + +// GetAzureCoverage returns the AzureCoverage field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetAzureCoverage() CsmCoverageAnalysis { + if o == nil || o.AzureCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.AzureCoverage +} + +// GetAzureCoverageOk returns a tuple with the AzureCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetAzureCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.AzureCoverage == nil { + return nil, false + } + return o.AzureCoverage, true +} + +// HasAzureCoverage returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) HasAzureCoverage() bool { + return o != nil && o.AzureCoverage != nil +} + +// SetAzureCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the AzureCoverage field. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) SetAzureCoverage(v CsmCoverageAnalysis) { + o.AzureCoverage = &v +} + +// GetGcpCoverage returns the GcpCoverage field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetGcpCoverage() CsmCoverageAnalysis { + if o == nil || o.GcpCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.GcpCoverage +} + +// GetGcpCoverageOk returns a tuple with the GcpCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetGcpCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.GcpCoverage == nil { + return nil, false + } + return o.GcpCoverage, true +} + +// HasGcpCoverage returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) HasGcpCoverage() bool { + return o != nil && o.GcpCoverage != nil +} + +// SetGcpCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the GcpCoverage field. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) SetGcpCoverage(v CsmCoverageAnalysis) { + o.GcpCoverage = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetTotalCoverage returns the TotalCoverage field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetTotalCoverage() CsmCoverageAnalysis { + if o == nil || o.TotalCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.TotalCoverage +} + +// GetTotalCoverageOk returns a tuple with the TotalCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) GetTotalCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.TotalCoverage == nil { + return nil, false + } + return o.TotalCoverage, true +} + +// HasTotalCoverage returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) HasTotalCoverage() bool { + return o != nil && o.TotalCoverage != nil +} + +// SetTotalCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the TotalCoverage field. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) SetTotalCoverage(v CsmCoverageAnalysis) { + o.TotalCoverage = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmCloudAccountsCoverageAnalysisAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AwsCoverage != nil { + toSerialize["aws_coverage"] = o.AwsCoverage + } + if o.AzureCoverage != nil { + toSerialize["azure_coverage"] = o.AzureCoverage + } + if o.GcpCoverage != nil { + toSerialize["gcp_coverage"] = o.GcpCoverage + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.TotalCoverage != nil { + toSerialize["total_coverage"] = o.TotalCoverage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmCloudAccountsCoverageAnalysisAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AwsCoverage *CsmCoverageAnalysis `json:"aws_coverage,omitempty"` + AzureCoverage *CsmCoverageAnalysis `json:"azure_coverage,omitempty"` + GcpCoverage *CsmCoverageAnalysis `json:"gcp_coverage,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + TotalCoverage *CsmCoverageAnalysis `json:"total_coverage,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{"aws_coverage", "azure_coverage", "gcp_coverage", "org_id", "total_coverage"}) + } else { + return err + } + + hasInvalidField := false + if all.AwsCoverage != nil && all.AwsCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AwsCoverage = all.AwsCoverage + if all.AzureCoverage != nil && all.AzureCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AzureCoverage = all.AzureCoverage + if all.GcpCoverage != nil && all.GcpCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.GcpCoverage = all.GcpCoverage + o.OrgId = all.OrgId + if all.TotalCoverage != nil && all.TotalCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TotalCoverage = all.TotalCoverage + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_data.go b/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_data.go new file mode 100644 index 00000000000..fd2b4336912 --- /dev/null +++ b/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_data.go @@ -0,0 +1,185 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmCloudAccountsCoverageAnalysisData CSM Cloud Accounts Coverage Analysis data. +type CsmCloudAccountsCoverageAnalysisData struct { + // CSM Cloud Accounts Coverage Analysis attributes. + Attributes *CsmCloudAccountsCoverageAnalysisAttributes `json:"attributes,omitempty"` + // The ID of your organization. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be `get_cloud_accounts_coverage_analysis_response_public_v0`. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmCloudAccountsCoverageAnalysisData instantiates a new CsmCloudAccountsCoverageAnalysisData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmCloudAccountsCoverageAnalysisData() *CsmCloudAccountsCoverageAnalysisData { + this := CsmCloudAccountsCoverageAnalysisData{} + var typeVar string = "get_cloud_accounts_coverage_analysis_response_public_v0" + this.Type = &typeVar + return &this +} + +// NewCsmCloudAccountsCoverageAnalysisDataWithDefaults instantiates a new CsmCloudAccountsCoverageAnalysisData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmCloudAccountsCoverageAnalysisDataWithDefaults() *CsmCloudAccountsCoverageAnalysisData { + this := CsmCloudAccountsCoverageAnalysisData{} + var typeVar string = "get_cloud_accounts_coverage_analysis_response_public_v0" + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisData) GetAttributes() CsmCloudAccountsCoverageAnalysisAttributes { + if o == nil || o.Attributes == nil { + var ret CsmCloudAccountsCoverageAnalysisAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisData) GetAttributesOk() (*CsmCloudAccountsCoverageAnalysisAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CsmCloudAccountsCoverageAnalysisAttributes and assigns it to the Attributes field. +func (o *CsmCloudAccountsCoverageAnalysisData) SetAttributes(v CsmCloudAccountsCoverageAnalysisAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CsmCloudAccountsCoverageAnalysisData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CsmCloudAccountsCoverageAnalysisData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmCloudAccountsCoverageAnalysisData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmCloudAccountsCoverageAnalysisData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CsmCloudAccountsCoverageAnalysisAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_response.go b/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_response.go new file mode 100644 index 00000000000..419c4494dac --- /dev/null +++ b/api/datadogV2/model_csm_cloud_accounts_coverage_analysis_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmCloudAccountsCoverageAnalysisResponse CSM Cloud Accounts Coverage Analysis response. +type CsmCloudAccountsCoverageAnalysisResponse struct { + // CSM Cloud Accounts Coverage Analysis data. + Data *CsmCloudAccountsCoverageAnalysisData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmCloudAccountsCoverageAnalysisResponse instantiates a new CsmCloudAccountsCoverageAnalysisResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmCloudAccountsCoverageAnalysisResponse() *CsmCloudAccountsCoverageAnalysisResponse { + this := CsmCloudAccountsCoverageAnalysisResponse{} + return &this +} + +// NewCsmCloudAccountsCoverageAnalysisResponseWithDefaults instantiates a new CsmCloudAccountsCoverageAnalysisResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmCloudAccountsCoverageAnalysisResponseWithDefaults() *CsmCloudAccountsCoverageAnalysisResponse { + this := CsmCloudAccountsCoverageAnalysisResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CsmCloudAccountsCoverageAnalysisResponse) GetData() CsmCloudAccountsCoverageAnalysisData { + if o == nil || o.Data == nil { + var ret CsmCloudAccountsCoverageAnalysisData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCloudAccountsCoverageAnalysisResponse) GetDataOk() (*CsmCloudAccountsCoverageAnalysisData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CsmCloudAccountsCoverageAnalysisResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CsmCloudAccountsCoverageAnalysisData and assigns it to the Data field. +func (o *CsmCloudAccountsCoverageAnalysisResponse) SetData(v CsmCloudAccountsCoverageAnalysisData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmCloudAccountsCoverageAnalysisResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmCloudAccountsCoverageAnalysisResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CsmCloudAccountsCoverageAnalysisData `json:"data,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{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_coverage_analysis.go b/api/datadogV2/model_csm_coverage_analysis.go new file mode 100644 index 00000000000..61df4820595 --- /dev/null +++ b/api/datadogV2/model_csm_coverage_analysis.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmCoverageAnalysis CSM Coverage Analysis. +type CsmCoverageAnalysis struct { + // The number of fully configured resources. + ConfiguredResourcesCount *int64 `json:"configured_resources_count,omitempty"` + // The coverage percentage. + Coverage *float64 `json:"coverage,omitempty"` + // The number of partially configured resources. + PartiallyConfiguredResourcesCount *int64 `json:"partially_configured_resources_count,omitempty"` + // The total number of resources. + TotalResourcesCount *int64 `json:"total_resources_count,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmCoverageAnalysis instantiates a new CsmCoverageAnalysis object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmCoverageAnalysis() *CsmCoverageAnalysis { + this := CsmCoverageAnalysis{} + return &this +} + +// NewCsmCoverageAnalysisWithDefaults instantiates a new CsmCoverageAnalysis object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmCoverageAnalysisWithDefaults() *CsmCoverageAnalysis { + this := CsmCoverageAnalysis{} + return &this +} + +// GetConfiguredResourcesCount returns the ConfiguredResourcesCount field value if set, zero value otherwise. +func (o *CsmCoverageAnalysis) GetConfiguredResourcesCount() int64 { + if o == nil || o.ConfiguredResourcesCount == nil { + var ret int64 + return ret + } + return *o.ConfiguredResourcesCount +} + +// GetConfiguredResourcesCountOk returns a tuple with the ConfiguredResourcesCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCoverageAnalysis) GetConfiguredResourcesCountOk() (*int64, bool) { + if o == nil || o.ConfiguredResourcesCount == nil { + return nil, false + } + return o.ConfiguredResourcesCount, true +} + +// HasConfiguredResourcesCount returns a boolean if a field has been set. +func (o *CsmCoverageAnalysis) HasConfiguredResourcesCount() bool { + return o != nil && o.ConfiguredResourcesCount != nil +} + +// SetConfiguredResourcesCount gets a reference to the given int64 and assigns it to the ConfiguredResourcesCount field. +func (o *CsmCoverageAnalysis) SetConfiguredResourcesCount(v int64) { + o.ConfiguredResourcesCount = &v +} + +// GetCoverage returns the Coverage field value if set, zero value otherwise. +func (o *CsmCoverageAnalysis) GetCoverage() float64 { + if o == nil || o.Coverage == nil { + var ret float64 + return ret + } + return *o.Coverage +} + +// GetCoverageOk returns a tuple with the Coverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCoverageAnalysis) GetCoverageOk() (*float64, bool) { + if o == nil || o.Coverage == nil { + return nil, false + } + return o.Coverage, true +} + +// HasCoverage returns a boolean if a field has been set. +func (o *CsmCoverageAnalysis) HasCoverage() bool { + return o != nil && o.Coverage != nil +} + +// SetCoverage gets a reference to the given float64 and assigns it to the Coverage field. +func (o *CsmCoverageAnalysis) SetCoverage(v float64) { + o.Coverage = &v +} + +// GetPartiallyConfiguredResourcesCount returns the PartiallyConfiguredResourcesCount field value if set, zero value otherwise. +func (o *CsmCoverageAnalysis) GetPartiallyConfiguredResourcesCount() int64 { + if o == nil || o.PartiallyConfiguredResourcesCount == nil { + var ret int64 + return ret + } + return *o.PartiallyConfiguredResourcesCount +} + +// GetPartiallyConfiguredResourcesCountOk returns a tuple with the PartiallyConfiguredResourcesCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCoverageAnalysis) GetPartiallyConfiguredResourcesCountOk() (*int64, bool) { + if o == nil || o.PartiallyConfiguredResourcesCount == nil { + return nil, false + } + return o.PartiallyConfiguredResourcesCount, true +} + +// HasPartiallyConfiguredResourcesCount returns a boolean if a field has been set. +func (o *CsmCoverageAnalysis) HasPartiallyConfiguredResourcesCount() bool { + return o != nil && o.PartiallyConfiguredResourcesCount != nil +} + +// SetPartiallyConfiguredResourcesCount gets a reference to the given int64 and assigns it to the PartiallyConfiguredResourcesCount field. +func (o *CsmCoverageAnalysis) SetPartiallyConfiguredResourcesCount(v int64) { + o.PartiallyConfiguredResourcesCount = &v +} + +// GetTotalResourcesCount returns the TotalResourcesCount field value if set, zero value otherwise. +func (o *CsmCoverageAnalysis) GetTotalResourcesCount() int64 { + if o == nil || o.TotalResourcesCount == nil { + var ret int64 + return ret + } + return *o.TotalResourcesCount +} + +// GetTotalResourcesCountOk returns a tuple with the TotalResourcesCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmCoverageAnalysis) GetTotalResourcesCountOk() (*int64, bool) { + if o == nil || o.TotalResourcesCount == nil { + return nil, false + } + return o.TotalResourcesCount, true +} + +// HasTotalResourcesCount returns a boolean if a field has been set. +func (o *CsmCoverageAnalysis) HasTotalResourcesCount() bool { + return o != nil && o.TotalResourcesCount != nil +} + +// SetTotalResourcesCount gets a reference to the given int64 and assigns it to the TotalResourcesCount field. +func (o *CsmCoverageAnalysis) SetTotalResourcesCount(v int64) { + o.TotalResourcesCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmCoverageAnalysis) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ConfiguredResourcesCount != nil { + toSerialize["configured_resources_count"] = o.ConfiguredResourcesCount + } + if o.Coverage != nil { + toSerialize["coverage"] = o.Coverage + } + if o.PartiallyConfiguredResourcesCount != nil { + toSerialize["partially_configured_resources_count"] = o.PartiallyConfiguredResourcesCount + } + if o.TotalResourcesCount != nil { + toSerialize["total_resources_count"] = o.TotalResourcesCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmCoverageAnalysis) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ConfiguredResourcesCount *int64 `json:"configured_resources_count,omitempty"` + Coverage *float64 `json:"coverage,omitempty"` + PartiallyConfiguredResourcesCount *int64 `json:"partially_configured_resources_count,omitempty"` + TotalResourcesCount *int64 `json:"total_resources_count,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{"configured_resources_count", "coverage", "partially_configured_resources_count", "total_resources_count"}) + } else { + return err + } + o.ConfiguredResourcesCount = all.ConfiguredResourcesCount + o.Coverage = all.Coverage + o.PartiallyConfiguredResourcesCount = all.PartiallyConfiguredResourcesCount + o.TotalResourcesCount = all.TotalResourcesCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_attributes.go b/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_attributes.go new file mode 100644 index 00000000000..83f0a63a0c6 --- /dev/null +++ b/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_attributes.go @@ -0,0 +1,260 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmHostsAndContainersCoverageAnalysisAttributes CSM Hosts and Containers Coverage Analysis attributes. +type CsmHostsAndContainersCoverageAnalysisAttributes struct { + // CSM Coverage Analysis. + CspmCoverage *CsmCoverageAnalysis `json:"cspm_coverage,omitempty"` + // CSM Coverage Analysis. + CwsCoverage *CsmCoverageAnalysis `json:"cws_coverage,omitempty"` + // The Organization ID. + OrgId *int64 `json:"org_id,omitempty"` + // CSM Coverage Analysis. + TotalCoverage *CsmCoverageAnalysis `json:"total_coverage,omitempty"` + // CSM Coverage Analysis. + VmCoverage *CsmCoverageAnalysis `json:"vm_coverage,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmHostsAndContainersCoverageAnalysisAttributes instantiates a new CsmHostsAndContainersCoverageAnalysisAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmHostsAndContainersCoverageAnalysisAttributes() *CsmHostsAndContainersCoverageAnalysisAttributes { + this := CsmHostsAndContainersCoverageAnalysisAttributes{} + return &this +} + +// NewCsmHostsAndContainersCoverageAnalysisAttributesWithDefaults instantiates a new CsmHostsAndContainersCoverageAnalysisAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmHostsAndContainersCoverageAnalysisAttributesWithDefaults() *CsmHostsAndContainersCoverageAnalysisAttributes { + this := CsmHostsAndContainersCoverageAnalysisAttributes{} + return &this +} + +// GetCspmCoverage returns the CspmCoverage field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetCspmCoverage() CsmCoverageAnalysis { + if o == nil || o.CspmCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.CspmCoverage +} + +// GetCspmCoverageOk returns a tuple with the CspmCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetCspmCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.CspmCoverage == nil { + return nil, false + } + return o.CspmCoverage, true +} + +// HasCspmCoverage returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) HasCspmCoverage() bool { + return o != nil && o.CspmCoverage != nil +} + +// SetCspmCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the CspmCoverage field. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) SetCspmCoverage(v CsmCoverageAnalysis) { + o.CspmCoverage = &v +} + +// GetCwsCoverage returns the CwsCoverage field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetCwsCoverage() CsmCoverageAnalysis { + if o == nil || o.CwsCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.CwsCoverage +} + +// GetCwsCoverageOk returns a tuple with the CwsCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetCwsCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.CwsCoverage == nil { + return nil, false + } + return o.CwsCoverage, true +} + +// HasCwsCoverage returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) HasCwsCoverage() bool { + return o != nil && o.CwsCoverage != nil +} + +// SetCwsCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the CwsCoverage field. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) SetCwsCoverage(v CsmCoverageAnalysis) { + o.CwsCoverage = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetTotalCoverage returns the TotalCoverage field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetTotalCoverage() CsmCoverageAnalysis { + if o == nil || o.TotalCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.TotalCoverage +} + +// GetTotalCoverageOk returns a tuple with the TotalCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetTotalCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.TotalCoverage == nil { + return nil, false + } + return o.TotalCoverage, true +} + +// HasTotalCoverage returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) HasTotalCoverage() bool { + return o != nil && o.TotalCoverage != nil +} + +// SetTotalCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the TotalCoverage field. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) SetTotalCoverage(v CsmCoverageAnalysis) { + o.TotalCoverage = &v +} + +// GetVmCoverage returns the VmCoverage field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetVmCoverage() CsmCoverageAnalysis { + if o == nil || o.VmCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.VmCoverage +} + +// GetVmCoverageOk returns a tuple with the VmCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) GetVmCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.VmCoverage == nil { + return nil, false + } + return o.VmCoverage, true +} + +// HasVmCoverage returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) HasVmCoverage() bool { + return o != nil && o.VmCoverage != nil +} + +// SetVmCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the VmCoverage field. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) SetVmCoverage(v CsmCoverageAnalysis) { + o.VmCoverage = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmHostsAndContainersCoverageAnalysisAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CspmCoverage != nil { + toSerialize["cspm_coverage"] = o.CspmCoverage + } + if o.CwsCoverage != nil { + toSerialize["cws_coverage"] = o.CwsCoverage + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.TotalCoverage != nil { + toSerialize["total_coverage"] = o.TotalCoverage + } + if o.VmCoverage != nil { + toSerialize["vm_coverage"] = o.VmCoverage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmHostsAndContainersCoverageAnalysisAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CspmCoverage *CsmCoverageAnalysis `json:"cspm_coverage,omitempty"` + CwsCoverage *CsmCoverageAnalysis `json:"cws_coverage,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + TotalCoverage *CsmCoverageAnalysis `json:"total_coverage,omitempty"` + VmCoverage *CsmCoverageAnalysis `json:"vm_coverage,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{"cspm_coverage", "cws_coverage", "org_id", "total_coverage", "vm_coverage"}) + } else { + return err + } + + hasInvalidField := false + if all.CspmCoverage != nil && all.CspmCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CspmCoverage = all.CspmCoverage + if all.CwsCoverage != nil && all.CwsCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CwsCoverage = all.CwsCoverage + o.OrgId = all.OrgId + if all.TotalCoverage != nil && all.TotalCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TotalCoverage = all.TotalCoverage + if all.VmCoverage != nil && all.VmCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.VmCoverage = all.VmCoverage + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_data.go b/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_data.go new file mode 100644 index 00000000000..cf674b465eb --- /dev/null +++ b/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_data.go @@ -0,0 +1,185 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmHostsAndContainersCoverageAnalysisData CSM Hosts and Containers Coverage Analysis data. +type CsmHostsAndContainersCoverageAnalysisData struct { + // CSM Hosts and Containers Coverage Analysis attributes. + Attributes *CsmHostsAndContainersCoverageAnalysisAttributes `json:"attributes,omitempty"` + // The ID of your organization. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be `get_hosts_and_containers_coverage_analysis_response_public_v0`. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmHostsAndContainersCoverageAnalysisData instantiates a new CsmHostsAndContainersCoverageAnalysisData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmHostsAndContainersCoverageAnalysisData() *CsmHostsAndContainersCoverageAnalysisData { + this := CsmHostsAndContainersCoverageAnalysisData{} + var typeVar string = "get_hosts_and_containers_coverage_analysis_response_public_v0" + this.Type = &typeVar + return &this +} + +// NewCsmHostsAndContainersCoverageAnalysisDataWithDefaults instantiates a new CsmHostsAndContainersCoverageAnalysisData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmHostsAndContainersCoverageAnalysisDataWithDefaults() *CsmHostsAndContainersCoverageAnalysisData { + this := CsmHostsAndContainersCoverageAnalysisData{} + var typeVar string = "get_hosts_and_containers_coverage_analysis_response_public_v0" + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisData) GetAttributes() CsmHostsAndContainersCoverageAnalysisAttributes { + if o == nil || o.Attributes == nil { + var ret CsmHostsAndContainersCoverageAnalysisAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisData) GetAttributesOk() (*CsmHostsAndContainersCoverageAnalysisAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CsmHostsAndContainersCoverageAnalysisAttributes and assigns it to the Attributes field. +func (o *CsmHostsAndContainersCoverageAnalysisData) SetAttributes(v CsmHostsAndContainersCoverageAnalysisAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CsmHostsAndContainersCoverageAnalysisData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CsmHostsAndContainersCoverageAnalysisData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmHostsAndContainersCoverageAnalysisData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmHostsAndContainersCoverageAnalysisData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CsmHostsAndContainersCoverageAnalysisAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_response.go b/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_response.go new file mode 100644 index 00000000000..1b92fa167ab --- /dev/null +++ b/api/datadogV2/model_csm_hosts_and_containers_coverage_analysis_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmHostsAndContainersCoverageAnalysisResponse CSM Hosts and Containers Coverage Analysis response. +type CsmHostsAndContainersCoverageAnalysisResponse struct { + // CSM Hosts and Containers Coverage Analysis data. + Data *CsmHostsAndContainersCoverageAnalysisData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmHostsAndContainersCoverageAnalysisResponse instantiates a new CsmHostsAndContainersCoverageAnalysisResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmHostsAndContainersCoverageAnalysisResponse() *CsmHostsAndContainersCoverageAnalysisResponse { + this := CsmHostsAndContainersCoverageAnalysisResponse{} + return &this +} + +// NewCsmHostsAndContainersCoverageAnalysisResponseWithDefaults instantiates a new CsmHostsAndContainersCoverageAnalysisResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmHostsAndContainersCoverageAnalysisResponseWithDefaults() *CsmHostsAndContainersCoverageAnalysisResponse { + this := CsmHostsAndContainersCoverageAnalysisResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CsmHostsAndContainersCoverageAnalysisResponse) GetData() CsmHostsAndContainersCoverageAnalysisData { + if o == nil || o.Data == nil { + var ret CsmHostsAndContainersCoverageAnalysisData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmHostsAndContainersCoverageAnalysisResponse) GetDataOk() (*CsmHostsAndContainersCoverageAnalysisData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CsmHostsAndContainersCoverageAnalysisResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CsmHostsAndContainersCoverageAnalysisData and assigns it to the Data field. +func (o *CsmHostsAndContainersCoverageAnalysisResponse) SetData(v CsmHostsAndContainersCoverageAnalysisData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmHostsAndContainersCoverageAnalysisResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmHostsAndContainersCoverageAnalysisResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CsmHostsAndContainersCoverageAnalysisData `json:"data,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{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_serverless_coverage_analysis_attributes.go b/api/datadogV2/model_csm_serverless_coverage_analysis_attributes.go new file mode 100644 index 00000000000..8d297168a57 --- /dev/null +++ b/api/datadogV2/model_csm_serverless_coverage_analysis_attributes.go @@ -0,0 +1,184 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmServerlessCoverageAnalysisAttributes CSM Serverless Resources Coverage Analysis attributes. +type CsmServerlessCoverageAnalysisAttributes struct { + // CSM Coverage Analysis. + CwsCoverage *CsmCoverageAnalysis `json:"cws_coverage,omitempty"` + // The Organization ID. + OrgId *int64 `json:"org_id,omitempty"` + // CSM Coverage Analysis. + TotalCoverage *CsmCoverageAnalysis `json:"total_coverage,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmServerlessCoverageAnalysisAttributes instantiates a new CsmServerlessCoverageAnalysisAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmServerlessCoverageAnalysisAttributes() *CsmServerlessCoverageAnalysisAttributes { + this := CsmServerlessCoverageAnalysisAttributes{} + return &this +} + +// NewCsmServerlessCoverageAnalysisAttributesWithDefaults instantiates a new CsmServerlessCoverageAnalysisAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmServerlessCoverageAnalysisAttributesWithDefaults() *CsmServerlessCoverageAnalysisAttributes { + this := CsmServerlessCoverageAnalysisAttributes{} + return &this +} + +// GetCwsCoverage returns the CwsCoverage field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisAttributes) GetCwsCoverage() CsmCoverageAnalysis { + if o == nil || o.CwsCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.CwsCoverage +} + +// GetCwsCoverageOk returns a tuple with the CwsCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisAttributes) GetCwsCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.CwsCoverage == nil { + return nil, false + } + return o.CwsCoverage, true +} + +// HasCwsCoverage returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisAttributes) HasCwsCoverage() bool { + return o != nil && o.CwsCoverage != nil +} + +// SetCwsCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the CwsCoverage field. +func (o *CsmServerlessCoverageAnalysisAttributes) SetCwsCoverage(v CsmCoverageAnalysis) { + o.CwsCoverage = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisAttributes) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *CsmServerlessCoverageAnalysisAttributes) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetTotalCoverage returns the TotalCoverage field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisAttributes) GetTotalCoverage() CsmCoverageAnalysis { + if o == nil || o.TotalCoverage == nil { + var ret CsmCoverageAnalysis + return ret + } + return *o.TotalCoverage +} + +// GetTotalCoverageOk returns a tuple with the TotalCoverage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisAttributes) GetTotalCoverageOk() (*CsmCoverageAnalysis, bool) { + if o == nil || o.TotalCoverage == nil { + return nil, false + } + return o.TotalCoverage, true +} + +// HasTotalCoverage returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisAttributes) HasTotalCoverage() bool { + return o != nil && o.TotalCoverage != nil +} + +// SetTotalCoverage gets a reference to the given CsmCoverageAnalysis and assigns it to the TotalCoverage field. +func (o *CsmServerlessCoverageAnalysisAttributes) SetTotalCoverage(v CsmCoverageAnalysis) { + o.TotalCoverage = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmServerlessCoverageAnalysisAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CwsCoverage != nil { + toSerialize["cws_coverage"] = o.CwsCoverage + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.TotalCoverage != nil { + toSerialize["total_coverage"] = o.TotalCoverage + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmServerlessCoverageAnalysisAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CwsCoverage *CsmCoverageAnalysis `json:"cws_coverage,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + TotalCoverage *CsmCoverageAnalysis `json:"total_coverage,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{"cws_coverage", "org_id", "total_coverage"}) + } else { + return err + } + + hasInvalidField := false + if all.CwsCoverage != nil && all.CwsCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CwsCoverage = all.CwsCoverage + o.OrgId = all.OrgId + if all.TotalCoverage != nil && all.TotalCoverage.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TotalCoverage = all.TotalCoverage + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_serverless_coverage_analysis_data.go b/api/datadogV2/model_csm_serverless_coverage_analysis_data.go new file mode 100644 index 00000000000..8ba132b7e82 --- /dev/null +++ b/api/datadogV2/model_csm_serverless_coverage_analysis_data.go @@ -0,0 +1,185 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmServerlessCoverageAnalysisData CSM Serverless Resources Coverage Analysis data. +type CsmServerlessCoverageAnalysisData struct { + // CSM Serverless Resources Coverage Analysis attributes. + Attributes *CsmServerlessCoverageAnalysisAttributes `json:"attributes,omitempty"` + // The ID of your organization. + Id *string `json:"id,omitempty"` + // The type of the resource. The value should always be `get_serverless_coverage_analysis_response_public_v0`. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmServerlessCoverageAnalysisData instantiates a new CsmServerlessCoverageAnalysisData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmServerlessCoverageAnalysisData() *CsmServerlessCoverageAnalysisData { + this := CsmServerlessCoverageAnalysisData{} + var typeVar string = "get_serverless_coverage_analysis_response_public_v0" + this.Type = &typeVar + return &this +} + +// NewCsmServerlessCoverageAnalysisDataWithDefaults instantiates a new CsmServerlessCoverageAnalysisData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmServerlessCoverageAnalysisDataWithDefaults() *CsmServerlessCoverageAnalysisData { + this := CsmServerlessCoverageAnalysisData{} + var typeVar string = "get_serverless_coverage_analysis_response_public_v0" + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisData) GetAttributes() CsmServerlessCoverageAnalysisAttributes { + if o == nil || o.Attributes == nil { + var ret CsmServerlessCoverageAnalysisAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisData) GetAttributesOk() (*CsmServerlessCoverageAnalysisAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CsmServerlessCoverageAnalysisAttributes and assigns it to the Attributes field. +func (o *CsmServerlessCoverageAnalysisData) SetAttributes(v CsmServerlessCoverageAnalysisAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CsmServerlessCoverageAnalysisData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CsmServerlessCoverageAnalysisData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmServerlessCoverageAnalysisData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmServerlessCoverageAnalysisData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CsmServerlessCoverageAnalysisAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_csm_serverless_coverage_analysis_response.go b/api/datadogV2/model_csm_serverless_coverage_analysis_response.go new file mode 100644 index 00000000000..1a9e4689aac --- /dev/null +++ b/api/datadogV2/model_csm_serverless_coverage_analysis_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CsmServerlessCoverageAnalysisResponse CSM Serverless Resources Coverage Analysis response. +type CsmServerlessCoverageAnalysisResponse struct { + // CSM Serverless Resources Coverage Analysis data. + Data *CsmServerlessCoverageAnalysisData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCsmServerlessCoverageAnalysisResponse instantiates a new CsmServerlessCoverageAnalysisResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCsmServerlessCoverageAnalysisResponse() *CsmServerlessCoverageAnalysisResponse { + this := CsmServerlessCoverageAnalysisResponse{} + return &this +} + +// NewCsmServerlessCoverageAnalysisResponseWithDefaults instantiates a new CsmServerlessCoverageAnalysisResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCsmServerlessCoverageAnalysisResponseWithDefaults() *CsmServerlessCoverageAnalysisResponse { + this := CsmServerlessCoverageAnalysisResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CsmServerlessCoverageAnalysisResponse) GetData() CsmServerlessCoverageAnalysisData { + if o == nil || o.Data == nil { + var ret CsmServerlessCoverageAnalysisData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CsmServerlessCoverageAnalysisResponse) GetDataOk() (*CsmServerlessCoverageAnalysisData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CsmServerlessCoverageAnalysisResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CsmServerlessCoverageAnalysisData and assigns it to the Data field. +func (o *CsmServerlessCoverageAnalysisResponse) SetData(v CsmServerlessCoverageAnalysisData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CsmServerlessCoverageAnalysisResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CsmServerlessCoverageAnalysisResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CsmServerlessCoverageAnalysisData `json:"data,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{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/examples/v2/csm-coverage-analysis/GetCSMCloudAccountsCoverageAnalysis.go b/examples/v2/csm-coverage-analysis/GetCSMCloudAccountsCoverageAnalysis.go new file mode 100644 index 00000000000..7735afd603a --- /dev/null +++ b/examples/v2/csm-coverage-analysis/GetCSMCloudAccountsCoverageAnalysis.go @@ -0,0 +1,29 @@ +// Get the CSM Cloud Accounts Coverage Analysis returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCSMCoverageAnalysisApi(apiClient) + resp, r, err := api.GetCSMCloudAccountsCoverageAnalysis(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CSMCoverageAnalysisApi.GetCSMCloudAccountsCoverageAnalysis`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CSMCoverageAnalysisApi.GetCSMCloudAccountsCoverageAnalysis`:\n%s\n", responseContent) +} diff --git a/examples/v2/csm-coverage-analysis/GetCSMHostsAndContainersCoverageAnalysis.go b/examples/v2/csm-coverage-analysis/GetCSMHostsAndContainersCoverageAnalysis.go new file mode 100644 index 00000000000..8e91945c837 --- /dev/null +++ b/examples/v2/csm-coverage-analysis/GetCSMHostsAndContainersCoverageAnalysis.go @@ -0,0 +1,29 @@ +// Get the CSM Hosts and Containers Coverage Analysis returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCSMCoverageAnalysisApi(apiClient) + resp, r, err := api.GetCSMHostsAndContainersCoverageAnalysis(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CSMCoverageAnalysisApi.GetCSMHostsAndContainersCoverageAnalysis`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CSMCoverageAnalysisApi.GetCSMHostsAndContainersCoverageAnalysis`:\n%s\n", responseContent) +} diff --git a/examples/v2/csm-coverage-analysis/GetCSMServerlessCoverageAnalysis.go b/examples/v2/csm-coverage-analysis/GetCSMServerlessCoverageAnalysis.go new file mode 100644 index 00000000000..026bde48724 --- /dev/null +++ b/examples/v2/csm-coverage-analysis/GetCSMServerlessCoverageAnalysis.go @@ -0,0 +1,29 @@ +// Get the CSM Serverless Coverage Analysis returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCSMCoverageAnalysisApi(apiClient) + resp, r, err := api.GetCSMServerlessCoverageAnalysis(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CSMCoverageAnalysisApi.GetCSMServerlessCoverageAnalysis`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CSMCoverageAnalysisApi.GetCSMServerlessCoverageAnalysis`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index ed9068dad14..15703702267 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -61,6 +61,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "CloudCostManagementApi": reflect.ValueOf(datadogV2.NewCloudCostManagementApi), "UsageMeteringApi": reflect.ValueOf(datadogV2.NewUsageMeteringApi), "CSMAgentsApi": reflect.ValueOf(datadogV2.NewCSMAgentsApi), + "CSMCoverageAnalysisApi": reflect.ValueOf(datadogV2.NewCSMCoverageAnalysisApi), "DashboardListsApi": reflect.ValueOf(datadogV2.NewDashboardListsApi), "DataDeletionApi": reflect.ValueOf(datadogV2.NewDataDeletionApi), "DomainAllowlistApi": reflect.ValueOf(datadogV2.NewDomainAllowlistApi), diff --git a/tests/scenarios/features/v2/csm_coverage_analysis.feature b/tests/scenarios/features/v2/csm_coverage_analysis.feature new file mode 100644 index 00000000000..dd79c8ab101 --- /dev/null +++ b/tests/scenarios/features/v2/csm_coverage_analysis.feature @@ -0,0 +1,31 @@ +@endpoint(csm-coverage-analysis) @endpoint(csm-coverage-analysis-v2) +Feature: CSM Coverage Analysis + Datadog Cloud Security Management (CSM) delivers real-time threat + detection and continuous configuration audits across your entire cloud + infrastructure, all in a unified view for seamless collaboration and + faster remediation. Go to + https://docs.datadoghq.com/security/cloud_security_management to learn + more + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "CSMCoverageAnalysis" API + + @team:DataDog/k9-cloud-security-platform + Scenario: Get the CSM Cloud Accounts Coverage Analysis returns "OK" response + Given new "GetCSMCloudAccountsCoverageAnalysis" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/k9-cloud-security-platform + Scenario: Get the CSM Hosts and Containers Coverage Analysis returns "OK" response + Given new "GetCSMHostsAndContainersCoverageAnalysis" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/k9-cloud-security-platform + Scenario: Get the CSM Serverless Coverage Analysis returns "OK" response + Given new "GetCSMServerlessCoverageAnalysis" request + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index b1ed2db693d..de5bae7429e 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -535,6 +535,24 @@ "type": "safe" } }, + "GetCSMCloudAccountsCoverageAnalysis": { + "tag": "CSM Coverage Analysis", + "undo": { + "type": "safe" + } + }, + "GetCSMHostsAndContainersCoverageAnalysis": { + "tag": "CSM Coverage Analysis", + "undo": { + "type": "safe" + } + }, + "GetCSMServerlessCoverageAnalysis": { + "tag": "CSM Coverage Analysis", + "undo": { + "type": "safe" + } + }, "ListAllCSMServerlessAgents": { "tag": "CSM Agents", "undo": {