diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 840ac4eef97..d57aebc821a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -14989,6 +14989,185 @@ components: type: string x-enum-varnames: - REFERENCE_TABLE + CreateTenancyConfigData: + properties: + attributes: + $ref: '#/components/schemas/CreateTenancyConfigDataAttributes' + id: + example: '' + type: string + type: + $ref: '#/components/schemas/UpdateTenancyConfigDataType' + required: + - type + - id + type: object + CreateTenancyConfigDataAttributes: + properties: + auth_credentials: + $ref: '#/components/schemas/CreateTenancyConfigDataAttributesAuthCredentials' + config_version: + format: int64 + nullable: true + type: integer + cost_collection_enabled: + type: boolean + dd_compartment_id: + type: string + dd_stack_id: + type: string + home_region: + example: '' + type: string + logs_config: + $ref: '#/components/schemas/CreateTenancyConfigDataAttributesLogsConfig' + metrics_config: + $ref: '#/components/schemas/CreateTenancyConfigDataAttributesMetricsConfig' + regions_config: + $ref: '#/components/schemas/CreateTenancyConfigDataAttributesRegionsConfig' + resource_collection_enabled: + type: boolean + user_ocid: + example: '' + type: string + required: + - auth_credentials + - home_region + - user_ocid + type: object + CreateTenancyConfigDataAttributesAuthCredentials: + properties: + fingerprint: + type: string + private_key: + example: '' + type: string + required: + - private_key + type: object + CreateTenancyConfigDataAttributesLogsConfig: + properties: + compartment_tag_filters: + items: + type: string + type: array + enabled: + type: boolean + enabled_services: + items: + type: string + type: array + type: object + CreateTenancyConfigDataAttributesMetricsConfig: + properties: + compartment_tag_filters: + items: + type: string + type: array + enabled: + type: boolean + excluded_services: + items: + type: string + type: array + type: object + CreateTenancyConfigDataAttributesRegionsConfig: + properties: + available: + items: + type: string + type: array + disabled: + items: + type: string + type: array + enabled: + items: + type: string + type: array + type: object + CreateTenancyConfigRequest: + example: + data: + attributes: + auth_credentials: + fingerprint: '' + private_key: '----BEGIN PRIVATE KEY----- + + MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdvSMmlfLyeD4M + + QsA3WlrWBqKdWa5eVV3/uODyqT3wWMEMIJHcG3/quNs8nh9xrK1/JkQT2qoKEHqR + + C5k59jN6Vp8em8ARJthMgam9K37ELt+IQ/G8ySTSuqZG8T4cHp/cs3fAclNqttOl + + YnGr4RbVAgMBAAECggEAGZNLGbyCUbIRTW6Kh4d8ZVC+eZtJMqGmGJ3KfVaW8Pjn + + QGWfSuJCEe2o2Y8G3phlidFauICnZ44enXA17Rhi+I/whnr7FIyQk2bR7rv+1Uhc + + mOJygWX5eFFMsledgVAdIAl9Luk2nykx7Un3g6rtbl/Vs+5k4m7ITLFMpCHzsJLU + + nm8kBzDOqY2JUkMd08nL88KL6QywWtal05UESzQpNFXd0e5kxYfexeMCsLsWP0mc + + quMLRbn7NuBjCbe9VU2kmIvcfDDaWjurT7d5m1OXx1cc8p6P4PFZTVyCjdhiWOr3 + + LQXZ4/vdZNR3zgEHypRoM6D9Yq99LWUOUEMrdiSLQQKBgQDQkh7C1OtAXnpy7F6R + + W+/I3zBHici2p7A57UT7VECQ1IVGg37/uus83DkuOtdZ33JmHLAVrwLFJvUlbyjx + + l6dc/1ms40L5HFdLgaVtd4k0rSPFeOSDr6evz0lX4yBuzlP0fEh+o3XHW7mwe2G+ + + rWCULF/Uqza66fjbCSKMNgLIXQKBgQDBm9nZg/s4S0THWCFNWcB1tXBG0p/sH5eY + + PC1H/VmTEINIixStrS4ufczf31X8rcoSjSbO7+vZDTTATdk7OLn1I2uGFVYl8M59 + + 86BYT2Hi7cwp7YVzOc/cJigVeBAqSRW/iYYyWBEUTiW1gbkV0sRWwhPp67m+c0sP + + XpY/iEZA2QKBgB1w8tynt4l/jKNaUEMOijt9ndALWATIiOy0XG9pxi9rgGCiwTOS + + DBCsOXoYHjv2eayGUijNaoOv6xzcoxfvQ1WySdNIxTRq1ru20kYwgHKqGgmO9hrM + + mcwMY5r/WZ2qjFlPjeAqbL62aPDLidGjoaVo2iIoBPK/gjxQ/5f0MS4N/YQ0zWoYBueSQ0DGs + + -----END PRIVATE KEY-----' + config_version: null + cost_collection_enabled: true + dd_compartment_id: ocid.compartment.test + dd_stack_id: ocid.stack.test + home_region: us-ashburn-1 + logs_config: + compartment_tag_filters: + - datadog:true + - env:prod + enabled: true + enabled_services: + - service_1 + - service_1 + metrics_config: + compartment_tag_filters: + - datadog:true + - env:prod + enabled: true + excluded_services: + - service_1 + - service_1 + regions_config: + available: + - us-ashburn-1 + - us-phoenix-1 + disabled: + - us-phoenix-1 + enabled: + - us-ashburn-1 + resource_collection_enabled: true + user_ocid: ocid.user.test + id: ocid.tenancy.test + type: oci_tenancy + properties: + data: + $ref: '#/components/schemas/CreateTenancyConfigData' + required: + - data + type: object CreateUploadRequest: description: Request to create an upload for a file to be ingested into a reference table. @@ -62752,6 +62931,219 @@ components: description: Offset type. type: string type: object + TenancyConfig: + example: + data: + attributes: + config_version: 2 + cost_collection_enabled: true + dd_compartment_id: ocid.compartment.test + dd_stack_id: ocid.stack.test + home_region: us-ashburn-1 + logs_config: + compartment_tag_filters: + - compartment.test + enabled: true + enabled_services: + - compute + metrics_config: + compartment_tag_filters: + - compartment.test + enabled: true + excluded_services: + - compute + regions_config: + available: + - us-ashburn-1 + - us-phoenix-1 + disabled: + - us-phoenix-1 + enabled: + - us-ashburn-1 + resource_collection_enabled: true + user_ocid: ocid.user.test + id: ocid.tenancy.test + type: oci_tenancy + properties: + data: + $ref: '#/components/schemas/TenancyConfigData' + type: object + TenancyConfigData: + properties: + attributes: + $ref: '#/components/schemas/TenancyConfigDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/UpdateTenancyConfigDataType' + required: + - type + type: object + TenancyConfigDataAttributes: + properties: + billing_plan_id: + format: int32 + maximum: 2147483647 + type: integer + config_version: + format: int64 + type: integer + cost_collection_enabled: + type: boolean + dd_compartment_id: + type: string + dd_stack_id: + type: string + home_region: + type: string + logs_config: + $ref: '#/components/schemas/TenancyConfigDataAttributesLogsConfig' + metrics_config: + $ref: '#/components/schemas/TenancyConfigDataAttributesMetricsConfig' + parent_tenancy_name: + type: string + regions_config: + $ref: '#/components/schemas/TenancyConfigDataAttributesRegionsConfig' + resource_collection_enabled: + type: boolean + tenancy_name: + type: string + user_ocid: + type: string + type: object + TenancyConfigDataAttributesLogsConfig: + properties: + compartment_tag_filters: + items: + type: string + type: array + enabled: + type: boolean + enabled_services: + items: + type: string + type: array + type: object + TenancyConfigDataAttributesMetricsConfig: + properties: + compartment_tag_filters: + items: + type: string + type: array + enabled: + type: boolean + excluded_services: + items: + type: string + type: array + type: object + TenancyConfigDataAttributesRegionsConfig: + properties: + available: + items: + type: string + type: array + disabled: + items: + type: string + type: array + enabled: + items: + type: string + type: array + type: object + TenancyConfigList: + example: + data: + - attributes: + config_version: 2 + cost_collection_enabled: true + dd_compartment_id: ocid.compartment.test + dd_stack_id: ocid.stack.test + home_region: us-ashburn-1 + logs_config: + compartment_tag_filters: + - compartment.test + enabled: true + enabled_services: + - compute + metrics_config: + compartment_tag_filters: + - compartment.test + enabled: true + excluded_services: + - compute + regions_config: + available: + - us-ashburn-1 + - us-phoenix-1 + disabled: + - us-phoenix-1 + enabled: + - us-ashburn-1 + resource_collection_enabled: true + user_ocid: ocid.user.test + id: ocid.tenancy.test + type: oci_tenancy + properties: + data: + items: + $ref: '#/components/schemas/TenancyConfigData' + type: array + required: + - data + type: object + TenancyProductsData: + properties: + attributes: + $ref: '#/components/schemas/TenancyProductsDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/TenancyProductsDataType' + required: + - type + type: object + TenancyProductsDataAttributes: + properties: + products: + items: + $ref: '#/components/schemas/TenancyProductsDataAttributesProductsItems' + type: array + type: object + TenancyProductsDataAttributesProductsItems: + properties: + enabled: + type: boolean + product_key: + type: string + type: object + TenancyProductsDataType: + default: oci_tenancy_product + description: OCI tenancy product resource type. + enum: + - oci_tenancy_product + example: oci_tenancy_product + type: string + x-enum-varnames: + - OCI_TENANCY_PRODUCT + TenancyProductsList: + example: + data: + - attributes: + products: + - enabled: true + product_key: CLOUD_SECURITY_POSTURE_MANAGEMENT + id: ocid.tenancy.test + type: oci_tenancy_product + properties: + data: + items: + $ref: '#/components/schemas/TenancyProductsData' + type: array + required: + - data + type: object ThreatHuntingJobDataType: description: Type of payload. enum: @@ -64438,6 +64830,177 @@ components: type: string x-enum-varnames: - UPDATE_RULESET + UpdateTenancyConfigData: + properties: + attributes: + $ref: '#/components/schemas/UpdateTenancyConfigDataAttributes' + id: + example: '' + type: string + type: + $ref: '#/components/schemas/UpdateTenancyConfigDataType' + required: + - type + - id + type: object + UpdateTenancyConfigDataAttributes: + properties: + auth_credentials: + $ref: '#/components/schemas/UpdateTenancyConfigDataAttributesAuthCredentials' + cost_collection_enabled: + type: boolean + home_region: + type: string + logs_config: + $ref: '#/components/schemas/UpdateTenancyConfigDataAttributesLogsConfig' + metrics_config: + $ref: '#/components/schemas/UpdateTenancyConfigDataAttributesMetricsConfig' + regions_config: + $ref: '#/components/schemas/UpdateTenancyConfigDataAttributesRegionsConfig' + resource_collection_enabled: + type: boolean + user_ocid: + type: string + type: object + UpdateTenancyConfigDataAttributesAuthCredentials: + properties: + fingerprint: + type: string + private_key: + example: '' + type: string + required: + - private_key + type: object + UpdateTenancyConfigDataAttributesLogsConfig: + properties: + compartment_tag_filters: + items: + type: string + type: array + enabled: + type: boolean + enabled_services: + items: + type: string + type: array + type: object + UpdateTenancyConfigDataAttributesMetricsConfig: + properties: + compartment_tag_filters: + items: + type: string + type: array + enabled: + type: boolean + excluded_services: + items: + type: string + type: array + type: object + UpdateTenancyConfigDataAttributesRegionsConfig: + properties: + available: + items: + type: string + type: array + disabled: + items: + type: string + type: array + enabled: + items: + type: string + type: array + type: object + UpdateTenancyConfigDataType: + default: oci_tenancy + description: OCI tenancy resource type. + enum: + - oci_tenancy + example: oci_tenancy + type: string + x-enum-varnames: + - OCI_TENANCY + UpdateTenancyConfigRequest: + example: + data: + attributes: + auth_credentials: + fingerprint: '' + private_key: '----BEGIN PRIVATE KEY----- + + MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdvSMmlfLyeD4M + + QsA3WlrWBqKdWa5eVV3/uODyqT3wWMEMIJHcG3/quNs8nh9xrK1/JkQT2qoKEHqR + + C5k59jN6Vp8em8ARJthMgam9K37ELt+IQ/G8ySTSuqZG8T4cHp/cs3fAclNqttOl + + YnGr4RbVAgMBAAECggEAGZNLGbyCUbIRTW6Kh4d8ZVC+eZtJMqGmGJ3KfVaW8Pjn + + QGWfSuJCEe2o2Y8G3phlidFauICnZ44enXA17Rhi+I/whnr7FIyQk2bR7rv+1Uhc + + mOJygWX5eFFMsledgVAdIAl9Luk2nykx7Un3g6rtbl/Vs+5k4m7ITLFMpCHzsJLU + + nm8kBzDOqY2JUkMd08nL88KL6QywWtal05UESzQpNFXd0e5kxYfexeMCsLsWP0mc + + quMLRbn7NuBjCbe9VU2kmIvcfDDaWjurT7d5m1OXx1cc8p6P4PFZTVyCjdhiWOr3 + + LQXZ4/vdZNR3zgEHypRoM6D9Yq99LWUOUEMrdiSLQQKBgQDQkh7C1OtAXnpy7F6R + + W+/I3zBHici2p7A57UT7VECQ1IVGg37/uus83DkuOtdZ33JmHLAVrwLFJvUlbyjx + + l6dc/1ms40L5HFdLgaVtd4k0rSPFeOSDr6evz0lX4yBuzlP0fEh+o3XHW7mwe2G+ + + rWCULF/Uqza66fjbCSKMNgLIXQKBgQDBm9nZg/s4S0THWCFNWcB1tXBG0p/sH5eY + + PC1H/VmTEINIixStrS4ufczf31X8rcoSjSbO7+vZDTTATdk7OLn1I2uGFVYl8M59 + + 86BYT2Hi7cwp7YVzOc/cJigVeBAqSRW/iYYyWBEUTiW1gbkV0sRWwhPp67m+c0sP + + XpY/iEZA2QKBgB1w8tynt4l/jKNaUEMOijt9ndALWATIiOy0XG9pxi9rgGCiwTOS + + DBCsOXoYHjv2eayGUijNaoOv6xzcoxfvQ1WySdNIxTRq1ru20kYwgHKqGgmO9hrM + + mcwMY5r/WZ2qjFlPjeAqbL62aPDLidGjoaVo2iIoBPK/gjxQ/5f0MS4N/YQ0zWoYBueSQ0DGs + + -----END PRIVATE KEY-----' + cost_collection_enabled: true + home_region: us-ashburn-1 + logs_config: + compartment_tag_filters: + - datadog:true + - env:prod + enabled: true + enabled_services: + - service_1 + - service_1 + metrics_config: + compartment_tag_filters: + - datadog:true + - env:prod + enabled: true + excluded_services: + - service_1 + - service_1 + regions_config: + available: + - us-ashburn-1 + - us-phoenix-1 + disabled: + - us-phoenix-1 + enabled: + - us-ashburn-1 + resource_collection_enabled: true + user_ocid: ocid.user.test + id: ocid.tenancy.test + type: oci_tenancy + properties: + data: + $ref: '#/components/schemas/UpdateTenancyConfigData' + required: + - data + type: object UpdateWorkflowRequest: description: A request object for updating an existing workflow. example: @@ -77857,7 +78420,16 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/{incident_id}/attachments/postmortems: post: - description: Create a postmortem attachment for an incident. + description: 'Create a postmortem attachment for an incident. + + + The endpoint accepts markdown for notebooks created in Confluence or Google + Docs. + + Postmortems created from notebooks need to be formatted using frontend notebook + cells, + + in addition to markdown format.' operationId: CreateIncidentPostmortemAttachment parameters: - description: The ID of the incident @@ -79518,6 +80090,170 @@ paths: tags: - Microsoft Teams Integration x-codegen-request-body-name: body + /api/v2/integration/oci/products: + get: + description: Lists the products for a given tenancy. Returns the enabled/disabled + status of Datadog products (such as Cloud Security Posture Management) for + specific OCI tenancies. + operationId: ListTenancyProducts + parameters: + - description: Comma-separated list of product keys to filter by. + in: query + name: productKeys + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TenancyProductsList' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List tenancy products + tags: + - OCI Integration + /api/v2/integration/oci/tenancies: + get: + description: Get a list of all configured OCI tenancy integrations. Returns + basic information about each tenancy including authentication credentials, + region settings, and collection preferences for metrics, logs, and resources. + operationId: GetTenancyConfigs + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TenancyConfigList' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get tenancy configs + tags: + - OCI Integration + x-unstable: '**Note**: This endpoint may be subject to changes.' + post: + description: 'Create a new tenancy config to establish monitoring and data collection + from your OCI environment. Requires OCI authentication credentials and tenancy + details. Warning: Datadog recommends interacting with this endpoint only through + the Datadog web UI to ensure all necessary OCI resources have been created + and configured properly.' + operationId: CreateTenancyConfig + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateTenancyConfigRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TenancyConfig' + description: Created + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create tenancy config + tags: + - OCI Integration + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/integration/oci/tenancies/{tenancy_ocid}: + delete: + description: Delete an existing tenancy config. This will stop all data collection + from the specified OCI tenancy and remove the stored configuration. This operation + cannot be undone. + operationId: DeleteTenancyConfig + parameters: + - description: The OCID of the tenancy config to delete. + in: path + name: tenancy_ocid + required: true + schema: + type: string + responses: + '204': + description: No Content + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete tenancy config + tags: + - OCI Integration + get: + description: Get a single tenancy config object by its OCID. Returns detailed + configuration including authentication credentials, enabled services, region + settings, and collection preferences. + operationId: GetTenancyConfig + parameters: + - description: The OCID of the tenancy config to retrieve. + in: path + name: tenancy_ocid + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TenancyConfig' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get tenancy config + tags: + - OCI Integration + patch: + description: 'Update an existing tenancy config. You can modify authentication + credentials, enable/disable collection types, update service filters, and + change region settings. Warning: We recommend using the Datadog web UI to + avoid unintended update effects.' + operationId: UpdateTenancyConfig + parameters: + - description: The OCID of the tenancy config to update. + in: path + name: tenancy_ocid + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateTenancyConfigRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TenancyConfig' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update tenancy config + tags: + - OCI Integration /api/v2/integration/opsgenie/services: get: description: Get a list of all services from the Datadog Opsgenie integration. @@ -101674,6 +102410,8 @@ tags: and their attributes. See the [Network Device Monitoring page](https://docs.datadoghq.com/network_monitoring/) for more information. name: Network Device Monitoring +- description: Auto-generated tag OCI Integration + name: OCI Integration - description: Observability Pipelines allows you to collect and process logs within your own infrastructure, and then route them to downstream integrations. externalDocs: diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index f759a0dda3e..ebf14cfcc2a 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -759,6 +759,8 @@ func NewConfiguration() *Configuration { "v2.ListJiraAccounts": false, "v2.ListJiraIssueTemplates": false, "v2.UpdateJiraIssueTemplate": false, + "v2.CreateTenancyConfig": false, + "v2.GetTenancyConfigs": false, "v2.CreateServiceNowTemplate": false, "v2.DeleteServiceNowTemplate": false, "v2.GetServiceNowTemplate": false, diff --git a/api/datadogV2/api_incidents.go b/api/datadogV2/api_incidents.go index 91ed6c20dfb..0fe569c306b 100644 --- a/api/datadogV2/api_incidents.go +++ b/api/datadogV2/api_incidents.go @@ -730,6 +730,10 @@ func (a *IncidentsApi) CreateIncidentNotificationTemplate(ctx _context.Context, // CreateIncidentPostmortemAttachment Create postmortem attachment. // Create a postmortem attachment for an incident. +// +// The endpoint accepts markdown for notebooks created in Confluence or Google Docs. +// Postmortems created from notebooks need to be formatted using frontend notebook cells, +// in addition to markdown format. func (a *IncidentsApi) CreateIncidentPostmortemAttachment(ctx _context.Context, incidentId string, body PostmortemAttachmentRequest) (Attachment, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/api/datadogV2/api_oci_integration.go b/api/datadogV2/api_oci_integration.go new file mode 100644 index 00000000000..dbc97fa90bb --- /dev/null +++ b/api/datadogV2/api_oci_integration.go @@ -0,0 +1,505 @@ +// 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" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// OCIIntegrationApi service type +type OCIIntegrationApi datadog.Service + +// CreateTenancyConfig Create tenancy config. +// Create a new tenancy config to establish monitoring and data collection from your OCI environment. Requires OCI authentication credentials and tenancy details. Warning: Datadog recommends interacting with this endpoint only through the Datadog web UI to ensure all necessary OCI resources have been created and configured properly. +func (a *OCIIntegrationApi) CreateTenancyConfig(ctx _context.Context, body CreateTenancyConfigRequest) (TenancyConfig, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue TenancyConfig + ) + + operationId := "v2.CreateTenancyConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OCIIntegrationApi.CreateTenancyConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/oci/tenancies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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 +} + +// DeleteTenancyConfig Delete tenancy config. +// Delete an existing tenancy config. This will stop all data collection from the specified OCI tenancy and remove the stored configuration. This operation cannot be undone. +func (a *OCIIntegrationApi) DeleteTenancyConfig(ctx _context.Context, tenancyOcid string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OCIIntegrationApi.DeleteTenancyConfig") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/oci/tenancies/{tenancy_ocid}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{tenancy_ocid}", _neturl.PathEscape(datadog.ParameterToString(tenancyOcid, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + 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 nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetTenancyConfig Get tenancy config. +// Get a single tenancy config object by its OCID. Returns detailed configuration including authentication credentials, enabled services, region settings, and collection preferences. +func (a *OCIIntegrationApi) GetTenancyConfig(ctx _context.Context, tenancyOcid string) (TenancyConfig, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TenancyConfig + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OCIIntegrationApi.GetTenancyConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/oci/tenancies/{tenancy_ocid}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{tenancy_ocid}", _neturl.PathEscape(datadog.ParameterToString(tenancyOcid, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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 +} + +// GetTenancyConfigs Get tenancy configs. +// Get a list of all configured OCI tenancy integrations. Returns basic information about each tenancy including authentication credentials, region settings, and collection preferences for metrics, logs, and resources. +func (a *OCIIntegrationApi) GetTenancyConfigs(ctx _context.Context) (TenancyConfigList, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TenancyConfigList + ) + + operationId := "v2.GetTenancyConfigs" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OCIIntegrationApi.GetTenancyConfigs") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/oci/tenancies" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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 +} + +// ListTenancyProducts List tenancy products. +// Lists the products for a given tenancy. Returns the enabled/disabled status of Datadog products (such as Cloud Security Posture Management) for specific OCI tenancies. +func (a *OCIIntegrationApi) ListTenancyProducts(ctx _context.Context, productKeys string) (TenancyProductsList, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TenancyProductsList + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OCIIntegrationApi.ListTenancyProducts") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/oci/products" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarQueryParams.Add("productKeys", datadog.ParameterToString(productKeys, "")) + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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 +} + +// UpdateTenancyConfig Update tenancy config. +// Update an existing tenancy config. You can modify authentication credentials, enable/disable collection types, update service filters, and change region settings. Warning: We recommend using the Datadog web UI to avoid unintended update effects. +func (a *OCIIntegrationApi) UpdateTenancyConfig(ctx _context.Context, tenancyOcid string, body UpdateTenancyConfigRequest) (TenancyConfig, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue TenancyConfig + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.OCIIntegrationApi.UpdateTenancyConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/oci/tenancies/{tenancy_ocid}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{tenancy_ocid}", _neturl.PathEscape(datadog.ParameterToString(tenancyOcid, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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 +} + +// NewOCIIntegrationApi Returns NewOCIIntegrationApi. +func NewOCIIntegrationApi(client *datadog.APIClient) *OCIIntegrationApi { + return &OCIIntegrationApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 1bfc86e00f0..0283472d7ae 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -451,6 +451,12 @@ // - [NetworkDeviceMonitoringApi.ListDeviceUserTags] // - [NetworkDeviceMonitoringApi.ListDevices] // - [NetworkDeviceMonitoringApi.UpdateDeviceUserTags] +// - [OCIIntegrationApi.CreateTenancyConfig] +// - [OCIIntegrationApi.DeleteTenancyConfig] +// - [OCIIntegrationApi.GetTenancyConfig] +// - [OCIIntegrationApi.GetTenancyConfigs] +// - [OCIIntegrationApi.ListTenancyProducts] +// - [OCIIntegrationApi.UpdateTenancyConfig] // - [ObservabilityPipelinesApi.CreatePipeline] // - [ObservabilityPipelinesApi.DeletePipeline] // - [ObservabilityPipelinesApi.GetPipeline] diff --git a/api/datadogV2/model_create_tenancy_config_data.go b/api/datadogV2/model_create_tenancy_config_data.go new file mode 100644 index 00000000000..a9d9536df8f --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_data.go @@ -0,0 +1,183 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateTenancyConfigData +type CreateTenancyConfigData struct { + // + Attributes *CreateTenancyConfigDataAttributes `json:"attributes,omitempty"` + // + Id string `json:"id"` + // OCI tenancy resource type. + Type UpdateTenancyConfigDataType `json:"type"` + // 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:"-"` +} + +// NewCreateTenancyConfigData instantiates a new CreateTenancyConfigData 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 NewCreateTenancyConfigData(id string, typeVar UpdateTenancyConfigDataType) *CreateTenancyConfigData { + this := CreateTenancyConfigData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewCreateTenancyConfigDataWithDefaults instantiates a new CreateTenancyConfigData 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 NewCreateTenancyConfigDataWithDefaults() *CreateTenancyConfigData { + this := CreateTenancyConfigData{} + var typeVar UpdateTenancyConfigDataType = UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CreateTenancyConfigData) GetAttributes() CreateTenancyConfigDataAttributes { + if o == nil || o.Attributes == nil { + var ret CreateTenancyConfigDataAttributes + 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 *CreateTenancyConfigData) GetAttributesOk() (*CreateTenancyConfigDataAttributes, 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 *CreateTenancyConfigData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CreateTenancyConfigDataAttributes and assigns it to the Attributes field. +func (o *CreateTenancyConfigData) SetAttributes(v CreateTenancyConfigDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *CreateTenancyConfigData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *CreateTenancyConfigData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *CreateTenancyConfigData) GetType() UpdateTenancyConfigDataType { + if o == nil { + var ret UpdateTenancyConfigDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigData) GetTypeOk() (*UpdateTenancyConfigDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateTenancyConfigData) SetType(v UpdateTenancyConfigDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateTenancyConfigDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *UpdateTenancyConfigDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + 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 + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_create_tenancy_config_data_attributes.go b/api/datadogV2/model_create_tenancy_config_data_attributes.go new file mode 100644 index 00000000000..47a8cbc45d6 --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_data_attributes.go @@ -0,0 +1,474 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateTenancyConfigDataAttributes +type CreateTenancyConfigDataAttributes struct { + // + AuthCredentials CreateTenancyConfigDataAttributesAuthCredentials `json:"auth_credentials"` + // + ConfigVersion datadog.NullableInt64 `json:"config_version,omitempty"` + // + CostCollectionEnabled *bool `json:"cost_collection_enabled,omitempty"` + // + DdCompartmentId *string `json:"dd_compartment_id,omitempty"` + // + DdStackId *string `json:"dd_stack_id,omitempty"` + // + HomeRegion string `json:"home_region"` + // + LogsConfig *CreateTenancyConfigDataAttributesLogsConfig `json:"logs_config,omitempty"` + // + MetricsConfig *CreateTenancyConfigDataAttributesMetricsConfig `json:"metrics_config,omitempty"` + // + RegionsConfig *CreateTenancyConfigDataAttributesRegionsConfig `json:"regions_config,omitempty"` + // + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + // + UserOcid string `json:"user_ocid"` + // 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:"-"` +} + +// NewCreateTenancyConfigDataAttributes instantiates a new CreateTenancyConfigDataAttributes 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 NewCreateTenancyConfigDataAttributes(authCredentials CreateTenancyConfigDataAttributesAuthCredentials, homeRegion string, userOcid string) *CreateTenancyConfigDataAttributes { + this := CreateTenancyConfigDataAttributes{} + this.AuthCredentials = authCredentials + this.HomeRegion = homeRegion + this.UserOcid = userOcid + return &this +} + +// NewCreateTenancyConfigDataAttributesWithDefaults instantiates a new CreateTenancyConfigDataAttributes 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 NewCreateTenancyConfigDataAttributesWithDefaults() *CreateTenancyConfigDataAttributes { + this := CreateTenancyConfigDataAttributes{} + return &this +} + +// GetAuthCredentials returns the AuthCredentials field value. +func (o *CreateTenancyConfigDataAttributes) GetAuthCredentials() CreateTenancyConfigDataAttributesAuthCredentials { + if o == nil { + var ret CreateTenancyConfigDataAttributesAuthCredentials + return ret + } + return o.AuthCredentials +} + +// GetAuthCredentialsOk returns a tuple with the AuthCredentials field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetAuthCredentialsOk() (*CreateTenancyConfigDataAttributesAuthCredentials, bool) { + if o == nil { + return nil, false + } + return &o.AuthCredentials, true +} + +// SetAuthCredentials sets field value. +func (o *CreateTenancyConfigDataAttributes) SetAuthCredentials(v CreateTenancyConfigDataAttributesAuthCredentials) { + o.AuthCredentials = v +} + +// GetConfigVersion returns the ConfigVersion field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateTenancyConfigDataAttributes) GetConfigVersion() int64 { + if o == nil || o.ConfigVersion.Get() == nil { + var ret int64 + return ret + } + return *o.ConfigVersion.Get() +} + +// GetConfigVersionOk returns a tuple with the ConfigVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *CreateTenancyConfigDataAttributes) GetConfigVersionOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.ConfigVersion.Get(), o.ConfigVersion.IsSet() +} + +// HasConfigVersion returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasConfigVersion() bool { + return o != nil && o.ConfigVersion.IsSet() +} + +// SetConfigVersion gets a reference to the given datadog.NullableInt64 and assigns it to the ConfigVersion field. +func (o *CreateTenancyConfigDataAttributes) SetConfigVersion(v int64) { + o.ConfigVersion.Set(&v) +} + +// SetConfigVersionNil sets the value for ConfigVersion to be an explicit nil. +func (o *CreateTenancyConfigDataAttributes) SetConfigVersionNil() { + o.ConfigVersion.Set(nil) +} + +// UnsetConfigVersion ensures that no value is present for ConfigVersion, not even an explicit nil. +func (o *CreateTenancyConfigDataAttributes) UnsetConfigVersion() { + o.ConfigVersion.Unset() +} + +// GetCostCollectionEnabled returns the CostCollectionEnabled field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetCostCollectionEnabled() bool { + if o == nil || o.CostCollectionEnabled == nil { + var ret bool + return ret + } + return *o.CostCollectionEnabled +} + +// GetCostCollectionEnabledOk returns a tuple with the CostCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetCostCollectionEnabledOk() (*bool, bool) { + if o == nil || o.CostCollectionEnabled == nil { + return nil, false + } + return o.CostCollectionEnabled, true +} + +// HasCostCollectionEnabled returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasCostCollectionEnabled() bool { + return o != nil && o.CostCollectionEnabled != nil +} + +// SetCostCollectionEnabled gets a reference to the given bool and assigns it to the CostCollectionEnabled field. +func (o *CreateTenancyConfigDataAttributes) SetCostCollectionEnabled(v bool) { + o.CostCollectionEnabled = &v +} + +// GetDdCompartmentId returns the DdCompartmentId field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetDdCompartmentId() string { + if o == nil || o.DdCompartmentId == nil { + var ret string + return ret + } + return *o.DdCompartmentId +} + +// GetDdCompartmentIdOk returns a tuple with the DdCompartmentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetDdCompartmentIdOk() (*string, bool) { + if o == nil || o.DdCompartmentId == nil { + return nil, false + } + return o.DdCompartmentId, true +} + +// HasDdCompartmentId returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasDdCompartmentId() bool { + return o != nil && o.DdCompartmentId != nil +} + +// SetDdCompartmentId gets a reference to the given string and assigns it to the DdCompartmentId field. +func (o *CreateTenancyConfigDataAttributes) SetDdCompartmentId(v string) { + o.DdCompartmentId = &v +} + +// GetDdStackId returns the DdStackId field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetDdStackId() string { + if o == nil || o.DdStackId == nil { + var ret string + return ret + } + return *o.DdStackId +} + +// GetDdStackIdOk returns a tuple with the DdStackId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetDdStackIdOk() (*string, bool) { + if o == nil || o.DdStackId == nil { + return nil, false + } + return o.DdStackId, true +} + +// HasDdStackId returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasDdStackId() bool { + return o != nil && o.DdStackId != nil +} + +// SetDdStackId gets a reference to the given string and assigns it to the DdStackId field. +func (o *CreateTenancyConfigDataAttributes) SetDdStackId(v string) { + o.DdStackId = &v +} + +// GetHomeRegion returns the HomeRegion field value. +func (o *CreateTenancyConfigDataAttributes) GetHomeRegion() string { + if o == nil { + var ret string + return ret + } + return o.HomeRegion +} + +// GetHomeRegionOk returns a tuple with the HomeRegion field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetHomeRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.HomeRegion, true +} + +// SetHomeRegion sets field value. +func (o *CreateTenancyConfigDataAttributes) SetHomeRegion(v string) { + o.HomeRegion = v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetLogsConfig() CreateTenancyConfigDataAttributesLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret CreateTenancyConfigDataAttributesLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetLogsConfigOk() (*CreateTenancyConfigDataAttributesLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given CreateTenancyConfigDataAttributesLogsConfig and assigns it to the LogsConfig field. +func (o *CreateTenancyConfigDataAttributes) SetLogsConfig(v CreateTenancyConfigDataAttributesLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetMetricsConfig() CreateTenancyConfigDataAttributesMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret CreateTenancyConfigDataAttributesMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetMetricsConfigOk() (*CreateTenancyConfigDataAttributesMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given CreateTenancyConfigDataAttributesMetricsConfig and assigns it to the MetricsConfig field. +func (o *CreateTenancyConfigDataAttributes) SetMetricsConfig(v CreateTenancyConfigDataAttributesMetricsConfig) { + o.MetricsConfig = &v +} + +// GetRegionsConfig returns the RegionsConfig field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetRegionsConfig() CreateTenancyConfigDataAttributesRegionsConfig { + if o == nil || o.RegionsConfig == nil { + var ret CreateTenancyConfigDataAttributesRegionsConfig + return ret + } + return *o.RegionsConfig +} + +// GetRegionsConfigOk returns a tuple with the RegionsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetRegionsConfigOk() (*CreateTenancyConfigDataAttributesRegionsConfig, bool) { + if o == nil || o.RegionsConfig == nil { + return nil, false + } + return o.RegionsConfig, true +} + +// HasRegionsConfig returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasRegionsConfig() bool { + return o != nil && o.RegionsConfig != nil +} + +// SetRegionsConfig gets a reference to the given CreateTenancyConfigDataAttributesRegionsConfig and assigns it to the RegionsConfig field. +func (o *CreateTenancyConfigDataAttributes) SetRegionsConfig(v CreateTenancyConfigDataAttributesRegionsConfig) { + o.RegionsConfig = &v +} + +// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributes) GetResourceCollectionEnabled() bool { + if o == nil || o.ResourceCollectionEnabled == nil { + var ret bool + return ret + } + return *o.ResourceCollectionEnabled +} + +// GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetResourceCollectionEnabledOk() (*bool, bool) { + if o == nil || o.ResourceCollectionEnabled == nil { + return nil, false + } + return o.ResourceCollectionEnabled, true +} + +// HasResourceCollectionEnabled returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributes) HasResourceCollectionEnabled() bool { + return o != nil && o.ResourceCollectionEnabled != nil +} + +// SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field. +func (o *CreateTenancyConfigDataAttributes) SetResourceCollectionEnabled(v bool) { + o.ResourceCollectionEnabled = &v +} + +// GetUserOcid returns the UserOcid field value. +func (o *CreateTenancyConfigDataAttributes) GetUserOcid() string { + if o == nil { + var ret string + return ret + } + return o.UserOcid +} + +// GetUserOcidOk returns a tuple with the UserOcid field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributes) GetUserOcidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UserOcid, true +} + +// SetUserOcid sets field value. +func (o *CreateTenancyConfigDataAttributes) SetUserOcid(v string) { + o.UserOcid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["auth_credentials"] = o.AuthCredentials + if o.ConfigVersion.IsSet() { + toSerialize["config_version"] = o.ConfigVersion.Get() + } + if o.CostCollectionEnabled != nil { + toSerialize["cost_collection_enabled"] = o.CostCollectionEnabled + } + if o.DdCompartmentId != nil { + toSerialize["dd_compartment_id"] = o.DdCompartmentId + } + if o.DdStackId != nil { + toSerialize["dd_stack_id"] = o.DdStackId + } + toSerialize["home_region"] = o.HomeRegion + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.RegionsConfig != nil { + toSerialize["regions_config"] = o.RegionsConfig + } + if o.ResourceCollectionEnabled != nil { + toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled + } + toSerialize["user_ocid"] = o.UserOcid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AuthCredentials *CreateTenancyConfigDataAttributesAuthCredentials `json:"auth_credentials"` + ConfigVersion datadog.NullableInt64 `json:"config_version,omitempty"` + CostCollectionEnabled *bool `json:"cost_collection_enabled,omitempty"` + DdCompartmentId *string `json:"dd_compartment_id,omitempty"` + DdStackId *string `json:"dd_stack_id,omitempty"` + HomeRegion *string `json:"home_region"` + LogsConfig *CreateTenancyConfigDataAttributesLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *CreateTenancyConfigDataAttributesMetricsConfig `json:"metrics_config,omitempty"` + RegionsConfig *CreateTenancyConfigDataAttributesRegionsConfig `json:"regions_config,omitempty"` + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + UserOcid *string `json:"user_ocid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AuthCredentials == nil { + return fmt.Errorf("required field auth_credentials missing") + } + if all.HomeRegion == nil { + return fmt.Errorf("required field home_region missing") + } + if all.UserOcid == nil { + return fmt.Errorf("required field user_ocid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auth_credentials", "config_version", "cost_collection_enabled", "dd_compartment_id", "dd_stack_id", "home_region", "logs_config", "metrics_config", "regions_config", "resource_collection_enabled", "user_ocid"}) + } else { + return err + } + + hasInvalidField := false + if all.AuthCredentials.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AuthCredentials = *all.AuthCredentials + o.ConfigVersion = all.ConfigVersion + o.CostCollectionEnabled = all.CostCollectionEnabled + o.DdCompartmentId = all.DdCompartmentId + o.DdStackId = all.DdStackId + o.HomeRegion = *all.HomeRegion + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + if all.RegionsConfig != nil && all.RegionsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.RegionsConfig = all.RegionsConfig + o.ResourceCollectionEnabled = all.ResourceCollectionEnabled + o.UserOcid = *all.UserOcid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_tenancy_config_data_attributes_auth_credentials.go b/api/datadogV2/model_create_tenancy_config_data_attributes_auth_credentials.go new file mode 100644 index 00000000000..a09e004bc2e --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_data_attributes_auth_credentials.go @@ -0,0 +1,136 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateTenancyConfigDataAttributesAuthCredentials +type CreateTenancyConfigDataAttributesAuthCredentials struct { + // + Fingerprint *string `json:"fingerprint,omitempty"` + // + PrivateKey string `json:"private_key"` + // 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:"-"` +} + +// NewCreateTenancyConfigDataAttributesAuthCredentials instantiates a new CreateTenancyConfigDataAttributesAuthCredentials 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 NewCreateTenancyConfigDataAttributesAuthCredentials(privateKey string) *CreateTenancyConfigDataAttributesAuthCredentials { + this := CreateTenancyConfigDataAttributesAuthCredentials{} + this.PrivateKey = privateKey + return &this +} + +// NewCreateTenancyConfigDataAttributesAuthCredentialsWithDefaults instantiates a new CreateTenancyConfigDataAttributesAuthCredentials 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 NewCreateTenancyConfigDataAttributesAuthCredentialsWithDefaults() *CreateTenancyConfigDataAttributesAuthCredentials { + this := CreateTenancyConfigDataAttributesAuthCredentials{} + return &this +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) GetFingerprint() string { + if o == nil || o.Fingerprint == nil { + var ret string + return ret + } + return *o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) GetFingerprintOk() (*string, bool) { + if o == nil || o.Fingerprint == nil { + return nil, false + } + return o.Fingerprint, true +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) HasFingerprint() bool { + return o != nil && o.Fingerprint != nil +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) SetFingerprint(v string) { + o.Fingerprint = &v +} + +// GetPrivateKey returns the PrivateKey field value. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) GetPrivateKey() string { + if o == nil { + var ret string + return ret + } + return o.PrivateKey +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) GetPrivateKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PrivateKey, true +} + +// SetPrivateKey sets field value. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) SetPrivateKey(v string) { + o.PrivateKey = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigDataAttributesAuthCredentials) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Fingerprint != nil { + toSerialize["fingerprint"] = o.Fingerprint + } + toSerialize["private_key"] = o.PrivateKey + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigDataAttributesAuthCredentials) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Fingerprint *string `json:"fingerprint,omitempty"` + PrivateKey *string `json:"private_key"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.PrivateKey == nil { + return fmt.Errorf("required field private_key missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"fingerprint", "private_key"}) + } else { + return err + } + o.Fingerprint = all.Fingerprint + o.PrivateKey = *all.PrivateKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_tenancy_config_data_attributes_logs_config.go b/api/datadogV2/model_create_tenancy_config_data_attributes_logs_config.go new file mode 100644 index 00000000000..d6e600290e4 --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_data_attributes_logs_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// CreateTenancyConfigDataAttributesLogsConfig +type CreateTenancyConfigDataAttributesLogsConfig struct { + // + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + // + Enabled *bool `json:"enabled,omitempty"` + // + EnabledServices []string `json:"enabled_services,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:"-"` +} + +// NewCreateTenancyConfigDataAttributesLogsConfig instantiates a new CreateTenancyConfigDataAttributesLogsConfig 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 NewCreateTenancyConfigDataAttributesLogsConfig() *CreateTenancyConfigDataAttributesLogsConfig { + this := CreateTenancyConfigDataAttributesLogsConfig{} + return &this +} + +// NewCreateTenancyConfigDataAttributesLogsConfigWithDefaults instantiates a new CreateTenancyConfigDataAttributesLogsConfig 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 NewCreateTenancyConfigDataAttributesLogsConfigWithDefaults() *CreateTenancyConfigDataAttributesLogsConfig { + this := CreateTenancyConfigDataAttributesLogsConfig{} + return &this +} + +// GetCompartmentTagFilters returns the CompartmentTagFilters field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesLogsConfig) GetCompartmentTagFilters() []string { + if o == nil || o.CompartmentTagFilters == nil { + var ret []string + return ret + } + return o.CompartmentTagFilters +} + +// GetCompartmentTagFiltersOk returns a tuple with the CompartmentTagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesLogsConfig) GetCompartmentTagFiltersOk() (*[]string, bool) { + if o == nil || o.CompartmentTagFilters == nil { + return nil, false + } + return &o.CompartmentTagFilters, true +} + +// HasCompartmentTagFilters returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesLogsConfig) HasCompartmentTagFilters() bool { + return o != nil && o.CompartmentTagFilters != nil +} + +// SetCompartmentTagFilters gets a reference to the given []string and assigns it to the CompartmentTagFilters field. +func (o *CreateTenancyConfigDataAttributesLogsConfig) SetCompartmentTagFilters(v []string) { + o.CompartmentTagFilters = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesLogsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesLogsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesLogsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CreateTenancyConfigDataAttributesLogsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetEnabledServices returns the EnabledServices field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesLogsConfig) GetEnabledServices() []string { + if o == nil || o.EnabledServices == nil { + var ret []string + return ret + } + return o.EnabledServices +} + +// GetEnabledServicesOk returns a tuple with the EnabledServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesLogsConfig) GetEnabledServicesOk() (*[]string, bool) { + if o == nil || o.EnabledServices == nil { + return nil, false + } + return &o.EnabledServices, true +} + +// HasEnabledServices returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesLogsConfig) HasEnabledServices() bool { + return o != nil && o.EnabledServices != nil +} + +// SetEnabledServices gets a reference to the given []string and assigns it to the EnabledServices field. +func (o *CreateTenancyConfigDataAttributesLogsConfig) SetEnabledServices(v []string) { + o.EnabledServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigDataAttributesLogsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CompartmentTagFilters != nil { + toSerialize["compartment_tag_filters"] = o.CompartmentTagFilters + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.EnabledServices != nil { + toSerialize["enabled_services"] = o.EnabledServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigDataAttributesLogsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EnabledServices []string `json:"enabled_services,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{"compartment_tag_filters", "enabled", "enabled_services"}) + } else { + return err + } + o.CompartmentTagFilters = all.CompartmentTagFilters + o.Enabled = all.Enabled + o.EnabledServices = all.EnabledServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_tenancy_config_data_attributes_metrics_config.go b/api/datadogV2/model_create_tenancy_config_data_attributes_metrics_config.go new file mode 100644 index 00000000000..dde715a3c23 --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_data_attributes_metrics_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// CreateTenancyConfigDataAttributesMetricsConfig +type CreateTenancyConfigDataAttributesMetricsConfig struct { + // + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + // + Enabled *bool `json:"enabled,omitempty"` + // + ExcludedServices []string `json:"excluded_services,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:"-"` +} + +// NewCreateTenancyConfigDataAttributesMetricsConfig instantiates a new CreateTenancyConfigDataAttributesMetricsConfig 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 NewCreateTenancyConfigDataAttributesMetricsConfig() *CreateTenancyConfigDataAttributesMetricsConfig { + this := CreateTenancyConfigDataAttributesMetricsConfig{} + return &this +} + +// NewCreateTenancyConfigDataAttributesMetricsConfigWithDefaults instantiates a new CreateTenancyConfigDataAttributesMetricsConfig 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 NewCreateTenancyConfigDataAttributesMetricsConfigWithDefaults() *CreateTenancyConfigDataAttributesMetricsConfig { + this := CreateTenancyConfigDataAttributesMetricsConfig{} + return &this +} + +// GetCompartmentTagFilters returns the CompartmentTagFilters field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) GetCompartmentTagFilters() []string { + if o == nil || o.CompartmentTagFilters == nil { + var ret []string + return ret + } + return o.CompartmentTagFilters +} + +// GetCompartmentTagFiltersOk returns a tuple with the CompartmentTagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) GetCompartmentTagFiltersOk() (*[]string, bool) { + if o == nil || o.CompartmentTagFilters == nil { + return nil, false + } + return &o.CompartmentTagFilters, true +} + +// HasCompartmentTagFilters returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) HasCompartmentTagFilters() bool { + return o != nil && o.CompartmentTagFilters != nil +} + +// SetCompartmentTagFilters gets a reference to the given []string and assigns it to the CompartmentTagFilters field. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) SetCompartmentTagFilters(v []string) { + o.CompartmentTagFilters = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExcludedServices returns the ExcludedServices field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) GetExcludedServices() []string { + if o == nil || o.ExcludedServices == nil { + var ret []string + return ret + } + return o.ExcludedServices +} + +// GetExcludedServicesOk returns a tuple with the ExcludedServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) GetExcludedServicesOk() (*[]string, bool) { + if o == nil || o.ExcludedServices == nil { + return nil, false + } + return &o.ExcludedServices, true +} + +// HasExcludedServices returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) HasExcludedServices() bool { + return o != nil && o.ExcludedServices != nil +} + +// SetExcludedServices gets a reference to the given []string and assigns it to the ExcludedServices field. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) SetExcludedServices(v []string) { + o.ExcludedServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigDataAttributesMetricsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CompartmentTagFilters != nil { + toSerialize["compartment_tag_filters"] = o.CompartmentTagFilters + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ExcludedServices != nil { + toSerialize["excluded_services"] = o.ExcludedServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigDataAttributesMetricsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + ExcludedServices []string `json:"excluded_services,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{"compartment_tag_filters", "enabled", "excluded_services"}) + } else { + return err + } + o.CompartmentTagFilters = all.CompartmentTagFilters + o.Enabled = all.Enabled + o.ExcludedServices = all.ExcludedServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_tenancy_config_data_attributes_regions_config.go b/api/datadogV2/model_create_tenancy_config_data_attributes_regions_config.go new file mode 100644 index 00000000000..aeb15aada63 --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_data_attributes_regions_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// CreateTenancyConfigDataAttributesRegionsConfig +type CreateTenancyConfigDataAttributesRegionsConfig struct { + // + Available []string `json:"available,omitempty"` + // + Disabled []string `json:"disabled,omitempty"` + // + Enabled []string `json:"enabled,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:"-"` +} + +// NewCreateTenancyConfigDataAttributesRegionsConfig instantiates a new CreateTenancyConfigDataAttributesRegionsConfig 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 NewCreateTenancyConfigDataAttributesRegionsConfig() *CreateTenancyConfigDataAttributesRegionsConfig { + this := CreateTenancyConfigDataAttributesRegionsConfig{} + return &this +} + +// NewCreateTenancyConfigDataAttributesRegionsConfigWithDefaults instantiates a new CreateTenancyConfigDataAttributesRegionsConfig 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 NewCreateTenancyConfigDataAttributesRegionsConfigWithDefaults() *CreateTenancyConfigDataAttributesRegionsConfig { + this := CreateTenancyConfigDataAttributesRegionsConfig{} + return &this +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) GetAvailable() []string { + if o == nil || o.Available == nil { + var ret []string + return ret + } + return o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) GetAvailableOk() (*[]string, bool) { + if o == nil || o.Available == nil { + return nil, false + } + return &o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) HasAvailable() bool { + return o != nil && o.Available != nil +} + +// SetAvailable gets a reference to the given []string and assigns it to the Available field. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) SetAvailable(v []string) { + o.Available = v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) GetDisabled() []string { + if o == nil || o.Disabled == nil { + var ret []string + return ret + } + return o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) GetDisabledOk() (*[]string, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return &o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) HasDisabled() bool { + return o != nil && o.Disabled != nil +} + +// SetDisabled gets a reference to the given []string and assigns it to the Disabled field. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) SetDisabled(v []string) { + o.Disabled = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) GetEnabled() []string { + if o == nil || o.Enabled == nil { + var ret []string + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) GetEnabledOk() (*[]string, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return &o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given []string and assigns it to the Enabled field. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) SetEnabled(v []string) { + o.Enabled = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigDataAttributesRegionsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Available != nil { + toSerialize["available"] = o.Available + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigDataAttributesRegionsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Available []string `json:"available,omitempty"` + Disabled []string `json:"disabled,omitempty"` + Enabled []string `json:"enabled,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{"available", "disabled", "enabled"}) + } else { + return err + } + o.Available = all.Available + o.Disabled = all.Disabled + o.Enabled = all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_tenancy_config_request.go b/api/datadogV2/model_create_tenancy_config_request.go new file mode 100644 index 00000000000..768b7501c66 --- /dev/null +++ b/api/datadogV2/model_create_tenancy_config_request.go @@ -0,0 +1,110 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateTenancyConfigRequest +type CreateTenancyConfigRequest struct { + // + Data CreateTenancyConfigData `json:"data"` + // 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:"-"` +} + +// NewCreateTenancyConfigRequest instantiates a new CreateTenancyConfigRequest 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 NewCreateTenancyConfigRequest(data CreateTenancyConfigData) *CreateTenancyConfigRequest { + this := CreateTenancyConfigRequest{} + this.Data = data + return &this +} + +// NewCreateTenancyConfigRequestWithDefaults instantiates a new CreateTenancyConfigRequest 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 NewCreateTenancyConfigRequestWithDefaults() *CreateTenancyConfigRequest { + this := CreateTenancyConfigRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *CreateTenancyConfigRequest) GetData() CreateTenancyConfigData { + if o == nil { + var ret CreateTenancyConfigData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CreateTenancyConfigRequest) GetDataOk() (*CreateTenancyConfigData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CreateTenancyConfigRequest) SetData(v CreateTenancyConfigData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateTenancyConfigRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateTenancyConfigRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateTenancyConfigData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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_tenancy_config.go b/api/datadogV2/model_tenancy_config.go new file mode 100644 index 00000000000..c2b286677b3 --- /dev/null +++ b/api/datadogV2/model_tenancy_config.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" +) + +// TenancyConfig +type TenancyConfig struct { + // + Data *TenancyConfigData `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:"-"` +} + +// NewTenancyConfig instantiates a new TenancyConfig 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 NewTenancyConfig() *TenancyConfig { + this := TenancyConfig{} + return &this +} + +// NewTenancyConfigWithDefaults instantiates a new TenancyConfig 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 NewTenancyConfigWithDefaults() *TenancyConfig { + this := TenancyConfig{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *TenancyConfig) GetData() TenancyConfigData { + if o == nil || o.Data == nil { + var ret TenancyConfigData + 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 *TenancyConfig) GetDataOk() (*TenancyConfigData, 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 *TenancyConfig) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given TenancyConfigData and assigns it to the Data field. +func (o *TenancyConfig) SetData(v TenancyConfigData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfig) 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 *TenancyConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TenancyConfigData `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_tenancy_config_data.go b/api/datadogV2/model_tenancy_config_data.go new file mode 100644 index 00000000000..10b7d7fb3bd --- /dev/null +++ b/api/datadogV2/model_tenancy_config_data.go @@ -0,0 +1,186 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TenancyConfigData +type TenancyConfigData struct { + // + Attributes *TenancyConfigDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // OCI tenancy resource type. + Type UpdateTenancyConfigDataType `json:"type"` + // 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:"-"` +} + +// NewTenancyConfigData instantiates a new TenancyConfigData 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 NewTenancyConfigData(typeVar UpdateTenancyConfigDataType) *TenancyConfigData { + this := TenancyConfigData{} + this.Type = typeVar + return &this +} + +// NewTenancyConfigDataWithDefaults instantiates a new TenancyConfigData 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 NewTenancyConfigDataWithDefaults() *TenancyConfigData { + this := TenancyConfigData{} + var typeVar UpdateTenancyConfigDataType = UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *TenancyConfigData) GetAttributes() TenancyConfigDataAttributes { + if o == nil || o.Attributes == nil { + var ret TenancyConfigDataAttributes + 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 *TenancyConfigData) GetAttributesOk() (*TenancyConfigDataAttributes, 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 *TenancyConfigData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given TenancyConfigDataAttributes and assigns it to the Attributes field. +func (o *TenancyConfigData) SetAttributes(v TenancyConfigDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *TenancyConfigData) 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 *TenancyConfigData) 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 *TenancyConfigData) 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 *TenancyConfigData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *TenancyConfigData) GetType() UpdateTenancyConfigDataType { + if o == nil { + var ret UpdateTenancyConfigDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TenancyConfigData) GetTypeOk() (*UpdateTenancyConfigDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TenancyConfigData) SetType(v UpdateTenancyConfigDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfigData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyConfigData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TenancyConfigDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UpdateTenancyConfigDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + 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 + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_tenancy_config_data_attributes.go b/api/datadogV2/model_tenancy_config_data_attributes.go new file mode 100644 index 00000000000..e41a7da0555 --- /dev/null +++ b/api/datadogV2/model_tenancy_config_data_attributes.go @@ -0,0 +1,537 @@ +// 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" +) + +// TenancyConfigDataAttributes +type TenancyConfigDataAttributes struct { + // + BillingPlanId *int32 `json:"billing_plan_id,omitempty"` + // + ConfigVersion *int64 `json:"config_version,omitempty"` + // + CostCollectionEnabled *bool `json:"cost_collection_enabled,omitempty"` + // + DdCompartmentId *string `json:"dd_compartment_id,omitempty"` + // + DdStackId *string `json:"dd_stack_id,omitempty"` + // + HomeRegion *string `json:"home_region,omitempty"` + // + LogsConfig *TenancyConfigDataAttributesLogsConfig `json:"logs_config,omitempty"` + // + MetricsConfig *TenancyConfigDataAttributesMetricsConfig `json:"metrics_config,omitempty"` + // + ParentTenancyName *string `json:"parent_tenancy_name,omitempty"` + // + RegionsConfig *TenancyConfigDataAttributesRegionsConfig `json:"regions_config,omitempty"` + // + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + // + TenancyName *string `json:"tenancy_name,omitempty"` + // + UserOcid *string `json:"user_ocid,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:"-"` +} + +// NewTenancyConfigDataAttributes instantiates a new TenancyConfigDataAttributes 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 NewTenancyConfigDataAttributes() *TenancyConfigDataAttributes { + this := TenancyConfigDataAttributes{} + return &this +} + +// NewTenancyConfigDataAttributesWithDefaults instantiates a new TenancyConfigDataAttributes 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 NewTenancyConfigDataAttributesWithDefaults() *TenancyConfigDataAttributes { + this := TenancyConfigDataAttributes{} + return &this +} + +// GetBillingPlanId returns the BillingPlanId field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetBillingPlanId() int32 { + if o == nil || o.BillingPlanId == nil { + var ret int32 + return ret + } + return *o.BillingPlanId +} + +// GetBillingPlanIdOk returns a tuple with the BillingPlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetBillingPlanIdOk() (*int32, bool) { + if o == nil || o.BillingPlanId == nil { + return nil, false + } + return o.BillingPlanId, true +} + +// HasBillingPlanId returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasBillingPlanId() bool { + return o != nil && o.BillingPlanId != nil +} + +// SetBillingPlanId gets a reference to the given int32 and assigns it to the BillingPlanId field. +func (o *TenancyConfigDataAttributes) SetBillingPlanId(v int32) { + o.BillingPlanId = &v +} + +// GetConfigVersion returns the ConfigVersion field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetConfigVersion() int64 { + if o == nil || o.ConfigVersion == nil { + var ret int64 + return ret + } + return *o.ConfigVersion +} + +// GetConfigVersionOk returns a tuple with the ConfigVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetConfigVersionOk() (*int64, bool) { + if o == nil || o.ConfigVersion == nil { + return nil, false + } + return o.ConfigVersion, true +} + +// HasConfigVersion returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasConfigVersion() bool { + return o != nil && o.ConfigVersion != nil +} + +// SetConfigVersion gets a reference to the given int64 and assigns it to the ConfigVersion field. +func (o *TenancyConfigDataAttributes) SetConfigVersion(v int64) { + o.ConfigVersion = &v +} + +// GetCostCollectionEnabled returns the CostCollectionEnabled field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetCostCollectionEnabled() bool { + if o == nil || o.CostCollectionEnabled == nil { + var ret bool + return ret + } + return *o.CostCollectionEnabled +} + +// GetCostCollectionEnabledOk returns a tuple with the CostCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetCostCollectionEnabledOk() (*bool, bool) { + if o == nil || o.CostCollectionEnabled == nil { + return nil, false + } + return o.CostCollectionEnabled, true +} + +// HasCostCollectionEnabled returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasCostCollectionEnabled() bool { + return o != nil && o.CostCollectionEnabled != nil +} + +// SetCostCollectionEnabled gets a reference to the given bool and assigns it to the CostCollectionEnabled field. +func (o *TenancyConfigDataAttributes) SetCostCollectionEnabled(v bool) { + o.CostCollectionEnabled = &v +} + +// GetDdCompartmentId returns the DdCompartmentId field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetDdCompartmentId() string { + if o == nil || o.DdCompartmentId == nil { + var ret string + return ret + } + return *o.DdCompartmentId +} + +// GetDdCompartmentIdOk returns a tuple with the DdCompartmentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetDdCompartmentIdOk() (*string, bool) { + if o == nil || o.DdCompartmentId == nil { + return nil, false + } + return o.DdCompartmentId, true +} + +// HasDdCompartmentId returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasDdCompartmentId() bool { + return o != nil && o.DdCompartmentId != nil +} + +// SetDdCompartmentId gets a reference to the given string and assigns it to the DdCompartmentId field. +func (o *TenancyConfigDataAttributes) SetDdCompartmentId(v string) { + o.DdCompartmentId = &v +} + +// GetDdStackId returns the DdStackId field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetDdStackId() string { + if o == nil || o.DdStackId == nil { + var ret string + return ret + } + return *o.DdStackId +} + +// GetDdStackIdOk returns a tuple with the DdStackId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetDdStackIdOk() (*string, bool) { + if o == nil || o.DdStackId == nil { + return nil, false + } + return o.DdStackId, true +} + +// HasDdStackId returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasDdStackId() bool { + return o != nil && o.DdStackId != nil +} + +// SetDdStackId gets a reference to the given string and assigns it to the DdStackId field. +func (o *TenancyConfigDataAttributes) SetDdStackId(v string) { + o.DdStackId = &v +} + +// GetHomeRegion returns the HomeRegion field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetHomeRegion() string { + if o == nil || o.HomeRegion == nil { + var ret string + return ret + } + return *o.HomeRegion +} + +// GetHomeRegionOk returns a tuple with the HomeRegion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetHomeRegionOk() (*string, bool) { + if o == nil || o.HomeRegion == nil { + return nil, false + } + return o.HomeRegion, true +} + +// HasHomeRegion returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasHomeRegion() bool { + return o != nil && o.HomeRegion != nil +} + +// SetHomeRegion gets a reference to the given string and assigns it to the HomeRegion field. +func (o *TenancyConfigDataAttributes) SetHomeRegion(v string) { + o.HomeRegion = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetLogsConfig() TenancyConfigDataAttributesLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret TenancyConfigDataAttributesLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetLogsConfigOk() (*TenancyConfigDataAttributesLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given TenancyConfigDataAttributesLogsConfig and assigns it to the LogsConfig field. +func (o *TenancyConfigDataAttributes) SetLogsConfig(v TenancyConfigDataAttributesLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetMetricsConfig() TenancyConfigDataAttributesMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret TenancyConfigDataAttributesMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetMetricsConfigOk() (*TenancyConfigDataAttributesMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given TenancyConfigDataAttributesMetricsConfig and assigns it to the MetricsConfig field. +func (o *TenancyConfigDataAttributes) SetMetricsConfig(v TenancyConfigDataAttributesMetricsConfig) { + o.MetricsConfig = &v +} + +// GetParentTenancyName returns the ParentTenancyName field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetParentTenancyName() string { + if o == nil || o.ParentTenancyName == nil { + var ret string + return ret + } + return *o.ParentTenancyName +} + +// GetParentTenancyNameOk returns a tuple with the ParentTenancyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetParentTenancyNameOk() (*string, bool) { + if o == nil || o.ParentTenancyName == nil { + return nil, false + } + return o.ParentTenancyName, true +} + +// HasParentTenancyName returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasParentTenancyName() bool { + return o != nil && o.ParentTenancyName != nil +} + +// SetParentTenancyName gets a reference to the given string and assigns it to the ParentTenancyName field. +func (o *TenancyConfigDataAttributes) SetParentTenancyName(v string) { + o.ParentTenancyName = &v +} + +// GetRegionsConfig returns the RegionsConfig field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetRegionsConfig() TenancyConfigDataAttributesRegionsConfig { + if o == nil || o.RegionsConfig == nil { + var ret TenancyConfigDataAttributesRegionsConfig + return ret + } + return *o.RegionsConfig +} + +// GetRegionsConfigOk returns a tuple with the RegionsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetRegionsConfigOk() (*TenancyConfigDataAttributesRegionsConfig, bool) { + if o == nil || o.RegionsConfig == nil { + return nil, false + } + return o.RegionsConfig, true +} + +// HasRegionsConfig returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasRegionsConfig() bool { + return o != nil && o.RegionsConfig != nil +} + +// SetRegionsConfig gets a reference to the given TenancyConfigDataAttributesRegionsConfig and assigns it to the RegionsConfig field. +func (o *TenancyConfigDataAttributes) SetRegionsConfig(v TenancyConfigDataAttributesRegionsConfig) { + o.RegionsConfig = &v +} + +// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetResourceCollectionEnabled() bool { + if o == nil || o.ResourceCollectionEnabled == nil { + var ret bool + return ret + } + return *o.ResourceCollectionEnabled +} + +// GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetResourceCollectionEnabledOk() (*bool, bool) { + if o == nil || o.ResourceCollectionEnabled == nil { + return nil, false + } + return o.ResourceCollectionEnabled, true +} + +// HasResourceCollectionEnabled returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasResourceCollectionEnabled() bool { + return o != nil && o.ResourceCollectionEnabled != nil +} + +// SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field. +func (o *TenancyConfigDataAttributes) SetResourceCollectionEnabled(v bool) { + o.ResourceCollectionEnabled = &v +} + +// GetTenancyName returns the TenancyName field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetTenancyName() string { + if o == nil || o.TenancyName == nil { + var ret string + return ret + } + return *o.TenancyName +} + +// GetTenancyNameOk returns a tuple with the TenancyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetTenancyNameOk() (*string, bool) { + if o == nil || o.TenancyName == nil { + return nil, false + } + return o.TenancyName, true +} + +// HasTenancyName returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasTenancyName() bool { + return o != nil && o.TenancyName != nil +} + +// SetTenancyName gets a reference to the given string and assigns it to the TenancyName field. +func (o *TenancyConfigDataAttributes) SetTenancyName(v string) { + o.TenancyName = &v +} + +// GetUserOcid returns the UserOcid field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributes) GetUserOcid() string { + if o == nil || o.UserOcid == nil { + var ret string + return ret + } + return *o.UserOcid +} + +// GetUserOcidOk returns a tuple with the UserOcid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributes) GetUserOcidOk() (*string, bool) { + if o == nil || o.UserOcid == nil { + return nil, false + } + return o.UserOcid, true +} + +// HasUserOcid returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributes) HasUserOcid() bool { + return o != nil && o.UserOcid != nil +} + +// SetUserOcid gets a reference to the given string and assigns it to the UserOcid field. +func (o *TenancyConfigDataAttributes) SetUserOcid(v string) { + o.UserOcid = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfigDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.BillingPlanId != nil { + toSerialize["billing_plan_id"] = o.BillingPlanId + } + if o.ConfigVersion != nil { + toSerialize["config_version"] = o.ConfigVersion + } + if o.CostCollectionEnabled != nil { + toSerialize["cost_collection_enabled"] = o.CostCollectionEnabled + } + if o.DdCompartmentId != nil { + toSerialize["dd_compartment_id"] = o.DdCompartmentId + } + if o.DdStackId != nil { + toSerialize["dd_stack_id"] = o.DdStackId + } + if o.HomeRegion != nil { + toSerialize["home_region"] = o.HomeRegion + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.ParentTenancyName != nil { + toSerialize["parent_tenancy_name"] = o.ParentTenancyName + } + if o.RegionsConfig != nil { + toSerialize["regions_config"] = o.RegionsConfig + } + if o.ResourceCollectionEnabled != nil { + toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled + } + if o.TenancyName != nil { + toSerialize["tenancy_name"] = o.TenancyName + } + if o.UserOcid != nil { + toSerialize["user_ocid"] = o.UserOcid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyConfigDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + BillingPlanId *int32 `json:"billing_plan_id,omitempty"` + ConfigVersion *int64 `json:"config_version,omitempty"` + CostCollectionEnabled *bool `json:"cost_collection_enabled,omitempty"` + DdCompartmentId *string `json:"dd_compartment_id,omitempty"` + DdStackId *string `json:"dd_stack_id,omitempty"` + HomeRegion *string `json:"home_region,omitempty"` + LogsConfig *TenancyConfigDataAttributesLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *TenancyConfigDataAttributesMetricsConfig `json:"metrics_config,omitempty"` + ParentTenancyName *string `json:"parent_tenancy_name,omitempty"` + RegionsConfig *TenancyConfigDataAttributesRegionsConfig `json:"regions_config,omitempty"` + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + TenancyName *string `json:"tenancy_name,omitempty"` + UserOcid *string `json:"user_ocid,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{"billing_plan_id", "config_version", "cost_collection_enabled", "dd_compartment_id", "dd_stack_id", "home_region", "logs_config", "metrics_config", "parent_tenancy_name", "regions_config", "resource_collection_enabled", "tenancy_name", "user_ocid"}) + } else { + return err + } + + hasInvalidField := false + o.BillingPlanId = all.BillingPlanId + o.ConfigVersion = all.ConfigVersion + o.CostCollectionEnabled = all.CostCollectionEnabled + o.DdCompartmentId = all.DdCompartmentId + o.DdStackId = all.DdStackId + o.HomeRegion = all.HomeRegion + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + o.ParentTenancyName = all.ParentTenancyName + if all.RegionsConfig != nil && all.RegionsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.RegionsConfig = all.RegionsConfig + o.ResourceCollectionEnabled = all.ResourceCollectionEnabled + o.TenancyName = all.TenancyName + o.UserOcid = all.UserOcid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_config_data_attributes_logs_config.go b/api/datadogV2/model_tenancy_config_data_attributes_logs_config.go new file mode 100644 index 00000000000..fdffa64b5ad --- /dev/null +++ b/api/datadogV2/model_tenancy_config_data_attributes_logs_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// TenancyConfigDataAttributesLogsConfig +type TenancyConfigDataAttributesLogsConfig struct { + // + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + // + Enabled *bool `json:"enabled,omitempty"` + // + EnabledServices []string `json:"enabled_services,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:"-"` +} + +// NewTenancyConfigDataAttributesLogsConfig instantiates a new TenancyConfigDataAttributesLogsConfig 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 NewTenancyConfigDataAttributesLogsConfig() *TenancyConfigDataAttributesLogsConfig { + this := TenancyConfigDataAttributesLogsConfig{} + return &this +} + +// NewTenancyConfigDataAttributesLogsConfigWithDefaults instantiates a new TenancyConfigDataAttributesLogsConfig 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 NewTenancyConfigDataAttributesLogsConfigWithDefaults() *TenancyConfigDataAttributesLogsConfig { + this := TenancyConfigDataAttributesLogsConfig{} + return &this +} + +// GetCompartmentTagFilters returns the CompartmentTagFilters field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesLogsConfig) GetCompartmentTagFilters() []string { + if o == nil || o.CompartmentTagFilters == nil { + var ret []string + return ret + } + return o.CompartmentTagFilters +} + +// GetCompartmentTagFiltersOk returns a tuple with the CompartmentTagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesLogsConfig) GetCompartmentTagFiltersOk() (*[]string, bool) { + if o == nil || o.CompartmentTagFilters == nil { + return nil, false + } + return &o.CompartmentTagFilters, true +} + +// HasCompartmentTagFilters returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesLogsConfig) HasCompartmentTagFilters() bool { + return o != nil && o.CompartmentTagFilters != nil +} + +// SetCompartmentTagFilters gets a reference to the given []string and assigns it to the CompartmentTagFilters field. +func (o *TenancyConfigDataAttributesLogsConfig) SetCompartmentTagFilters(v []string) { + o.CompartmentTagFilters = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesLogsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesLogsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesLogsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *TenancyConfigDataAttributesLogsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetEnabledServices returns the EnabledServices field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesLogsConfig) GetEnabledServices() []string { + if o == nil || o.EnabledServices == nil { + var ret []string + return ret + } + return o.EnabledServices +} + +// GetEnabledServicesOk returns a tuple with the EnabledServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesLogsConfig) GetEnabledServicesOk() (*[]string, bool) { + if o == nil || o.EnabledServices == nil { + return nil, false + } + return &o.EnabledServices, true +} + +// HasEnabledServices returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesLogsConfig) HasEnabledServices() bool { + return o != nil && o.EnabledServices != nil +} + +// SetEnabledServices gets a reference to the given []string and assigns it to the EnabledServices field. +func (o *TenancyConfigDataAttributesLogsConfig) SetEnabledServices(v []string) { + o.EnabledServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfigDataAttributesLogsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CompartmentTagFilters != nil { + toSerialize["compartment_tag_filters"] = o.CompartmentTagFilters + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.EnabledServices != nil { + toSerialize["enabled_services"] = o.EnabledServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyConfigDataAttributesLogsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EnabledServices []string `json:"enabled_services,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{"compartment_tag_filters", "enabled", "enabled_services"}) + } else { + return err + } + o.CompartmentTagFilters = all.CompartmentTagFilters + o.Enabled = all.Enabled + o.EnabledServices = all.EnabledServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_config_data_attributes_metrics_config.go b/api/datadogV2/model_tenancy_config_data_attributes_metrics_config.go new file mode 100644 index 00000000000..416bb449ddc --- /dev/null +++ b/api/datadogV2/model_tenancy_config_data_attributes_metrics_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// TenancyConfigDataAttributesMetricsConfig +type TenancyConfigDataAttributesMetricsConfig struct { + // + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + // + Enabled *bool `json:"enabled,omitempty"` + // + ExcludedServices []string `json:"excluded_services,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:"-"` +} + +// NewTenancyConfigDataAttributesMetricsConfig instantiates a new TenancyConfigDataAttributesMetricsConfig 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 NewTenancyConfigDataAttributesMetricsConfig() *TenancyConfigDataAttributesMetricsConfig { + this := TenancyConfigDataAttributesMetricsConfig{} + return &this +} + +// NewTenancyConfigDataAttributesMetricsConfigWithDefaults instantiates a new TenancyConfigDataAttributesMetricsConfig 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 NewTenancyConfigDataAttributesMetricsConfigWithDefaults() *TenancyConfigDataAttributesMetricsConfig { + this := TenancyConfigDataAttributesMetricsConfig{} + return &this +} + +// GetCompartmentTagFilters returns the CompartmentTagFilters field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesMetricsConfig) GetCompartmentTagFilters() []string { + if o == nil || o.CompartmentTagFilters == nil { + var ret []string + return ret + } + return o.CompartmentTagFilters +} + +// GetCompartmentTagFiltersOk returns a tuple with the CompartmentTagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesMetricsConfig) GetCompartmentTagFiltersOk() (*[]string, bool) { + if o == nil || o.CompartmentTagFilters == nil { + return nil, false + } + return &o.CompartmentTagFilters, true +} + +// HasCompartmentTagFilters returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesMetricsConfig) HasCompartmentTagFilters() bool { + return o != nil && o.CompartmentTagFilters != nil +} + +// SetCompartmentTagFilters gets a reference to the given []string and assigns it to the CompartmentTagFilters field. +func (o *TenancyConfigDataAttributesMetricsConfig) SetCompartmentTagFilters(v []string) { + o.CompartmentTagFilters = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesMetricsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesMetricsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesMetricsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *TenancyConfigDataAttributesMetricsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExcludedServices returns the ExcludedServices field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesMetricsConfig) GetExcludedServices() []string { + if o == nil || o.ExcludedServices == nil { + var ret []string + return ret + } + return o.ExcludedServices +} + +// GetExcludedServicesOk returns a tuple with the ExcludedServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesMetricsConfig) GetExcludedServicesOk() (*[]string, bool) { + if o == nil || o.ExcludedServices == nil { + return nil, false + } + return &o.ExcludedServices, true +} + +// HasExcludedServices returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesMetricsConfig) HasExcludedServices() bool { + return o != nil && o.ExcludedServices != nil +} + +// SetExcludedServices gets a reference to the given []string and assigns it to the ExcludedServices field. +func (o *TenancyConfigDataAttributesMetricsConfig) SetExcludedServices(v []string) { + o.ExcludedServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfigDataAttributesMetricsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CompartmentTagFilters != nil { + toSerialize["compartment_tag_filters"] = o.CompartmentTagFilters + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ExcludedServices != nil { + toSerialize["excluded_services"] = o.ExcludedServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyConfigDataAttributesMetricsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + ExcludedServices []string `json:"excluded_services,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{"compartment_tag_filters", "enabled", "excluded_services"}) + } else { + return err + } + o.CompartmentTagFilters = all.CompartmentTagFilters + o.Enabled = all.Enabled + o.ExcludedServices = all.ExcludedServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_config_data_attributes_regions_config.go b/api/datadogV2/model_tenancy_config_data_attributes_regions_config.go new file mode 100644 index 00000000000..e391cc3f7f0 --- /dev/null +++ b/api/datadogV2/model_tenancy_config_data_attributes_regions_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// TenancyConfigDataAttributesRegionsConfig +type TenancyConfigDataAttributesRegionsConfig struct { + // + Available []string `json:"available,omitempty"` + // + Disabled []string `json:"disabled,omitempty"` + // + Enabled []string `json:"enabled,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:"-"` +} + +// NewTenancyConfigDataAttributesRegionsConfig instantiates a new TenancyConfigDataAttributesRegionsConfig 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 NewTenancyConfigDataAttributesRegionsConfig() *TenancyConfigDataAttributesRegionsConfig { + this := TenancyConfigDataAttributesRegionsConfig{} + return &this +} + +// NewTenancyConfigDataAttributesRegionsConfigWithDefaults instantiates a new TenancyConfigDataAttributesRegionsConfig 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 NewTenancyConfigDataAttributesRegionsConfigWithDefaults() *TenancyConfigDataAttributesRegionsConfig { + this := TenancyConfigDataAttributesRegionsConfig{} + return &this +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesRegionsConfig) GetAvailable() []string { + if o == nil || o.Available == nil { + var ret []string + return ret + } + return o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesRegionsConfig) GetAvailableOk() (*[]string, bool) { + if o == nil || o.Available == nil { + return nil, false + } + return &o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesRegionsConfig) HasAvailable() bool { + return o != nil && o.Available != nil +} + +// SetAvailable gets a reference to the given []string and assigns it to the Available field. +func (o *TenancyConfigDataAttributesRegionsConfig) SetAvailable(v []string) { + o.Available = v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesRegionsConfig) GetDisabled() []string { + if o == nil || o.Disabled == nil { + var ret []string + return ret + } + return o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesRegionsConfig) GetDisabledOk() (*[]string, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return &o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesRegionsConfig) HasDisabled() bool { + return o != nil && o.Disabled != nil +} + +// SetDisabled gets a reference to the given []string and assigns it to the Disabled field. +func (o *TenancyConfigDataAttributesRegionsConfig) SetDisabled(v []string) { + o.Disabled = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *TenancyConfigDataAttributesRegionsConfig) GetEnabled() []string { + if o == nil || o.Enabled == nil { + var ret []string + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyConfigDataAttributesRegionsConfig) GetEnabledOk() (*[]string, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return &o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *TenancyConfigDataAttributesRegionsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given []string and assigns it to the Enabled field. +func (o *TenancyConfigDataAttributesRegionsConfig) SetEnabled(v []string) { + o.Enabled = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfigDataAttributesRegionsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Available != nil { + toSerialize["available"] = o.Available + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyConfigDataAttributesRegionsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Available []string `json:"available,omitempty"` + Disabled []string `json:"disabled,omitempty"` + Enabled []string `json:"enabled,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{"available", "disabled", "enabled"}) + } else { + return err + } + o.Available = all.Available + o.Disabled = all.Disabled + o.Enabled = all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_config_list.go b/api/datadogV2/model_tenancy_config_list.go new file mode 100644 index 00000000000..94cb5515a9d --- /dev/null +++ b/api/datadogV2/model_tenancy_config_list.go @@ -0,0 +1,101 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TenancyConfigList +type TenancyConfigList struct { + // + Data []TenancyConfigData `json:"data"` + // 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:"-"` +} + +// NewTenancyConfigList instantiates a new TenancyConfigList 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 NewTenancyConfigList(data []TenancyConfigData) *TenancyConfigList { + this := TenancyConfigList{} + this.Data = data + return &this +} + +// NewTenancyConfigListWithDefaults instantiates a new TenancyConfigList 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 NewTenancyConfigListWithDefaults() *TenancyConfigList { + this := TenancyConfigList{} + return &this +} + +// GetData returns the Data field value. +func (o *TenancyConfigList) GetData() []TenancyConfigData { + if o == nil { + var ret []TenancyConfigData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TenancyConfigList) GetDataOk() (*[]TenancyConfigData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TenancyConfigList) SetData(v []TenancyConfigData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyConfigList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyConfigList) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]TenancyConfigData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_products_data.go b/api/datadogV2/model_tenancy_products_data.go new file mode 100644 index 00000000000..2b7e98aceee --- /dev/null +++ b/api/datadogV2/model_tenancy_products_data.go @@ -0,0 +1,186 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TenancyProductsData +type TenancyProductsData struct { + // + Attributes *TenancyProductsDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // OCI tenancy product resource type. + Type TenancyProductsDataType `json:"type"` + // 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:"-"` +} + +// NewTenancyProductsData instantiates a new TenancyProductsData 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 NewTenancyProductsData(typeVar TenancyProductsDataType) *TenancyProductsData { + this := TenancyProductsData{} + this.Type = typeVar + return &this +} + +// NewTenancyProductsDataWithDefaults instantiates a new TenancyProductsData 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 NewTenancyProductsDataWithDefaults() *TenancyProductsData { + this := TenancyProductsData{} + var typeVar TenancyProductsDataType = TENANCYPRODUCTSDATATYPE_OCI_TENANCY_PRODUCT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *TenancyProductsData) GetAttributes() TenancyProductsDataAttributes { + if o == nil || o.Attributes == nil { + var ret TenancyProductsDataAttributes + 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 *TenancyProductsData) GetAttributesOk() (*TenancyProductsDataAttributes, 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 *TenancyProductsData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given TenancyProductsDataAttributes and assigns it to the Attributes field. +func (o *TenancyProductsData) SetAttributes(v TenancyProductsDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *TenancyProductsData) 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 *TenancyProductsData) 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 *TenancyProductsData) 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 *TenancyProductsData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *TenancyProductsData) GetType() TenancyProductsDataType { + if o == nil { + var ret TenancyProductsDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TenancyProductsData) GetTypeOk() (*TenancyProductsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TenancyProductsData) SetType(v TenancyProductsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyProductsData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyProductsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TenancyProductsDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *TenancyProductsDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + 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 + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_tenancy_products_data_attributes.go b/api/datadogV2/model_tenancy_products_data_attributes.go new file mode 100644 index 00000000000..f6d77525a83 --- /dev/null +++ b/api/datadogV2/model_tenancy_products_data_attributes.go @@ -0,0 +1,102 @@ +// 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" +) + +// TenancyProductsDataAttributes +type TenancyProductsDataAttributes struct { + // + Products []TenancyProductsDataAttributesProductsItems `json:"products,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:"-"` +} + +// NewTenancyProductsDataAttributes instantiates a new TenancyProductsDataAttributes 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 NewTenancyProductsDataAttributes() *TenancyProductsDataAttributes { + this := TenancyProductsDataAttributes{} + return &this +} + +// NewTenancyProductsDataAttributesWithDefaults instantiates a new TenancyProductsDataAttributes 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 NewTenancyProductsDataAttributesWithDefaults() *TenancyProductsDataAttributes { + this := TenancyProductsDataAttributes{} + return &this +} + +// GetProducts returns the Products field value if set, zero value otherwise. +func (o *TenancyProductsDataAttributes) GetProducts() []TenancyProductsDataAttributesProductsItems { + if o == nil || o.Products == nil { + var ret []TenancyProductsDataAttributesProductsItems + return ret + } + return o.Products +} + +// GetProductsOk returns a tuple with the Products field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyProductsDataAttributes) GetProductsOk() (*[]TenancyProductsDataAttributesProductsItems, bool) { + if o == nil || o.Products == nil { + return nil, false + } + return &o.Products, true +} + +// HasProducts returns a boolean if a field has been set. +func (o *TenancyProductsDataAttributes) HasProducts() bool { + return o != nil && o.Products != nil +} + +// SetProducts gets a reference to the given []TenancyProductsDataAttributesProductsItems and assigns it to the Products field. +func (o *TenancyProductsDataAttributes) SetProducts(v []TenancyProductsDataAttributesProductsItems) { + o.Products = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyProductsDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Products != nil { + toSerialize["products"] = o.Products + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyProductsDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Products []TenancyProductsDataAttributesProductsItems `json:"products,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{"products"}) + } else { + return err + } + o.Products = all.Products + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_products_data_attributes_products_items.go b/api/datadogV2/model_tenancy_products_data_attributes_products_items.go new file mode 100644 index 00000000000..6f781b10c38 --- /dev/null +++ b/api/datadogV2/model_tenancy_products_data_attributes_products_items.go @@ -0,0 +1,137 @@ +// 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" +) + +// TenancyProductsDataAttributesProductsItems +type TenancyProductsDataAttributesProductsItems struct { + // + Enabled *bool `json:"enabled,omitempty"` + // + ProductKey *string `json:"product_key,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:"-"` +} + +// NewTenancyProductsDataAttributesProductsItems instantiates a new TenancyProductsDataAttributesProductsItems 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 NewTenancyProductsDataAttributesProductsItems() *TenancyProductsDataAttributesProductsItems { + this := TenancyProductsDataAttributesProductsItems{} + return &this +} + +// NewTenancyProductsDataAttributesProductsItemsWithDefaults instantiates a new TenancyProductsDataAttributesProductsItems 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 NewTenancyProductsDataAttributesProductsItemsWithDefaults() *TenancyProductsDataAttributesProductsItems { + this := TenancyProductsDataAttributesProductsItems{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *TenancyProductsDataAttributesProductsItems) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyProductsDataAttributesProductsItems) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *TenancyProductsDataAttributesProductsItems) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *TenancyProductsDataAttributesProductsItems) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetProductKey returns the ProductKey field value if set, zero value otherwise. +func (o *TenancyProductsDataAttributesProductsItems) GetProductKey() string { + if o == nil || o.ProductKey == nil { + var ret string + return ret + } + return *o.ProductKey +} + +// GetProductKeyOk returns a tuple with the ProductKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TenancyProductsDataAttributesProductsItems) GetProductKeyOk() (*string, bool) { + if o == nil || o.ProductKey == nil { + return nil, false + } + return o.ProductKey, true +} + +// HasProductKey returns a boolean if a field has been set. +func (o *TenancyProductsDataAttributesProductsItems) HasProductKey() bool { + return o != nil && o.ProductKey != nil +} + +// SetProductKey gets a reference to the given string and assigns it to the ProductKey field. +func (o *TenancyProductsDataAttributesProductsItems) SetProductKey(v string) { + o.ProductKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyProductsDataAttributesProductsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ProductKey != nil { + toSerialize["product_key"] = o.ProductKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyProductsDataAttributesProductsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + ProductKey *string `json:"product_key,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled", "product_key"}) + } else { + return err + } + o.Enabled = all.Enabled + o.ProductKey = all.ProductKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_tenancy_products_data_type.go b/api/datadogV2/model_tenancy_products_data_type.go new file mode 100644 index 00000000000..6a6a6c064b6 --- /dev/null +++ b/api/datadogV2/model_tenancy_products_data_type.go @@ -0,0 +1,64 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TenancyProductsDataType OCI tenancy product resource type. +type TenancyProductsDataType string + +// List of TenancyProductsDataType. +const ( + TENANCYPRODUCTSDATATYPE_OCI_TENANCY_PRODUCT TenancyProductsDataType = "oci_tenancy_product" +) + +var allowedTenancyProductsDataTypeEnumValues = []TenancyProductsDataType{ + TENANCYPRODUCTSDATATYPE_OCI_TENANCY_PRODUCT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TenancyProductsDataType) GetAllowedValues() []TenancyProductsDataType { + return allowedTenancyProductsDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TenancyProductsDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TenancyProductsDataType(value) + return nil +} + +// NewTenancyProductsDataTypeFromValue returns a pointer to a valid TenancyProductsDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTenancyProductsDataTypeFromValue(v string) (*TenancyProductsDataType, error) { + ev := TenancyProductsDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TenancyProductsDataType: valid values are %v", v, allowedTenancyProductsDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TenancyProductsDataType) IsValid() bool { + for _, existing := range allowedTenancyProductsDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TenancyProductsDataType value. +func (v TenancyProductsDataType) Ptr() *TenancyProductsDataType { + return &v +} diff --git a/api/datadogV2/model_tenancy_products_list.go b/api/datadogV2/model_tenancy_products_list.go new file mode 100644 index 00000000000..ebbb42b5549 --- /dev/null +++ b/api/datadogV2/model_tenancy_products_list.go @@ -0,0 +1,101 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TenancyProductsList +type TenancyProductsList struct { + // + Data []TenancyProductsData `json:"data"` + // 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:"-"` +} + +// NewTenancyProductsList instantiates a new TenancyProductsList 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 NewTenancyProductsList(data []TenancyProductsData) *TenancyProductsList { + this := TenancyProductsList{} + this.Data = data + return &this +} + +// NewTenancyProductsListWithDefaults instantiates a new TenancyProductsList 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 NewTenancyProductsListWithDefaults() *TenancyProductsList { + this := TenancyProductsList{} + return &this +} + +// GetData returns the Data field value. +func (o *TenancyProductsList) GetData() []TenancyProductsData { + if o == nil { + var ret []TenancyProductsData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TenancyProductsList) GetDataOk() (*[]TenancyProductsData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TenancyProductsList) SetData(v []TenancyProductsData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TenancyProductsList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TenancyProductsList) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]TenancyProductsData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_tenancy_config_data.go b/api/datadogV2/model_update_tenancy_config_data.go new file mode 100644 index 00000000000..f75e9dc8d65 --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data.go @@ -0,0 +1,183 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UpdateTenancyConfigData +type UpdateTenancyConfigData struct { + // + Attributes *UpdateTenancyConfigDataAttributes `json:"attributes,omitempty"` + // + Id string `json:"id"` + // OCI tenancy resource type. + Type UpdateTenancyConfigDataType `json:"type"` + // 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:"-"` +} + +// NewUpdateTenancyConfigData instantiates a new UpdateTenancyConfigData 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 NewUpdateTenancyConfigData(id string, typeVar UpdateTenancyConfigDataType) *UpdateTenancyConfigData { + this := UpdateTenancyConfigData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewUpdateTenancyConfigDataWithDefaults instantiates a new UpdateTenancyConfigData 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 NewUpdateTenancyConfigDataWithDefaults() *UpdateTenancyConfigData { + this := UpdateTenancyConfigData{} + var typeVar UpdateTenancyConfigDataType = UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UpdateTenancyConfigData) GetAttributes() UpdateTenancyConfigDataAttributes { + if o == nil || o.Attributes == nil { + var ret UpdateTenancyConfigDataAttributes + 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 *UpdateTenancyConfigData) GetAttributesOk() (*UpdateTenancyConfigDataAttributes, 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 *UpdateTenancyConfigData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UpdateTenancyConfigDataAttributes and assigns it to the Attributes field. +func (o *UpdateTenancyConfigData) SetAttributes(v UpdateTenancyConfigDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *UpdateTenancyConfigData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *UpdateTenancyConfigData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *UpdateTenancyConfigData) GetType() UpdateTenancyConfigDataType { + if o == nil { + var ret UpdateTenancyConfigDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigData) GetTypeOk() (*UpdateTenancyConfigDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UpdateTenancyConfigData) SetType(v UpdateTenancyConfigDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UpdateTenancyConfigDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *UpdateTenancyConfigDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + 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 + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_update_tenancy_config_data_attributes.go b/api/datadogV2/model_update_tenancy_config_data_attributes.go new file mode 100644 index 00000000000..e7860890042 --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data_attributes.go @@ -0,0 +1,365 @@ +// 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" +) + +// UpdateTenancyConfigDataAttributes +type UpdateTenancyConfigDataAttributes struct { + // + AuthCredentials *UpdateTenancyConfigDataAttributesAuthCredentials `json:"auth_credentials,omitempty"` + // + CostCollectionEnabled *bool `json:"cost_collection_enabled,omitempty"` + // + HomeRegion *string `json:"home_region,omitempty"` + // + LogsConfig *UpdateTenancyConfigDataAttributesLogsConfig `json:"logs_config,omitempty"` + // + MetricsConfig *UpdateTenancyConfigDataAttributesMetricsConfig `json:"metrics_config,omitempty"` + // + RegionsConfig *UpdateTenancyConfigDataAttributesRegionsConfig `json:"regions_config,omitempty"` + // + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + // + UserOcid *string `json:"user_ocid,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:"-"` +} + +// NewUpdateTenancyConfigDataAttributes instantiates a new UpdateTenancyConfigDataAttributes 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 NewUpdateTenancyConfigDataAttributes() *UpdateTenancyConfigDataAttributes { + this := UpdateTenancyConfigDataAttributes{} + return &this +} + +// NewUpdateTenancyConfigDataAttributesWithDefaults instantiates a new UpdateTenancyConfigDataAttributes 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 NewUpdateTenancyConfigDataAttributesWithDefaults() *UpdateTenancyConfigDataAttributes { + this := UpdateTenancyConfigDataAttributes{} + return &this +} + +// GetAuthCredentials returns the AuthCredentials field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetAuthCredentials() UpdateTenancyConfigDataAttributesAuthCredentials { + if o == nil || o.AuthCredentials == nil { + var ret UpdateTenancyConfigDataAttributesAuthCredentials + return ret + } + return *o.AuthCredentials +} + +// GetAuthCredentialsOk returns a tuple with the AuthCredentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetAuthCredentialsOk() (*UpdateTenancyConfigDataAttributesAuthCredentials, bool) { + if o == nil || o.AuthCredentials == nil { + return nil, false + } + return o.AuthCredentials, true +} + +// HasAuthCredentials returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasAuthCredentials() bool { + return o != nil && o.AuthCredentials != nil +} + +// SetAuthCredentials gets a reference to the given UpdateTenancyConfigDataAttributesAuthCredentials and assigns it to the AuthCredentials field. +func (o *UpdateTenancyConfigDataAttributes) SetAuthCredentials(v UpdateTenancyConfigDataAttributesAuthCredentials) { + o.AuthCredentials = &v +} + +// GetCostCollectionEnabled returns the CostCollectionEnabled field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetCostCollectionEnabled() bool { + if o == nil || o.CostCollectionEnabled == nil { + var ret bool + return ret + } + return *o.CostCollectionEnabled +} + +// GetCostCollectionEnabledOk returns a tuple with the CostCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetCostCollectionEnabledOk() (*bool, bool) { + if o == nil || o.CostCollectionEnabled == nil { + return nil, false + } + return o.CostCollectionEnabled, true +} + +// HasCostCollectionEnabled returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasCostCollectionEnabled() bool { + return o != nil && o.CostCollectionEnabled != nil +} + +// SetCostCollectionEnabled gets a reference to the given bool and assigns it to the CostCollectionEnabled field. +func (o *UpdateTenancyConfigDataAttributes) SetCostCollectionEnabled(v bool) { + o.CostCollectionEnabled = &v +} + +// GetHomeRegion returns the HomeRegion field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetHomeRegion() string { + if o == nil || o.HomeRegion == nil { + var ret string + return ret + } + return *o.HomeRegion +} + +// GetHomeRegionOk returns a tuple with the HomeRegion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetHomeRegionOk() (*string, bool) { + if o == nil || o.HomeRegion == nil { + return nil, false + } + return o.HomeRegion, true +} + +// HasHomeRegion returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasHomeRegion() bool { + return o != nil && o.HomeRegion != nil +} + +// SetHomeRegion gets a reference to the given string and assigns it to the HomeRegion field. +func (o *UpdateTenancyConfigDataAttributes) SetHomeRegion(v string) { + o.HomeRegion = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetLogsConfig() UpdateTenancyConfigDataAttributesLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret UpdateTenancyConfigDataAttributesLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetLogsConfigOk() (*UpdateTenancyConfigDataAttributesLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given UpdateTenancyConfigDataAttributesLogsConfig and assigns it to the LogsConfig field. +func (o *UpdateTenancyConfigDataAttributes) SetLogsConfig(v UpdateTenancyConfigDataAttributesLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetMetricsConfig() UpdateTenancyConfigDataAttributesMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret UpdateTenancyConfigDataAttributesMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetMetricsConfigOk() (*UpdateTenancyConfigDataAttributesMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given UpdateTenancyConfigDataAttributesMetricsConfig and assigns it to the MetricsConfig field. +func (o *UpdateTenancyConfigDataAttributes) SetMetricsConfig(v UpdateTenancyConfigDataAttributesMetricsConfig) { + o.MetricsConfig = &v +} + +// GetRegionsConfig returns the RegionsConfig field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetRegionsConfig() UpdateTenancyConfigDataAttributesRegionsConfig { + if o == nil || o.RegionsConfig == nil { + var ret UpdateTenancyConfigDataAttributesRegionsConfig + return ret + } + return *o.RegionsConfig +} + +// GetRegionsConfigOk returns a tuple with the RegionsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetRegionsConfigOk() (*UpdateTenancyConfigDataAttributesRegionsConfig, bool) { + if o == nil || o.RegionsConfig == nil { + return nil, false + } + return o.RegionsConfig, true +} + +// HasRegionsConfig returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasRegionsConfig() bool { + return o != nil && o.RegionsConfig != nil +} + +// SetRegionsConfig gets a reference to the given UpdateTenancyConfigDataAttributesRegionsConfig and assigns it to the RegionsConfig field. +func (o *UpdateTenancyConfigDataAttributes) SetRegionsConfig(v UpdateTenancyConfigDataAttributesRegionsConfig) { + o.RegionsConfig = &v +} + +// GetResourceCollectionEnabled returns the ResourceCollectionEnabled field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetResourceCollectionEnabled() bool { + if o == nil || o.ResourceCollectionEnabled == nil { + var ret bool + return ret + } + return *o.ResourceCollectionEnabled +} + +// GetResourceCollectionEnabledOk returns a tuple with the ResourceCollectionEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetResourceCollectionEnabledOk() (*bool, bool) { + if o == nil || o.ResourceCollectionEnabled == nil { + return nil, false + } + return o.ResourceCollectionEnabled, true +} + +// HasResourceCollectionEnabled returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasResourceCollectionEnabled() bool { + return o != nil && o.ResourceCollectionEnabled != nil +} + +// SetResourceCollectionEnabled gets a reference to the given bool and assigns it to the ResourceCollectionEnabled field. +func (o *UpdateTenancyConfigDataAttributes) SetResourceCollectionEnabled(v bool) { + o.ResourceCollectionEnabled = &v +} + +// GetUserOcid returns the UserOcid field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributes) GetUserOcid() string { + if o == nil || o.UserOcid == nil { + var ret string + return ret + } + return *o.UserOcid +} + +// GetUserOcidOk returns a tuple with the UserOcid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributes) GetUserOcidOk() (*string, bool) { + if o == nil || o.UserOcid == nil { + return nil, false + } + return o.UserOcid, true +} + +// HasUserOcid returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributes) HasUserOcid() bool { + return o != nil && o.UserOcid != nil +} + +// SetUserOcid gets a reference to the given string and assigns it to the UserOcid field. +func (o *UpdateTenancyConfigDataAttributes) SetUserOcid(v string) { + o.UserOcid = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AuthCredentials != nil { + toSerialize["auth_credentials"] = o.AuthCredentials + } + if o.CostCollectionEnabled != nil { + toSerialize["cost_collection_enabled"] = o.CostCollectionEnabled + } + if o.HomeRegion != nil { + toSerialize["home_region"] = o.HomeRegion + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.RegionsConfig != nil { + toSerialize["regions_config"] = o.RegionsConfig + } + if o.ResourceCollectionEnabled != nil { + toSerialize["resource_collection_enabled"] = o.ResourceCollectionEnabled + } + if o.UserOcid != nil { + toSerialize["user_ocid"] = o.UserOcid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AuthCredentials *UpdateTenancyConfigDataAttributesAuthCredentials `json:"auth_credentials,omitempty"` + CostCollectionEnabled *bool `json:"cost_collection_enabled,omitempty"` + HomeRegion *string `json:"home_region,omitempty"` + LogsConfig *UpdateTenancyConfigDataAttributesLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *UpdateTenancyConfigDataAttributesMetricsConfig `json:"metrics_config,omitempty"` + RegionsConfig *UpdateTenancyConfigDataAttributesRegionsConfig `json:"regions_config,omitempty"` + ResourceCollectionEnabled *bool `json:"resource_collection_enabled,omitempty"` + UserOcid *string `json:"user_ocid,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{"auth_credentials", "cost_collection_enabled", "home_region", "logs_config", "metrics_config", "regions_config", "resource_collection_enabled", "user_ocid"}) + } else { + return err + } + + hasInvalidField := false + if all.AuthCredentials != nil && all.AuthCredentials.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AuthCredentials = all.AuthCredentials + o.CostCollectionEnabled = all.CostCollectionEnabled + o.HomeRegion = all.HomeRegion + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + if all.RegionsConfig != nil && all.RegionsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.RegionsConfig = all.RegionsConfig + o.ResourceCollectionEnabled = all.ResourceCollectionEnabled + o.UserOcid = all.UserOcid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_update_tenancy_config_data_attributes_auth_credentials.go b/api/datadogV2/model_update_tenancy_config_data_attributes_auth_credentials.go new file mode 100644 index 00000000000..8a68bf65113 --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data_attributes_auth_credentials.go @@ -0,0 +1,136 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UpdateTenancyConfigDataAttributesAuthCredentials +type UpdateTenancyConfigDataAttributesAuthCredentials struct { + // + Fingerprint *string `json:"fingerprint,omitempty"` + // + PrivateKey string `json:"private_key"` + // 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:"-"` +} + +// NewUpdateTenancyConfigDataAttributesAuthCredentials instantiates a new UpdateTenancyConfigDataAttributesAuthCredentials 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 NewUpdateTenancyConfigDataAttributesAuthCredentials(privateKey string) *UpdateTenancyConfigDataAttributesAuthCredentials { + this := UpdateTenancyConfigDataAttributesAuthCredentials{} + this.PrivateKey = privateKey + return &this +} + +// NewUpdateTenancyConfigDataAttributesAuthCredentialsWithDefaults instantiates a new UpdateTenancyConfigDataAttributesAuthCredentials 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 NewUpdateTenancyConfigDataAttributesAuthCredentialsWithDefaults() *UpdateTenancyConfigDataAttributesAuthCredentials { + this := UpdateTenancyConfigDataAttributesAuthCredentials{} + return &this +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) GetFingerprint() string { + if o == nil || o.Fingerprint == nil { + var ret string + return ret + } + return *o.Fingerprint +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) GetFingerprintOk() (*string, bool) { + if o == nil || o.Fingerprint == nil { + return nil, false + } + return o.Fingerprint, true +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) HasFingerprint() bool { + return o != nil && o.Fingerprint != nil +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) SetFingerprint(v string) { + o.Fingerprint = &v +} + +// GetPrivateKey returns the PrivateKey field value. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) GetPrivateKey() string { + if o == nil { + var ret string + return ret + } + return o.PrivateKey +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) GetPrivateKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PrivateKey, true +} + +// SetPrivateKey sets field value. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) SetPrivateKey(v string) { + o.PrivateKey = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigDataAttributesAuthCredentials) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Fingerprint != nil { + toSerialize["fingerprint"] = o.Fingerprint + } + toSerialize["private_key"] = o.PrivateKey + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigDataAttributesAuthCredentials) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Fingerprint *string `json:"fingerprint,omitempty"` + PrivateKey *string `json:"private_key"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.PrivateKey == nil { + return fmt.Errorf("required field private_key missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"fingerprint", "private_key"}) + } else { + return err + } + o.Fingerprint = all.Fingerprint + o.PrivateKey = *all.PrivateKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_tenancy_config_data_attributes_logs_config.go b/api/datadogV2/model_update_tenancy_config_data_attributes_logs_config.go new file mode 100644 index 00000000000..cfa22260075 --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data_attributes_logs_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// UpdateTenancyConfigDataAttributesLogsConfig +type UpdateTenancyConfigDataAttributesLogsConfig struct { + // + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + // + Enabled *bool `json:"enabled,omitempty"` + // + EnabledServices []string `json:"enabled_services,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:"-"` +} + +// NewUpdateTenancyConfigDataAttributesLogsConfig instantiates a new UpdateTenancyConfigDataAttributesLogsConfig 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 NewUpdateTenancyConfigDataAttributesLogsConfig() *UpdateTenancyConfigDataAttributesLogsConfig { + this := UpdateTenancyConfigDataAttributesLogsConfig{} + return &this +} + +// NewUpdateTenancyConfigDataAttributesLogsConfigWithDefaults instantiates a new UpdateTenancyConfigDataAttributesLogsConfig 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 NewUpdateTenancyConfigDataAttributesLogsConfigWithDefaults() *UpdateTenancyConfigDataAttributesLogsConfig { + this := UpdateTenancyConfigDataAttributesLogsConfig{} + return &this +} + +// GetCompartmentTagFilters returns the CompartmentTagFilters field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) GetCompartmentTagFilters() []string { + if o == nil || o.CompartmentTagFilters == nil { + var ret []string + return ret + } + return o.CompartmentTagFilters +} + +// GetCompartmentTagFiltersOk returns a tuple with the CompartmentTagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) GetCompartmentTagFiltersOk() (*[]string, bool) { + if o == nil || o.CompartmentTagFilters == nil { + return nil, false + } + return &o.CompartmentTagFilters, true +} + +// HasCompartmentTagFilters returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) HasCompartmentTagFilters() bool { + return o != nil && o.CompartmentTagFilters != nil +} + +// SetCompartmentTagFilters gets a reference to the given []string and assigns it to the CompartmentTagFilters field. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) SetCompartmentTagFilters(v []string) { + o.CompartmentTagFilters = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetEnabledServices returns the EnabledServices field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) GetEnabledServices() []string { + if o == nil || o.EnabledServices == nil { + var ret []string + return ret + } + return o.EnabledServices +} + +// GetEnabledServicesOk returns a tuple with the EnabledServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) GetEnabledServicesOk() (*[]string, bool) { + if o == nil || o.EnabledServices == nil { + return nil, false + } + return &o.EnabledServices, true +} + +// HasEnabledServices returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) HasEnabledServices() bool { + return o != nil && o.EnabledServices != nil +} + +// SetEnabledServices gets a reference to the given []string and assigns it to the EnabledServices field. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) SetEnabledServices(v []string) { + o.EnabledServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigDataAttributesLogsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CompartmentTagFilters != nil { + toSerialize["compartment_tag_filters"] = o.CompartmentTagFilters + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.EnabledServices != nil { + toSerialize["enabled_services"] = o.EnabledServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigDataAttributesLogsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EnabledServices []string `json:"enabled_services,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{"compartment_tag_filters", "enabled", "enabled_services"}) + } else { + return err + } + o.CompartmentTagFilters = all.CompartmentTagFilters + o.Enabled = all.Enabled + o.EnabledServices = all.EnabledServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_tenancy_config_data_attributes_metrics_config.go b/api/datadogV2/model_update_tenancy_config_data_attributes_metrics_config.go new file mode 100644 index 00000000000..7185bd24b4b --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data_attributes_metrics_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// UpdateTenancyConfigDataAttributesMetricsConfig +type UpdateTenancyConfigDataAttributesMetricsConfig struct { + // + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + // + Enabled *bool `json:"enabled,omitempty"` + // + ExcludedServices []string `json:"excluded_services,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:"-"` +} + +// NewUpdateTenancyConfigDataAttributesMetricsConfig instantiates a new UpdateTenancyConfigDataAttributesMetricsConfig 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 NewUpdateTenancyConfigDataAttributesMetricsConfig() *UpdateTenancyConfigDataAttributesMetricsConfig { + this := UpdateTenancyConfigDataAttributesMetricsConfig{} + return &this +} + +// NewUpdateTenancyConfigDataAttributesMetricsConfigWithDefaults instantiates a new UpdateTenancyConfigDataAttributesMetricsConfig 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 NewUpdateTenancyConfigDataAttributesMetricsConfigWithDefaults() *UpdateTenancyConfigDataAttributesMetricsConfig { + this := UpdateTenancyConfigDataAttributesMetricsConfig{} + return &this +} + +// GetCompartmentTagFilters returns the CompartmentTagFilters field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) GetCompartmentTagFilters() []string { + if o == nil || o.CompartmentTagFilters == nil { + var ret []string + return ret + } + return o.CompartmentTagFilters +} + +// GetCompartmentTagFiltersOk returns a tuple with the CompartmentTagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) GetCompartmentTagFiltersOk() (*[]string, bool) { + if o == nil || o.CompartmentTagFilters == nil { + return nil, false + } + return &o.CompartmentTagFilters, true +} + +// HasCompartmentTagFilters returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) HasCompartmentTagFilters() bool { + return o != nil && o.CompartmentTagFilters != nil +} + +// SetCompartmentTagFilters gets a reference to the given []string and assigns it to the CompartmentTagFilters field. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) SetCompartmentTagFilters(v []string) { + o.CompartmentTagFilters = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExcludedServices returns the ExcludedServices field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) GetExcludedServices() []string { + if o == nil || o.ExcludedServices == nil { + var ret []string + return ret + } + return o.ExcludedServices +} + +// GetExcludedServicesOk returns a tuple with the ExcludedServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) GetExcludedServicesOk() (*[]string, bool) { + if o == nil || o.ExcludedServices == nil { + return nil, false + } + return &o.ExcludedServices, true +} + +// HasExcludedServices returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) HasExcludedServices() bool { + return o != nil && o.ExcludedServices != nil +} + +// SetExcludedServices gets a reference to the given []string and assigns it to the ExcludedServices field. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) SetExcludedServices(v []string) { + o.ExcludedServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigDataAttributesMetricsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CompartmentTagFilters != nil { + toSerialize["compartment_tag_filters"] = o.CompartmentTagFilters + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ExcludedServices != nil { + toSerialize["excluded_services"] = o.ExcludedServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigDataAttributesMetricsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CompartmentTagFilters []string `json:"compartment_tag_filters,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + ExcludedServices []string `json:"excluded_services,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{"compartment_tag_filters", "enabled", "excluded_services"}) + } else { + return err + } + o.CompartmentTagFilters = all.CompartmentTagFilters + o.Enabled = all.Enabled + o.ExcludedServices = all.ExcludedServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_tenancy_config_data_attributes_regions_config.go b/api/datadogV2/model_update_tenancy_config_data_attributes_regions_config.go new file mode 100644 index 00000000000..c1033ea8b72 --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data_attributes_regions_config.go @@ -0,0 +1,172 @@ +// 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" +) + +// UpdateTenancyConfigDataAttributesRegionsConfig +type UpdateTenancyConfigDataAttributesRegionsConfig struct { + // + Available []string `json:"available,omitempty"` + // + Disabled []string `json:"disabled,omitempty"` + // + Enabled []string `json:"enabled,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:"-"` +} + +// NewUpdateTenancyConfigDataAttributesRegionsConfig instantiates a new UpdateTenancyConfigDataAttributesRegionsConfig 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 NewUpdateTenancyConfigDataAttributesRegionsConfig() *UpdateTenancyConfigDataAttributesRegionsConfig { + this := UpdateTenancyConfigDataAttributesRegionsConfig{} + return &this +} + +// NewUpdateTenancyConfigDataAttributesRegionsConfigWithDefaults instantiates a new UpdateTenancyConfigDataAttributesRegionsConfig 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 NewUpdateTenancyConfigDataAttributesRegionsConfigWithDefaults() *UpdateTenancyConfigDataAttributesRegionsConfig { + this := UpdateTenancyConfigDataAttributesRegionsConfig{} + return &this +} + +// GetAvailable returns the Available field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) GetAvailable() []string { + if o == nil || o.Available == nil { + var ret []string + return ret + } + return o.Available +} + +// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) GetAvailableOk() (*[]string, bool) { + if o == nil || o.Available == nil { + return nil, false + } + return &o.Available, true +} + +// HasAvailable returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) HasAvailable() bool { + return o != nil && o.Available != nil +} + +// SetAvailable gets a reference to the given []string and assigns it to the Available field. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) SetAvailable(v []string) { + o.Available = v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) GetDisabled() []string { + if o == nil || o.Disabled == nil { + var ret []string + return ret + } + return o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) GetDisabledOk() (*[]string, bool) { + if o == nil || o.Disabled == nil { + return nil, false + } + return &o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) HasDisabled() bool { + return o != nil && o.Disabled != nil +} + +// SetDisabled gets a reference to the given []string and assigns it to the Disabled field. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) SetDisabled(v []string) { + o.Disabled = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) GetEnabled() []string { + if o == nil || o.Enabled == nil { + var ret []string + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) GetEnabledOk() (*[]string, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return &o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given []string and assigns it to the Enabled field. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) SetEnabled(v []string) { + o.Enabled = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigDataAttributesRegionsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Available != nil { + toSerialize["available"] = o.Available + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigDataAttributesRegionsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Available []string `json:"available,omitempty"` + Disabled []string `json:"disabled,omitempty"` + Enabled []string `json:"enabled,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{"available", "disabled", "enabled"}) + } else { + return err + } + o.Available = all.Available + o.Disabled = all.Disabled + o.Enabled = all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_tenancy_config_data_type.go b/api/datadogV2/model_update_tenancy_config_data_type.go new file mode 100644 index 00000000000..8724dc60d7c --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_data_type.go @@ -0,0 +1,64 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UpdateTenancyConfigDataType OCI tenancy resource type. +type UpdateTenancyConfigDataType string + +// List of UpdateTenancyConfigDataType. +const ( + UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY UpdateTenancyConfigDataType = "oci_tenancy" +) + +var allowedUpdateTenancyConfigDataTypeEnumValues = []UpdateTenancyConfigDataType{ + UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UpdateTenancyConfigDataType) GetAllowedValues() []UpdateTenancyConfigDataType { + return allowedUpdateTenancyConfigDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UpdateTenancyConfigDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UpdateTenancyConfigDataType(value) + return nil +} + +// NewUpdateTenancyConfigDataTypeFromValue returns a pointer to a valid UpdateTenancyConfigDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUpdateTenancyConfigDataTypeFromValue(v string) (*UpdateTenancyConfigDataType, error) { + ev := UpdateTenancyConfigDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UpdateTenancyConfigDataType: valid values are %v", v, allowedUpdateTenancyConfigDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UpdateTenancyConfigDataType) IsValid() bool { + for _, existing := range allowedUpdateTenancyConfigDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateTenancyConfigDataType value. +func (v UpdateTenancyConfigDataType) Ptr() *UpdateTenancyConfigDataType { + return &v +} diff --git a/api/datadogV2/model_update_tenancy_config_request.go b/api/datadogV2/model_update_tenancy_config_request.go new file mode 100644 index 00000000000..98026e31bfb --- /dev/null +++ b/api/datadogV2/model_update_tenancy_config_request.go @@ -0,0 +1,110 @@ +// 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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UpdateTenancyConfigRequest +type UpdateTenancyConfigRequest struct { + // + Data UpdateTenancyConfigData `json:"data"` + // 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:"-"` +} + +// NewUpdateTenancyConfigRequest instantiates a new UpdateTenancyConfigRequest 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 NewUpdateTenancyConfigRequest(data UpdateTenancyConfigData) *UpdateTenancyConfigRequest { + this := UpdateTenancyConfigRequest{} + this.Data = data + return &this +} + +// NewUpdateTenancyConfigRequestWithDefaults instantiates a new UpdateTenancyConfigRequest 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 NewUpdateTenancyConfigRequestWithDefaults() *UpdateTenancyConfigRequest { + this := UpdateTenancyConfigRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *UpdateTenancyConfigRequest) GetData() UpdateTenancyConfigData { + if o == nil { + var ret UpdateTenancyConfigData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *UpdateTenancyConfigRequest) GetDataOk() (*UpdateTenancyConfigData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *UpdateTenancyConfigRequest) SetData(v UpdateTenancyConfigData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateTenancyConfigRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateTenancyConfigRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *UpdateTenancyConfigData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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/oci-integration/CreateTenancyConfig.go b/examples/v2/oci-integration/CreateTenancyConfig.go new file mode 100644 index 00000000000..743593d4210 --- /dev/null +++ b/examples/v2/oci-integration/CreateTenancyConfig.go @@ -0,0 +1,101 @@ +// Create tenancy config returns "Created" 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() { + body := datadogV2.CreateTenancyConfigRequest{ + Data: datadogV2.CreateTenancyConfigData{ + Attributes: &datadogV2.CreateTenancyConfigDataAttributes{ + AuthCredentials: datadogV2.CreateTenancyConfigDataAttributesAuthCredentials{ + Fingerprint: datadog.PtrString(""), + PrivateKey: `----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdvSMmlfLyeD4M +QsA3WlrWBqKdWa5eVV3/uODyqT3wWMEMIJHcG3/quNs8nh9xrK1/JkQT2qoKEHqR +C5k59jN6Vp8em8ARJthMgam9K37ELt+IQ/G8ySTSuqZG8T4cHp/cs3fAclNqttOl +YnGr4RbVAgMBAAECggEAGZNLGbyCUbIRTW6Kh4d8ZVC+eZtJMqGmGJ3KfVaW8Pjn +QGWfSuJCEe2o2Y8G3phlidFauICnZ44enXA17Rhi+I/whnr7FIyQk2bR7rv+1Uhc +mOJygWX5eFFMsledgVAdIAl9Luk2nykx7Un3g6rtbl/Vs+5k4m7ITLFMpCHzsJLU +nm8kBzDOqY2JUkMd08nL88KL6QywWtal05UESzQpNFXd0e5kxYfexeMCsLsWP0mc +quMLRbn7NuBjCbe9VU2kmIvcfDDaWjurT7d5m1OXx1cc8p6P4PFZTVyCjdhiWOr3 +LQXZ4/vdZNR3zgEHypRoM6D9Yq99LWUOUEMrdiSLQQKBgQDQkh7C1OtAXnpy7F6R +W+/I3zBHici2p7A57UT7VECQ1IVGg37/uus83DkuOtdZ33JmHLAVrwLFJvUlbyjx +l6dc/1ms40L5HFdLgaVtd4k0rSPFeOSDr6evz0lX4yBuzlP0fEh+o3XHW7mwe2G+ +rWCULF/Uqza66fjbCSKMNgLIXQKBgQDBm9nZg/s4S0THWCFNWcB1tXBG0p/sH5eY +PC1H/VmTEINIixStrS4ufczf31X8rcoSjSbO7+vZDTTATdk7OLn1I2uGFVYl8M59 +86BYT2Hi7cwp7YVzOc/cJigVeBAqSRW/iYYyWBEUTiW1gbkV0sRWwhPp67m+c0sP +XpY/iEZA2QKBgB1w8tynt4l/jKNaUEMOijt9ndALWATIiOy0XG9pxi9rgGCiwTOS +DBCsOXoYHjv2eayGUijNaoOv6xzcoxfvQ1WySdNIxTRq1ru20kYwgHKqGgmO9hrM +mcwMY5r/WZ2qjFlPjeAqbL62aPDLidGjoaVo2iIoBPK/gjxQ/5f0MS4N/YQ0zWoYBueSQ0DGs +-----END PRIVATE KEY-----`, + }, + ConfigVersion: *datadog.NewNullableInt64(nil), + CostCollectionEnabled: datadog.PtrBool(true), + DdCompartmentId: datadog.PtrString("ocid.compartment.test"), + DdStackId: datadog.PtrString("ocid.stack.test"), + HomeRegion: "us-ashburn-1", + LogsConfig: &datadogV2.CreateTenancyConfigDataAttributesLogsConfig{ + CompartmentTagFilters: []string{ + "datadog:true", + "env:prod", + }, + Enabled: datadog.PtrBool(true), + EnabledServices: []string{ + "service_1", + "service_1", + }, + }, + MetricsConfig: &datadogV2.CreateTenancyConfigDataAttributesMetricsConfig{ + CompartmentTagFilters: []string{ + "datadog:true", + "env:prod", + }, + Enabled: datadog.PtrBool(true), + ExcludedServices: []string{ + "service_1", + "service_1", + }, + }, + RegionsConfig: &datadogV2.CreateTenancyConfigDataAttributesRegionsConfig{ + Available: []string{ + "us-ashburn-1", + "us-phoenix-1", + }, + Disabled: []string{ + "us-phoenix-1", + }, + Enabled: []string{ + "us-ashburn-1", + }, + }, + ResourceCollectionEnabled: datadog.PtrBool(true), + UserOcid: "ocid.user.test", + }, + Id: "ocid.tenancy.test", + Type: datadogV2.UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateTenancyConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOCIIntegrationApi(apiClient) + resp, r, err := api.CreateTenancyConfig(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.CreateTenancyConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.CreateTenancyConfig`:\n%s\n", responseContent) +} diff --git a/examples/v2/oci-integration/DeleteTenancyConfig.go b/examples/v2/oci-integration/DeleteTenancyConfig.go new file mode 100644 index 00000000000..f67e169beaa --- /dev/null +++ b/examples/v2/oci-integration/DeleteTenancyConfig.go @@ -0,0 +1,25 @@ +// Delete tenancy config returns "No Content" response + +package main + +import ( + "context" + "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.NewOCIIntegrationApi(apiClient) + r, err := api.DeleteTenancyConfig(ctx, "tenancy_ocid") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.DeleteTenancyConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/oci-integration/GetTenancyConfig.go b/examples/v2/oci-integration/GetTenancyConfig.go new file mode 100644 index 00000000000..844f981c33c --- /dev/null +++ b/examples/v2/oci-integration/GetTenancyConfig.go @@ -0,0 +1,29 @@ +// Get tenancy config 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.NewOCIIntegrationApi(apiClient) + resp, r, err := api.GetTenancyConfig(ctx, "tenancy_ocid") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.GetTenancyConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.GetTenancyConfig`:\n%s\n", responseContent) +} diff --git a/examples/v2/oci-integration/GetTenancyConfigs.go b/examples/v2/oci-integration/GetTenancyConfigs.go new file mode 100644 index 00000000000..5f0d89c7764 --- /dev/null +++ b/examples/v2/oci-integration/GetTenancyConfigs.go @@ -0,0 +1,30 @@ +// Get tenancy configs 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() + configuration.SetUnstableOperationEnabled("v2.GetTenancyConfigs", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOCIIntegrationApi(apiClient) + resp, r, err := api.GetTenancyConfigs(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.GetTenancyConfigs`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.GetTenancyConfigs`:\n%s\n", responseContent) +} diff --git a/examples/v2/oci-integration/ListTenancyProducts.go b/examples/v2/oci-integration/ListTenancyProducts.go new file mode 100644 index 00000000000..99554bb5012 --- /dev/null +++ b/examples/v2/oci-integration/ListTenancyProducts.go @@ -0,0 +1,29 @@ +// List tenancy products 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.NewOCIIntegrationApi(apiClient) + resp, r, err := api.ListTenancyProducts(ctx, "productKeys") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.ListTenancyProducts`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.ListTenancyProducts`:\n%s\n", responseContent) +} diff --git a/examples/v2/oci-integration/UpdateTenancyConfig.go b/examples/v2/oci-integration/UpdateTenancyConfig.go new file mode 100644 index 00000000000..47e54119c41 --- /dev/null +++ b/examples/v2/oci-integration/UpdateTenancyConfig.go @@ -0,0 +1,97 @@ +// Update tenancy config 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() { + body := datadogV2.UpdateTenancyConfigRequest{ + Data: datadogV2.UpdateTenancyConfigData{ + Attributes: &datadogV2.UpdateTenancyConfigDataAttributes{ + AuthCredentials: &datadogV2.UpdateTenancyConfigDataAttributesAuthCredentials{ + Fingerprint: datadog.PtrString(""), + PrivateKey: `----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdvSMmlfLyeD4M +QsA3WlrWBqKdWa5eVV3/uODyqT3wWMEMIJHcG3/quNs8nh9xrK1/JkQT2qoKEHqR +C5k59jN6Vp8em8ARJthMgam9K37ELt+IQ/G8ySTSuqZG8T4cHp/cs3fAclNqttOl +YnGr4RbVAgMBAAECggEAGZNLGbyCUbIRTW6Kh4d8ZVC+eZtJMqGmGJ3KfVaW8Pjn +QGWfSuJCEe2o2Y8G3phlidFauICnZ44enXA17Rhi+I/whnr7FIyQk2bR7rv+1Uhc +mOJygWX5eFFMsledgVAdIAl9Luk2nykx7Un3g6rtbl/Vs+5k4m7ITLFMpCHzsJLU +nm8kBzDOqY2JUkMd08nL88KL6QywWtal05UESzQpNFXd0e5kxYfexeMCsLsWP0mc +quMLRbn7NuBjCbe9VU2kmIvcfDDaWjurT7d5m1OXx1cc8p6P4PFZTVyCjdhiWOr3 +LQXZ4/vdZNR3zgEHypRoM6D9Yq99LWUOUEMrdiSLQQKBgQDQkh7C1OtAXnpy7F6R +W+/I3zBHici2p7A57UT7VECQ1IVGg37/uus83DkuOtdZ33JmHLAVrwLFJvUlbyjx +l6dc/1ms40L5HFdLgaVtd4k0rSPFeOSDr6evz0lX4yBuzlP0fEh+o3XHW7mwe2G+ +rWCULF/Uqza66fjbCSKMNgLIXQKBgQDBm9nZg/s4S0THWCFNWcB1tXBG0p/sH5eY +PC1H/VmTEINIixStrS4ufczf31X8rcoSjSbO7+vZDTTATdk7OLn1I2uGFVYl8M59 +86BYT2Hi7cwp7YVzOc/cJigVeBAqSRW/iYYyWBEUTiW1gbkV0sRWwhPp67m+c0sP +XpY/iEZA2QKBgB1w8tynt4l/jKNaUEMOijt9ndALWATIiOy0XG9pxi9rgGCiwTOS +DBCsOXoYHjv2eayGUijNaoOv6xzcoxfvQ1WySdNIxTRq1ru20kYwgHKqGgmO9hrM +mcwMY5r/WZ2qjFlPjeAqbL62aPDLidGjoaVo2iIoBPK/gjxQ/5f0MS4N/YQ0zWoYBueSQ0DGs +-----END PRIVATE KEY-----`, + }, + CostCollectionEnabled: datadog.PtrBool(true), + HomeRegion: datadog.PtrString("us-ashburn-1"), + LogsConfig: &datadogV2.UpdateTenancyConfigDataAttributesLogsConfig{ + CompartmentTagFilters: []string{ + "datadog:true", + "env:prod", + }, + Enabled: datadog.PtrBool(true), + EnabledServices: []string{ + "service_1", + "service_1", + }, + }, + MetricsConfig: &datadogV2.UpdateTenancyConfigDataAttributesMetricsConfig{ + CompartmentTagFilters: []string{ + "datadog:true", + "env:prod", + }, + Enabled: datadog.PtrBool(true), + ExcludedServices: []string{ + "service_1", + "service_1", + }, + }, + RegionsConfig: &datadogV2.UpdateTenancyConfigDataAttributesRegionsConfig{ + Available: []string{ + "us-ashburn-1", + "us-phoenix-1", + }, + Disabled: []string{ + "us-phoenix-1", + }, + Enabled: []string{ + "us-ashburn-1", + }, + }, + ResourceCollectionEnabled: datadog.PtrBool(true), + UserOcid: datadog.PtrString("ocid.user.test"), + }, + Id: "ocid.tenancy.test", + Type: datadogV2.UPDATETENANCYCONFIGDATATYPE_OCI_TENANCY, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOCIIntegrationApi(apiClient) + resp, r, err := api.UpdateTenancyConfig(ctx, "tenancy_ocid", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OCIIntegrationApi.UpdateTenancyConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OCIIntegrationApi.UpdateTenancyConfig`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 30e99284cf4..2d25e86d1e9 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -85,6 +85,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "GCPIntegrationApi": reflect.ValueOf(datadogV2.NewGCPIntegrationApi), "JiraIntegrationApi": reflect.ValueOf(datadogV2.NewJiraIntegrationApi), "MicrosoftTeamsIntegrationApi": reflect.ValueOf(datadogV2.NewMicrosoftTeamsIntegrationApi), + "OCIIntegrationApi": reflect.ValueOf(datadogV2.NewOCIIntegrationApi), "OpsgenieIntegrationApi": reflect.ValueOf(datadogV2.NewOpsgenieIntegrationApi), "ServiceNowIntegrationApi": reflect.ValueOf(datadogV2.NewServiceNowIntegrationApi), "CloudflareIntegrationApi": reflect.ValueOf(datadogV2.NewCloudflareIntegrationApi), diff --git a/tests/scenarios/features/v2/oci_integration.feature b/tests/scenarios/features/v2/oci_integration.feature new file mode 100644 index 00000000000..0da91f9a063 --- /dev/null +++ b/tests/scenarios/features/v2/oci_integration.feature @@ -0,0 +1,52 @@ +@endpoint(oci-integration) @endpoint(oci-integration-v2) +Feature: OCI Integration + Auto-generated tag OCI Integration + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "OCIIntegration" API + + @generated @skip @team:DataDog/emerging-cloud-integrations + Scenario: Create tenancy config returns "Created" response + Given operation "CreateTenancyConfig" enabled + And new "CreateTenancyConfig" request + And body with value {"data": {"attributes": {"auth_credentials": {"fingerprint": "", "private_key": "----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdvSMmlfLyeD4M\nQsA3WlrWBqKdWa5eVV3/uODyqT3wWMEMIJHcG3/quNs8nh9xrK1/JkQT2qoKEHqR\nC5k59jN6Vp8em8ARJthMgam9K37ELt+IQ/G8ySTSuqZG8T4cHp/cs3fAclNqttOl\nYnGr4RbVAgMBAAECggEAGZNLGbyCUbIRTW6Kh4d8ZVC+eZtJMqGmGJ3KfVaW8Pjn\nQGWfSuJCEe2o2Y8G3phlidFauICnZ44enXA17Rhi+I/whnr7FIyQk2bR7rv+1Uhc\nmOJygWX5eFFMsledgVAdIAl9Luk2nykx7Un3g6rtbl/Vs+5k4m7ITLFMpCHzsJLU\nnm8kBzDOqY2JUkMd08nL88KL6QywWtal05UESzQpNFXd0e5kxYfexeMCsLsWP0mc\nquMLRbn7NuBjCbe9VU2kmIvcfDDaWjurT7d5m1OXx1cc8p6P4PFZTVyCjdhiWOr3\nLQXZ4/vdZNR3zgEHypRoM6D9Yq99LWUOUEMrdiSLQQKBgQDQkh7C1OtAXnpy7F6R\nW+/I3zBHici2p7A57UT7VECQ1IVGg37/uus83DkuOtdZ33JmHLAVrwLFJvUlbyjx\nl6dc/1ms40L5HFdLgaVtd4k0rSPFeOSDr6evz0lX4yBuzlP0fEh+o3XHW7mwe2G+\nrWCULF/Uqza66fjbCSKMNgLIXQKBgQDBm9nZg/s4S0THWCFNWcB1tXBG0p/sH5eY\nPC1H/VmTEINIixStrS4ufczf31X8rcoSjSbO7+vZDTTATdk7OLn1I2uGFVYl8M59\n86BYT2Hi7cwp7YVzOc/cJigVeBAqSRW/iYYyWBEUTiW1gbkV0sRWwhPp67m+c0sP\nXpY/iEZA2QKBgB1w8tynt4l/jKNaUEMOijt9ndALWATIiOy0XG9pxi9rgGCiwTOS\nDBCsOXoYHjv2eayGUijNaoOv6xzcoxfvQ1WySdNIxTRq1ru20kYwgHKqGgmO9hrM\nmcwMY5r/WZ2qjFlPjeAqbL62aPDLidGjoaVo2iIoBPK/gjxQ/5f0MS4N/YQ0zWoYBueSQ0DGs\n-----END PRIVATE KEY-----"}, "config_version": null, "cost_collection_enabled": true, "dd_compartment_id": "ocid.compartment.test", "dd_stack_id": "ocid.stack.test", "home_region": "us-ashburn-1", "logs_config": {"compartment_tag_filters": ["datadog:true", "env:prod"], "enabled": true, "enabled_services": ["service_1", "service_1"]}, "metrics_config": {"compartment_tag_filters": ["datadog:true", "env:prod"], "enabled": true, "excluded_services": ["service_1", "service_1"]}, "regions_config": {"available": ["us-ashburn-1", "us-phoenix-1"], "disabled": ["us-phoenix-1"], "enabled": ["us-ashburn-1"]}, "resource_collection_enabled": true, "user_ocid": "ocid.user.test"}, "id": "ocid.tenancy.test", "type": "oci_tenancy"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/emerging-cloud-integrations + Scenario: Delete tenancy config returns "No Content" response + Given new "DeleteTenancyConfig" request + And request contains "tenancy_ocid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/emerging-cloud-integrations + Scenario: Get tenancy config returns "OK" response + Given new "GetTenancyConfig" request + And request contains "tenancy_ocid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/emerging-cloud-integrations + Scenario: Get tenancy configs returns "OK" response + Given operation "GetTenancyConfigs" enabled + And new "GetTenancyConfigs" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/emerging-cloud-integrations + Scenario: List tenancy products returns "OK" response + Given new "ListTenancyProducts" request + And request contains "productKeys" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/emerging-cloud-integrations + Scenario: Update tenancy config returns "OK" response + Given new "UpdateTenancyConfig" request + And request contains "tenancy_ocid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"auth_credentials": {"fingerprint": "", "private_key": "----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdvSMmlfLyeD4M\nQsA3WlrWBqKdWa5eVV3/uODyqT3wWMEMIJHcG3/quNs8nh9xrK1/JkQT2qoKEHqR\nC5k59jN6Vp8em8ARJthMgam9K37ELt+IQ/G8ySTSuqZG8T4cHp/cs3fAclNqttOl\nYnGr4RbVAgMBAAECggEAGZNLGbyCUbIRTW6Kh4d8ZVC+eZtJMqGmGJ3KfVaW8Pjn\nQGWfSuJCEe2o2Y8G3phlidFauICnZ44enXA17Rhi+I/whnr7FIyQk2bR7rv+1Uhc\nmOJygWX5eFFMsledgVAdIAl9Luk2nykx7Un3g6rtbl/Vs+5k4m7ITLFMpCHzsJLU\nnm8kBzDOqY2JUkMd08nL88KL6QywWtal05UESzQpNFXd0e5kxYfexeMCsLsWP0mc\nquMLRbn7NuBjCbe9VU2kmIvcfDDaWjurT7d5m1OXx1cc8p6P4PFZTVyCjdhiWOr3\nLQXZ4/vdZNR3zgEHypRoM6D9Yq99LWUOUEMrdiSLQQKBgQDQkh7C1OtAXnpy7F6R\nW+/I3zBHici2p7A57UT7VECQ1IVGg37/uus83DkuOtdZ33JmHLAVrwLFJvUlbyjx\nl6dc/1ms40L5HFdLgaVtd4k0rSPFeOSDr6evz0lX4yBuzlP0fEh+o3XHW7mwe2G+\nrWCULF/Uqza66fjbCSKMNgLIXQKBgQDBm9nZg/s4S0THWCFNWcB1tXBG0p/sH5eY\nPC1H/VmTEINIixStrS4ufczf31X8rcoSjSbO7+vZDTTATdk7OLn1I2uGFVYl8M59\n86BYT2Hi7cwp7YVzOc/cJigVeBAqSRW/iYYyWBEUTiW1gbkV0sRWwhPp67m+c0sP\nXpY/iEZA2QKBgB1w8tynt4l/jKNaUEMOijt9ndALWATIiOy0XG9pxi9rgGCiwTOS\nDBCsOXoYHjv2eayGUijNaoOv6xzcoxfvQ1WySdNIxTRq1ru20kYwgHKqGgmO9hrM\nmcwMY5r/WZ2qjFlPjeAqbL62aPDLidGjoaVo2iIoBPK/gjxQ/5f0MS4N/YQ0zWoYBueSQ0DGs\n-----END PRIVATE KEY-----"}, "cost_collection_enabled": true, "home_region": "us-ashburn-1", "logs_config": {"compartment_tag_filters": ["datadog:true", "env:prod"], "enabled": true, "enabled_services": ["service_1", "service_1"]}, "metrics_config": {"compartment_tag_filters": ["datadog:true", "env:prod"], "enabled": true, "excluded_services": ["service_1", "service_1"]}, "regions_config": {"available": ["us-ashburn-1", "us-phoenix-1"], "disabled": ["us-phoenix-1"], "enabled": ["us-ashburn-1"]}, "resource_collection_enabled": true, "user_ocid": "ocid.user.test"}, "id": "ocid.tenancy.test", "type": "oci_tenancy"}} + 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 41fa31182a8..030260c0f8c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2241,6 +2241,49 @@ "type": "idempotent" } }, + "ListTenancyProducts": { + "tag": "OCI Integration", + "undo": { + "type": "safe" + } + }, + "GetTenancyConfigs": { + "tag": "OCI Integration", + "undo": { + "type": "safe" + } + }, + "CreateTenancyConfig": { + "tag": "OCI Integration", + "undo": { + "operationId": "DeleteTenancyConfig", + "parameters": [ + { + "name": "tenancy_ocid", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteTenancyConfig": { + "tag": "OCI Integration", + "undo": { + "type": "idempotent" + } + }, + "GetTenancyConfig": { + "tag": "OCI Integration", + "undo": { + "type": "safe" + } + }, + "UpdateTenancyConfig": { + "tag": "OCI Integration", + "undo": { + "type": "idempotent" + } + }, "ListOpsgenieServices": { "tag": "Opsgenie Integration", "undo": {