From 35d644fbcba07e0e0bbf5b6f0702a88e4f835fe8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 11 Sep 2025 13:40:43 +0000 Subject: [PATCH] Regenerate client from commit 8413651 of spec repo --- .generator/schemas/v2/openapi.yaml | 890 ++++++++++++++++++ api/datadogV2/api_actions_datastores.go | 868 +++++++++++++++++ api/datadogV2/doc.go | 9 + ...l_bulk_put_apps_datastore_items_request.go | 111 +++ ...k_put_apps_datastore_items_request_data.go | 151 +++ ...datastore_items_request_data_attributes.go | 146 +++ .../model_create_apps_datastore_request.go | 111 +++ ...odel_create_apps_datastore_request_data.go | 186 ++++ ..._apps_datastore_request_data_attributes.go | 254 +++++ ...tore_request_data_attributes_org_access.go | 68 ++ .../model_create_apps_datastore_response.go | 111 +++ ...del_create_apps_datastore_response_data.go | 148 +++ api/datadogV2/model_datastore.go | 111 +++ api/datadogV2/model_datastore_array.go | 101 ++ api/datadogV2/model_datastore_data.go | 186 ++++ .../model_datastore_data_attributes.go | 404 ++++++++ api/datadogV2/model_datastore_data_type.go | 64 ++ .../model_datastore_item_conflict_mode.go | 66 ++ .../model_datastore_items_data_type.go | 64 ++ ...tastore_primary_key_generation_strategy.go | 66 ++ ...odel_delete_apps_datastore_item_request.go | 111 +++ ...delete_apps_datastore_item_request_data.go | 151 +++ ..._datastore_item_request_data_attributes.go | 136 +++ ...del_delete_apps_datastore_item_response.go | 111 +++ ...elete_apps_datastore_item_response_data.go | 148 +++ api/datadogV2/model_item_api_payload.go | 111 +++ api/datadogV2/model_item_api_payload_array.go | 145 +++ api/datadogV2/model_item_api_payload_data.go | 186 ++++ .../model_item_api_payload_data_attributes.go | 324 +++++++ api/datadogV2/model_item_api_payload_meta.go | 149 +++ .../model_item_api_payload_meta_page.go | 172 ++++ .../model_item_api_payload_meta_schema.go | 137 +++ ...odel_item_api_payload_meta_schema_field.go | 133 +++ ..._put_apps_datastore_item_response_array.go | 101 ++ ...l_put_apps_datastore_item_response_data.go | 148 +++ ...odel_update_apps_datastore_item_request.go | 111 +++ ...update_apps_datastore_item_request_data.go | 186 ++++ ..._datastore_item_request_data_attributes.go | 177 ++++ ...em_request_data_attributes_item_changes.go | 102 ++ ...e_apps_datastore_item_request_data_type.go | 64 ++ .../model_update_apps_datastore_request.go | 111 +++ ...odel_update_apps_datastore_request_data.go | 186 ++++ ..._apps_datastore_request_data_attributes.go | 137 +++ .../BulkWriteDatastoreItems.go | 49 + .../v2/actions-datastores/CreateDatastore.go | 38 + .../v2/actions-datastores/DeleteDatastore.go | 28 + .../actions-datastores/DeleteDatastoreItem.go | 40 + .../v2/actions-datastores/GetDatastore.go | 32 + .../actions-datastores/ListDatastoreItems.go | 32 + .../v2/actions-datastores/ListDatastores.go | 29 + .../v2/actions-datastores/UpdateDatastore.go | 41 + .../actions-datastores/UpdateDatastoreItem.go | 41 + tests/scenarios/api_mappings.go | 1 + ..._items_returns_Bad_Request_response.freeze | 1 + ...re_items_returns_Bad_Request_response.yaml | 60 ++ ...re_items_returns_Not_Found_response.freeze | 1 + ...tore_items_returns_Not_Found_response.yaml | 23 + ...datastore_items_returns_OK_response.freeze | 1 + ...e_datastore_items_returns_OK_response.yaml | 59 ++ ...astore_returns_Bad_Request_response.freeze | 1 + ...atastore_returns_Bad_Request_response.yaml | 24 + ...reate_datastore_returns_OK_response.freeze | 1 + ..._Create_datastore_returns_OK_response.yaml | 39 + ...e_item_returns_Bad_Request_response.freeze | 1 + ...ore_item_returns_Bad_Request_response.yaml | 23 + ...ore_item_returns_Not_Found_response.freeze | 1 + ...store_item_returns_Not_Found_response.yaml | 23 + ..._datastore_item_returns_OK_response.freeze | 1 + ...te_datastore_item_returns_OK_response.yaml | 79 ++ ...astore_returns_Bad_Request_response.freeze | 1 + ...atastore_returns_Bad_Request_response.yaml | 20 + ...elete_datastore_returns_OK_response.freeze | 1 + ..._Delete_datastore_returns_OK_response.yaml | 56 ++ ...astore_returns_Bad_Request_response.freeze | 1 + ...atastore_returns_Bad_Request_response.yaml | 20 + ...atastore_returns_Not_Found_response.freeze | 1 + ..._datastore_returns_Not_Found_response.yaml | 20 + ...o_Get_datastore_returns_OK_response.freeze | 1 + ...rio_Get_datastore_returns_OK_response.yaml | 57 ++ ..._items_returns_Bad_Request_response.freeze | 1 + ...re_items_returns_Bad_Request_response.yaml | 20 + ...re_items_returns_Not_Found_response.freeze | 1 + ...tore_items_returns_Not_Found_response.yaml | 20 + ...datastore_items_returns_OK_response.freeze | 1 + ...t_datastore_items_returns_OK_response.yaml | 76 ++ ...List_datastores_returns_OK_response.freeze | 1 + ...o_List_datastores_returns_OK_response.yaml | 60 ++ ...e_item_returns_Bad_Request_response.freeze | 1 + ...ore_item_returns_Bad_Request_response.yaml | 23 + ...ore_item_returns_Not_Found_response.freeze | 1 + ...store_item_returns_Not_Found_response.yaml | 23 + ..._datastore_item_returns_OK_response.freeze | 1 + ...te_datastore_item_returns_OK_response.yaml | 79 ++ ...astore_returns_Bad_Request_response.freeze | 1 + ...atastore_returns_Bad_Request_response.yaml | 23 + ...atastore_returns_Not_Found_response.freeze | 1 + ..._datastore_returns_Not_Found_response.yaml | 23 + ...pdate_datastore_returns_OK_response.freeze | 1 + ..._Update_datastore_returns_OK_response.yaml | 60 ++ .../features/v2/actions_datastores.feature | 220 +++++ tests/scenarios/features/v2/given.json | 28 + tests/scenarios/features/v2/undo.json | 61 ++ 102 files changed, 9025 insertions(+) create mode 100644 api/datadogV2/api_actions_datastores.go create mode 100644 api/datadogV2/model_bulk_put_apps_datastore_items_request.go create mode 100644 api/datadogV2/model_bulk_put_apps_datastore_items_request_data.go create mode 100644 api/datadogV2/model_bulk_put_apps_datastore_items_request_data_attributes.go create mode 100644 api/datadogV2/model_create_apps_datastore_request.go create mode 100644 api/datadogV2/model_create_apps_datastore_request_data.go create mode 100644 api/datadogV2/model_create_apps_datastore_request_data_attributes.go create mode 100644 api/datadogV2/model_create_apps_datastore_request_data_attributes_org_access.go create mode 100644 api/datadogV2/model_create_apps_datastore_response.go create mode 100644 api/datadogV2/model_create_apps_datastore_response_data.go create mode 100644 api/datadogV2/model_datastore.go create mode 100644 api/datadogV2/model_datastore_array.go create mode 100644 api/datadogV2/model_datastore_data.go create mode 100644 api/datadogV2/model_datastore_data_attributes.go create mode 100644 api/datadogV2/model_datastore_data_type.go create mode 100644 api/datadogV2/model_datastore_item_conflict_mode.go create mode 100644 api/datadogV2/model_datastore_items_data_type.go create mode 100644 api/datadogV2/model_datastore_primary_key_generation_strategy.go create mode 100644 api/datadogV2/model_delete_apps_datastore_item_request.go create mode 100644 api/datadogV2/model_delete_apps_datastore_item_request_data.go create mode 100644 api/datadogV2/model_delete_apps_datastore_item_request_data_attributes.go create mode 100644 api/datadogV2/model_delete_apps_datastore_item_response.go create mode 100644 api/datadogV2/model_delete_apps_datastore_item_response_data.go create mode 100644 api/datadogV2/model_item_api_payload.go create mode 100644 api/datadogV2/model_item_api_payload_array.go create mode 100644 api/datadogV2/model_item_api_payload_data.go create mode 100644 api/datadogV2/model_item_api_payload_data_attributes.go create mode 100644 api/datadogV2/model_item_api_payload_meta.go create mode 100644 api/datadogV2/model_item_api_payload_meta_page.go create mode 100644 api/datadogV2/model_item_api_payload_meta_schema.go create mode 100644 api/datadogV2/model_item_api_payload_meta_schema_field.go create mode 100644 api/datadogV2/model_put_apps_datastore_item_response_array.go create mode 100644 api/datadogV2/model_put_apps_datastore_item_response_data.go create mode 100644 api/datadogV2/model_update_apps_datastore_item_request.go create mode 100644 api/datadogV2/model_update_apps_datastore_item_request_data.go create mode 100644 api/datadogV2/model_update_apps_datastore_item_request_data_attributes.go create mode 100644 api/datadogV2/model_update_apps_datastore_item_request_data_attributes_item_changes.go create mode 100644 api/datadogV2/model_update_apps_datastore_item_request_data_type.go create mode 100644 api/datadogV2/model_update_apps_datastore_request.go create mode 100644 api/datadogV2/model_update_apps_datastore_request_data.go create mode 100644 api/datadogV2/model_update_apps_datastore_request_data_attributes.go create mode 100644 examples/v2/actions-datastores/BulkWriteDatastoreItems.go create mode 100644 examples/v2/actions-datastores/CreateDatastore.go create mode 100644 examples/v2/actions-datastores/DeleteDatastore.go create mode 100644 examples/v2/actions-datastores/DeleteDatastoreItem.go create mode 100644 examples/v2/actions-datastores/GetDatastore.go create mode 100644 examples/v2/actions-datastores/ListDatastoreItems.go create mode 100644 examples/v2/actions-datastores/ListDatastores.go create mode 100644 examples/v2/actions-datastores/UpdateDatastore.go create mode 100644 examples/v2/actions-datastores/UpdateDatastoreItem.go create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.yaml create mode 100644 tests/scenarios/features/v2/actions_datastores.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 085c5aa51a7..0f8479d7711 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5795,6 +5795,33 @@ components: type: $ref: '#/components/schemas/FindingType' type: object + BulkPutAppsDatastoreItemsRequest: + description: Request to insert multiple items into a datastore in a single operation. + properties: + data: + $ref: '#/components/schemas/BulkPutAppsDatastoreItemsRequestData' + type: object + BulkPutAppsDatastoreItemsRequestData: + description: Data wrapper containing the items to insert and their configuration + for the bulk insert operation. + properties: + attributes: + $ref: '#/components/schemas/BulkPutAppsDatastoreItemsRequestDataAttributes' + type: + $ref: '#/components/schemas/DatastoreItemsDataType' + required: + - type + type: object + BulkPutAppsDatastoreItemsRequestDataAttributes: + description: Configuration for bulk inserting multiple items into a datastore. + properties: + conflict_mode: + $ref: '#/components/schemas/DatastoreItemConflictMode' + values: + $ref: '#/components/schemas/DatastoreItemValues' + required: + - values + type: object CIAppAggregateBucketValue: description: A bucket value, can either be a timeseries or a single value. oneOf: @@ -10785,6 +10812,77 @@ components: - id - type type: object + CreateAppsDatastoreRequest: + description: Request to create a new datastore with specified configuration + and metadata. + properties: + data: + $ref: '#/components/schemas/CreateAppsDatastoreRequestData' + type: object + CreateAppsDatastoreRequestData: + description: Data wrapper containing the configuration needed to create a new + datastore. + properties: + attributes: + $ref: '#/components/schemas/CreateAppsDatastoreRequestDataAttributes' + id: + description: Optional ID for the new datastore. If not provided, one will + be generated automatically. + type: string + type: + $ref: '#/components/schemas/DatastoreDataType' + required: + - type + type: object + CreateAppsDatastoreRequestDataAttributes: + description: Configuration and metadata to create a new datastore. + properties: + description: + description: A human-readable description about the datastore. + type: string + name: + description: The display name for the new datastore. + example: datastore-name + type: string + org_access: + $ref: '#/components/schemas/CreateAppsDatastoreRequestDataAttributesOrgAccess' + primary_column_name: + $ref: '#/components/schemas/DatastoreAttributesPrimaryColumnName' + primary_key_generation_strategy: + $ref: '#/components/schemas/DatastorePrimaryKeyGenerationStrategy' + required: + - name + - primary_column_name + type: object + CreateAppsDatastoreRequestDataAttributesOrgAccess: + description: The organization access level for the datastore. For example, 'contributor'. + enum: + - contributor + - viewer + - manager + type: string + x-enum-varnames: + - CONTRIBUTOR + - VIEWER + - MANAGER + CreateAppsDatastoreResponse: + description: Response after successfully creating a new datastore, containing + the datastore's assigned ID. + properties: + data: + $ref: '#/components/schemas/CreateAppsDatastoreResponseData' + type: object + CreateAppsDatastoreResponseData: + description: The newly created datastore's data. + properties: + id: + description: The unique identifier assigned to the newly created datastore. + type: string + type: + $ref: '#/components/schemas/DatastoreDataType' + required: + - type + type: object CreateCustomFrameworkRequest: description: Request object to create a custom framework. properties: @@ -13512,6 +13610,134 @@ components: required: - data type: object + Datastore: + description: A datastore's complete configuration and metadata. + properties: + data: + $ref: '#/components/schemas/DatastoreData' + type: object + DatastoreArray: + description: A collection of datastores returned by list operations. + properties: + data: + description: An array of datastore objects containing their configurations + and metadata. + items: + $ref: '#/components/schemas/DatastoreData' + type: array + required: + - data + type: object + DatastoreAttributesPrimaryColumnName: + description: "The name of the primary key column for this datastore. Primary + column names:\n - Must abide by both [PostgreSQL naming conventions](https://www.postgresql.org/docs/7.0/syntax525.htm)\n + \ - Cannot exceed 63 characters" + example: '' + maxLength: 63 + type: string + DatastoreData: + description: Core information about a datastore, including its unique identifier + and attributes. + properties: + attributes: + $ref: '#/components/schemas/DatastoreDataAttributes' + id: + description: The unique identifier of the datastore. + type: string + type: + $ref: '#/components/schemas/DatastoreDataType' + required: + - type + type: object + DatastoreDataAttributes: + description: Detailed information about a datastore. + properties: + created_at: + description: Timestamp when the datastore was created. + format: date-time + type: string + creator_user_id: + description: The numeric ID of the user who created the datastore. + format: int64 + type: integer + creator_user_uuid: + description: The UUID of the user who created the datastore. + type: string + description: + description: A human-readable description about the datastore. + type: string + modified_at: + description: Timestamp when the datastore was last modified. + format: date-time + type: string + name: + description: The display name of the datastore. + type: string + org_id: + description: The ID of the organization that owns this datastore. + format: int64 + type: integer + primary_column_name: + $ref: '#/components/schemas/DatastoreAttributesPrimaryColumnName' + primary_key_generation_strategy: + $ref: '#/components/schemas/DatastorePrimaryKeyGenerationStrategy' + type: object + DatastoreDataType: + default: datastores + description: The resource type for datastores. + enum: + - datastores + example: datastores + type: string + x-enum-varnames: + - DATASTORES + DatastoreItemConflictMode: + description: How to handle conflicts when inserting items that already exist + in the datastore. + enum: + - fail_on_conflict + - overwrite_on_conflict + example: overwrite_on_conflict + type: string + x-enum-varnames: + - FAIL_ON_CONFLICT + - OVERWRITE_ON_CONFLICT + DatastoreItemValues: + description: An array of items to add to the datastore, where each item is a + set of key-value pairs representing the item's data. Up to 100 items can be + updated in a single request. + example: + - data: example data + key: value + - data: example data2 + key: value2 + items: + additionalProperties: {} + description: A single item's data as key-value pairs. Key names cannot exceed + 63 characters. + type: object + maxItems: 100 + type: array + DatastoreItemsDataType: + default: items + description: The resource type for datastore items. + enum: + - items + example: items + type: string + x-enum-varnames: + - ITEMS + DatastorePrimaryKeyGenerationStrategy: + description: Can be set to `uuid` to automatically generate primary keys when + new items are added. Default value is `none`, which requires you to supply + a primary key for each new item. + enum: + - none + - uuid + type: string + x-enum-varnames: + - NONE + - UUID Date: description: Date as Unix timestamp in milliseconds. example: 1722439510282 @@ -13537,6 +13763,59 @@ components: - id - type type: object + DeleteAppsDatastoreItemRequest: + description: Request to delete a specific item from a datastore by its primary + key. + properties: + data: + $ref: '#/components/schemas/DeleteAppsDatastoreItemRequestData' + type: object + DeleteAppsDatastoreItemRequestData: + description: Data wrapper containing the information needed to identify and + delete a specific datastore item. + properties: + attributes: + $ref: '#/components/schemas/DeleteAppsDatastoreItemRequestDataAttributes' + type: + $ref: '#/components/schemas/DatastoreItemsDataType' + required: + - type + type: object + DeleteAppsDatastoreItemRequestDataAttributes: + description: Attributes specifying which datastore item to delete by its primary + key. + properties: + id: + description: Optional unique identifier of the item to delete. + example: a7656bcc-51d4-4884-adf7-4d0d9a3e0633 + type: string + item_key: + description: The primary key value that identifies the item to delete. Cannot + exceed 256 characters. + example: primaryKey + maxLength: 256 + type: string + required: + - item_key + type: object + DeleteAppsDatastoreItemResponse: + description: Response from successfully deleting a datastore item. + properties: + data: + $ref: '#/components/schemas/DeleteAppsDatastoreItemResponseData' + type: object + DeleteAppsDatastoreItemResponseData: + description: Data containing the identifier of the datastore item that was successfully + deleted. + properties: + id: + description: The unique identifier of the item that was deleted. + type: string + type: + $ref: '#/components/schemas/DatastoreItemsDataType' + required: + - type + type: object DeleteAppsRequest: description: A request object for deleting multiple apps by ID. example: @@ -22969,6 +23248,125 @@ components: type: string x-enum-varnames: - ERROR_TRACKING_SEARCH_RESULT + ItemApiPayload: + description: A single datastore item with its content and metadata. + properties: + data: + $ref: '#/components/schemas/ItemApiPayloadData' + type: object + ItemApiPayloadArray: + description: A collection of datastore items with pagination and schema metadata. + properties: + data: + description: An array of datastore items with their content and metadata. + items: + $ref: '#/components/schemas/ItemApiPayloadData' + maxItems: 100 + type: array + meta: + $ref: '#/components/schemas/ItemApiPayloadMeta' + description: Metadata about the included items, including pagination info + and datastore schema. + required: + - data + type: object + ItemApiPayloadData: + description: Core data and metadata for a single datastore item. + properties: + attributes: + $ref: '#/components/schemas/ItemApiPayloadDataAttributes' + id: + description: The unique identifier of the datastore. + type: string + type: + $ref: '#/components/schemas/DatastoreItemsDataType' + required: + - type + type: object + ItemApiPayloadDataAttributes: + description: Metadata and content of a datastore item. + properties: + created_at: + description: Timestamp when the item was first created. + format: date-time + type: string + modified_at: + description: Timestamp when the item was last modified. + format: date-time + type: string + org_id: + description: The ID of the organization that owns this item. + format: int64 + type: integer + primary_column_name: + $ref: '#/components/schemas/DatastoreAttributesPrimaryColumnName' + signature: + description: A unique signature identifying this item version. + type: string + store_id: + description: The unique identifier of the datastore containing this item. + type: string + value: + $ref: '#/components/schemas/ItemApiPayloadDataAttributesValue' + type: object + ItemApiPayloadDataAttributesValue: + additionalProperties: {} + description: The data content (as key-value pairs) of a datastore item. + type: object + ItemApiPayloadMeta: + description: Additional metadata about a collection of datastore items, including + pagination and schema information. + properties: + page: + $ref: '#/components/schemas/ItemApiPayloadMetaPage' + schema: + $ref: '#/components/schemas/ItemApiPayloadMetaSchema' + type: object + ItemApiPayloadMetaPage: + description: Pagination information for a collection of datastore items. + properties: + hasMore: + description: Whether there are additional pages of items beyond the current + page. + type: boolean + totalCount: + description: The total number of items in the datastore, ignoring any filters. + format: int64 + type: integer + totalFilteredCount: + description: The total number of items that match the current filter criteria. + format: int64 + type: integer + type: object + ItemApiPayloadMetaSchema: + description: Schema information about the datastore, including its primary key + and field definitions. + properties: + fields: + description: An array describing the columns available in this datastore. + items: + $ref: '#/components/schemas/ItemApiPayloadMetaSchemaField' + type: array + primary_key: + description: The name of the primary key column for this datastore. + type: string + type: object + ItemApiPayloadMetaSchemaField: + description: Information about a specific column in the datastore schema. + properties: + name: + description: The name of this column in the datastore. + example: '' + type: string + type: + description: The data type of this column. For example, 'string', 'number', + or 'boolean'. + example: '' + type: string + required: + - name + - type + type: object JSONAPIErrorItem: description: API error response body properties: @@ -33877,6 +34275,32 @@ components: data: $ref: '#/components/schemas/Deployment' type: object + PutAppsDatastoreItemResponseArray: + description: Response after successfully inserting multiple items into a datastore, + containing the identifiers of the created items. + properties: + data: + description: An array of data objects containing the identifiers of the + successfully inserted items. + items: + $ref: '#/components/schemas/PutAppsDatastoreItemResponseData' + maxItems: 100 + type: array + required: + - data + type: object + PutAppsDatastoreItemResponseData: + description: Data containing the identifier of a single item that was successfully + inserted into the datastore. + properties: + id: + description: The unique identifier assigned to the inserted item. + type: string + type: + $ref: '#/components/schemas/DatastoreItemsDataType' + required: + - type + type: object PutIncidentNotificationRuleRequest: description: Put request for a notification rule. properties: @@ -45742,6 +46166,94 @@ components: type: string type: array type: object + UpdateAppsDatastoreItemRequest: + description: Request to update specific fields on an existing datastore item. + properties: + data: + $ref: '#/components/schemas/UpdateAppsDatastoreItemRequestData' + type: object + UpdateAppsDatastoreItemRequestData: + description: Data wrapper containing the item identifier and the changes to + apply during the update operation. + properties: + attributes: + $ref: '#/components/schemas/UpdateAppsDatastoreItemRequestDataAttributes' + id: + description: The unique identifier of the datastore item. + type: string + type: + $ref: '#/components/schemas/UpdateAppsDatastoreItemRequestDataType' + required: + - type + type: object + UpdateAppsDatastoreItemRequestDataAttributes: + description: Attributes for updating a datastore item, including the item key + and changes to apply. + properties: + id: + description: The unique identifier of the item being updated. + type: string + item_changes: + $ref: '#/components/schemas/UpdateAppsDatastoreItemRequestDataAttributesItemChanges' + item_key: + description: The primary key that identifies the item to update. Cannot + exceed 256 characters. + example: '' + maxLength: 256 + type: string + required: + - item_changes + - item_key + type: object + UpdateAppsDatastoreItemRequestDataAttributesItemChanges: + description: Changes to apply to a datastore item using set operations. + properties: + ops_set: + additionalProperties: {} + description: Set operation that contains key-value pairs to set on the datastore + item. + type: object + type: object + UpdateAppsDatastoreItemRequestDataType: + default: items + description: The resource type for datastore items. + enum: + - items + example: items + type: string + x-enum-varnames: + - ITEMS + UpdateAppsDatastoreRequest: + description: Request to update a datastore's configuration such as its name + or description. + properties: + data: + $ref: '#/components/schemas/UpdateAppsDatastoreRequestData' + type: object + UpdateAppsDatastoreRequestData: + description: Data wrapper containing the datastore identifier and the attributes + to update. + properties: + attributes: + $ref: '#/components/schemas/UpdateAppsDatastoreRequestDataAttributes' + id: + description: The unique identifier of the datastore to update. + type: string + type: + $ref: '#/components/schemas/DatastoreDataType' + required: + - type + type: object + UpdateAppsDatastoreRequestDataAttributes: + description: Attributes that can be updated on a datastore. + properties: + description: + description: A human-readable description about the datastore. + type: string + name: + description: The display name of the datastore. + type: string + type: object UpdateCustomFrameworkRequest: description: Request object to update a custom framework. properties: @@ -47765,6 +48277,378 @@ info: version: '1.0' openapi: 3.0.0 paths: + /api/v2/actions-datastores: + get: + description: Lists all datastores for the organization. + operationId: ListDatastores + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DatastoreArray' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List datastores + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_read + post: + description: Creates a new datastore. + operationId: CreateDatastore + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAppsDatastoreRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAppsDatastoreResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create datastore + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_manage + /api/v2/actions-datastores/{datastore_id}: + delete: + description: Deletes a datastore by its unique identifier. + operationId: DeleteDatastore + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + responses: + '200': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete datastore + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_manage + get: + description: Retrieves a specific datastore by its ID. + operationId: GetDatastore + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Datastore' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get datastore + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_read + patch: + description: Updates an existing datastore's attributes. + operationId: UpdateDatastore + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAppsDatastoreRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Datastore' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update datastore + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_manage + /api/v2/actions-datastores/{datastore_id}/items: + delete: + description: Deletes an item from a datastore by its key. + operationId: DeleteDatastoreItem + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppsDatastoreItemRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteAppsDatastoreItemResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete datastore item + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_write + get: + description: Lists items from a datastore. You can filter the results by specifying + either an item key or a filter query parameter, but not both at the same time. + Supports server-side pagination for large datasets. + operationId: ListDatastoreItems + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + - description: Optional query filter to search items using the [logs search + syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/). + in: query + name: filter + schema: + type: string + - description: Optional primary key value to retrieve a specific item. Cannot + be used together with the filter parameter. + in: query + name: item_key + schema: + maxLength: 256 + type: string + - description: Optional field to limit the number of items to return per page + for pagination. Up to 100 items can be returned per page. + in: query + name: page[limit] + schema: + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: Optional field to offset the number of items to skip from the + beginning of the result set for pagination. + in: query + name: page[offset] + schema: + format: int64 + type: integer + - description: Optional field to sort results by. Prefix with '-' for descending + order (e.g., '-created_at'). + in: query + name: sort + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemApiPayloadArray' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List datastore items + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_read + patch: + description: Partially updates an item in a datastore by its key. + operationId: UpdateDatastoreItem + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAppsDatastoreItemRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemApiPayload' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update datastore item + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_write + /api/v2/actions-datastores/{datastore_id}/items/bulk: + post: + description: Creates or replaces multiple items in a datastore by their keys + in a single operation. + operationId: BulkWriteDatastoreItems + parameters: + - description: The unique identifier of the datastore to retrieve. + in: path + name: datastore_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BulkPutAppsDatastoreItemsRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PutAppsDatastoreItemResponseArray' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Bulk write datastore items + tags: + - Actions Datastores + x-permission: + operator: OR + permissions: + - apps_datastore_write /api/v2/actions/app_key_registrations: get: description: List App Key Registrations @@ -71931,6 +72815,12 @@ tags: description: Find out more at url: https://docs.datadoghq.com/service_management/workflows/connections/ name: Action Connection +- description: 'Leverage the Actions Datastore API to create, modify, and delete + + items in datastores owned by your organization.' + externalDocs: + url: https://docs.datadoghq.com/actions/datastore + name: Actions Datastores - description: "Datadog Agentless Scanning provides visibility into risks and vulnerabilities\nwithin your hosts, running containers, and serverless functions\u2014all without\nrequiring teams to install Agents on every host or where Agents cannot be installed.\nAgentless diff --git a/api/datadogV2/api_actions_datastores.go b/api/datadogV2/api_actions_datastores.go new file mode 100644 index 00000000000..ad93dbc9ddd --- /dev/null +++ b/api/datadogV2/api_actions_datastores.go @@ -0,0 +1,868 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ActionsDatastoresApi service type +type ActionsDatastoresApi datadog.Service + +// BulkWriteDatastoreItems Bulk write datastore items. +// Creates or replaces multiple items in a datastore by their keys in a single operation. +func (a *ActionsDatastoresApi) BulkWriteDatastoreItems(ctx _context.Context, datastoreId string, body BulkPutAppsDatastoreItemsRequest) (PutAppsDatastoreItemResponseArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue PutAppsDatastoreItemResponseArray + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.BulkWriteDatastoreItems") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}/items/bulk" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + 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 == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// CreateDatastore Create datastore. +// Creates a new datastore. +func (a *ActionsDatastoresApi) CreateDatastore(ctx _context.Context, body CreateAppsDatastoreRequest) (CreateAppsDatastoreResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue CreateAppsDatastoreResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.CreateDatastore") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores" + + 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 == 400 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// DeleteDatastore Delete datastore. +// Deletes a datastore by its unique identifier. +func (a *ActionsDatastoresApi) DeleteDatastore(ctx _context.Context, datastoreId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.DeleteDatastore") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + 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 == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + 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 +} + +// DeleteDatastoreItem Delete datastore item. +// Deletes an item from a datastore by its key. +func (a *ActionsDatastoresApi) DeleteDatastoreItem(ctx _context.Context, datastoreId string, body DeleteAppsDatastoreItemRequest) (DeleteAppsDatastoreItemResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue DeleteAppsDatastoreItemResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.DeleteDatastoreItem") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}/items" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + 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 == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// GetDatastore Get datastore. +// Retrieves a specific datastore by its ID. +func (a *ActionsDatastoresApi) GetDatastore(ctx _context.Context, datastoreId string) (Datastore, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue Datastore + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.GetDatastore") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + 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 == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// ListDatastoreItemsOptionalParameters holds optional parameters for ListDatastoreItems. +type ListDatastoreItemsOptionalParameters struct { + Filter *string + ItemKey *string + PageLimit *int64 + PageOffset *int64 + Sort *string +} + +// NewListDatastoreItemsOptionalParameters creates an empty struct for parameters. +func NewListDatastoreItemsOptionalParameters() *ListDatastoreItemsOptionalParameters { + this := ListDatastoreItemsOptionalParameters{} + return &this +} + +// WithFilter sets the corresponding parameter name and returns the struct. +func (r *ListDatastoreItemsOptionalParameters) WithFilter(filter string) *ListDatastoreItemsOptionalParameters { + r.Filter = &filter + return r +} + +// WithItemKey sets the corresponding parameter name and returns the struct. +func (r *ListDatastoreItemsOptionalParameters) WithItemKey(itemKey string) *ListDatastoreItemsOptionalParameters { + r.ItemKey = &itemKey + return r +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *ListDatastoreItemsOptionalParameters) WithPageLimit(pageLimit int64) *ListDatastoreItemsOptionalParameters { + r.PageLimit = &pageLimit + return r +} + +// WithPageOffset sets the corresponding parameter name and returns the struct. +func (r *ListDatastoreItemsOptionalParameters) WithPageOffset(pageOffset int64) *ListDatastoreItemsOptionalParameters { + r.PageOffset = &pageOffset + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *ListDatastoreItemsOptionalParameters) WithSort(sort string) *ListDatastoreItemsOptionalParameters { + r.Sort = &sort + return r +} + +// ListDatastoreItems List datastore items. +// Lists items from a datastore. You can filter the results by specifying either an item key or a filter query parameter, but not both at the same time. Supports server-side pagination for large datasets. +func (a *ActionsDatastoresApi) ListDatastoreItems(ctx _context.Context, datastoreId string, o ...ListDatastoreItemsOptionalParameters) (ItemApiPayloadArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue ItemApiPayloadArray + optionalParams ListDatastoreItemsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListDatastoreItemsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.ListDatastoreItems") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}/items" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Filter != nil { + localVarQueryParams.Add("filter", datadog.ParameterToString(*optionalParams.Filter, "")) + } + if optionalParams.ItemKey != nil { + localVarQueryParams.Add("item_key", datadog.ParameterToString(*optionalParams.ItemKey, "")) + } + if optionalParams.PageLimit != nil { + localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, "")) + } + if optionalParams.PageOffset != nil { + localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) + } + if optionalParams.Sort != nil { + localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) + } + 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 == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// ListDatastores List datastores. +// Lists all datastores for the organization. +func (a *ActionsDatastoresApi) ListDatastores(ctx _context.Context) (DatastoreArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DatastoreArray + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.ListDatastores") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores" + + 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 +} + +// UpdateDatastore Update datastore. +// Updates an existing datastore's attributes. +func (a *ActionsDatastoresApi) UpdateDatastore(ctx _context.Context, datastoreId string, body UpdateAppsDatastoreRequest) (Datastore, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue Datastore + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.UpdateDatastore") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + 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 == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// UpdateDatastoreItem Update datastore item. +// Partially updates an item in a datastore by its key. +func (a *ActionsDatastoresApi) UpdateDatastoreItem(ctx _context.Context, datastoreId string, body UpdateAppsDatastoreItemRequest) (ItemApiPayload, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue ItemApiPayload + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ActionsDatastoresApi.UpdateDatastoreItem") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/actions-datastores/{datastore_id}/items" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{datastore_id}", _neturl.PathEscape(datadog.ParameterToString(datastoreId, ""))) + + 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 == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 + } + 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 +} + +// NewActionsDatastoresApi Returns NewActionsDatastoresApi. +func NewActionsDatastoresApi(client *datadog.APIClient) *ActionsDatastoresApi { + return &ActionsDatastoresApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 3f135ec333d..0d630021f9c 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -31,6 +31,15 @@ // - [ActionConnectionApi.RegisterAppKey] // - [ActionConnectionApi.UnregisterAppKey] // - [ActionConnectionApi.UpdateActionConnection] +// - [ActionsDatastoresApi.BulkWriteDatastoreItems] +// - [ActionsDatastoresApi.CreateDatastore] +// - [ActionsDatastoresApi.DeleteDatastore] +// - [ActionsDatastoresApi.DeleteDatastoreItem] +// - [ActionsDatastoresApi.GetDatastore] +// - [ActionsDatastoresApi.ListDatastoreItems] +// - [ActionsDatastoresApi.ListDatastores] +// - [ActionsDatastoresApi.UpdateDatastore] +// - [ActionsDatastoresApi.UpdateDatastoreItem] // - [AgentlessScanningApi.CreateAwsOnDemandTask] // - [AgentlessScanningApi.CreateAwsScanOptions] // - [AgentlessScanningApi.DeleteAwsScanOptions] diff --git a/api/datadogV2/model_bulk_put_apps_datastore_items_request.go b/api/datadogV2/model_bulk_put_apps_datastore_items_request.go new file mode 100644 index 00000000000..16fa4ac9de3 --- /dev/null +++ b/api/datadogV2/model_bulk_put_apps_datastore_items_request.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" +) + +// BulkPutAppsDatastoreItemsRequest Request to insert multiple items into a datastore in a single operation. +type BulkPutAppsDatastoreItemsRequest struct { + // Data wrapper containing the items to insert and their configuration for the bulk insert operation. + Data *BulkPutAppsDatastoreItemsRequestData `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:"-"` +} + +// NewBulkPutAppsDatastoreItemsRequest instantiates a new BulkPutAppsDatastoreItemsRequest 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 NewBulkPutAppsDatastoreItemsRequest() *BulkPutAppsDatastoreItemsRequest { + this := BulkPutAppsDatastoreItemsRequest{} + return &this +} + +// NewBulkPutAppsDatastoreItemsRequestWithDefaults instantiates a new BulkPutAppsDatastoreItemsRequest 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 NewBulkPutAppsDatastoreItemsRequestWithDefaults() *BulkPutAppsDatastoreItemsRequest { + this := BulkPutAppsDatastoreItemsRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *BulkPutAppsDatastoreItemsRequest) GetData() BulkPutAppsDatastoreItemsRequestData { + if o == nil || o.Data == nil { + var ret BulkPutAppsDatastoreItemsRequestData + 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 *BulkPutAppsDatastoreItemsRequest) GetDataOk() (*BulkPutAppsDatastoreItemsRequestData, 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 *BulkPutAppsDatastoreItemsRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given BulkPutAppsDatastoreItemsRequestData and assigns it to the Data field. +func (o *BulkPutAppsDatastoreItemsRequest) SetData(v BulkPutAppsDatastoreItemsRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o BulkPutAppsDatastoreItemsRequest) 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 *BulkPutAppsDatastoreItemsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *BulkPutAppsDatastoreItemsRequestData `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_bulk_put_apps_datastore_items_request_data.go b/api/datadogV2/model_bulk_put_apps_datastore_items_request_data.go new file mode 100644 index 00000000000..2523f4e28ca --- /dev/null +++ b/api/datadogV2/model_bulk_put_apps_datastore_items_request_data.go @@ -0,0 +1,151 @@ +// 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" +) + +// BulkPutAppsDatastoreItemsRequestData Data wrapper containing the items to insert and their configuration for the bulk insert operation. +type BulkPutAppsDatastoreItemsRequestData struct { + // Configuration for bulk inserting multiple items into a datastore. + Attributes *BulkPutAppsDatastoreItemsRequestDataAttributes `json:"attributes,omitempty"` + // The resource type for datastore items. + Type DatastoreItemsDataType `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:"-"` +} + +// NewBulkPutAppsDatastoreItemsRequestData instantiates a new BulkPutAppsDatastoreItemsRequestData 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 NewBulkPutAppsDatastoreItemsRequestData(typeVar DatastoreItemsDataType) *BulkPutAppsDatastoreItemsRequestData { + this := BulkPutAppsDatastoreItemsRequestData{} + this.Type = typeVar + return &this +} + +// NewBulkPutAppsDatastoreItemsRequestDataWithDefaults instantiates a new BulkPutAppsDatastoreItemsRequestData 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 NewBulkPutAppsDatastoreItemsRequestDataWithDefaults() *BulkPutAppsDatastoreItemsRequestData { + this := BulkPutAppsDatastoreItemsRequestData{} + var typeVar DatastoreItemsDataType = DATASTOREITEMSDATATYPE_ITEMS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *BulkPutAppsDatastoreItemsRequestData) GetAttributes() BulkPutAppsDatastoreItemsRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret BulkPutAppsDatastoreItemsRequestDataAttributes + 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 *BulkPutAppsDatastoreItemsRequestData) GetAttributesOk() (*BulkPutAppsDatastoreItemsRequestDataAttributes, 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 *BulkPutAppsDatastoreItemsRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given BulkPutAppsDatastoreItemsRequestDataAttributes and assigns it to the Attributes field. +func (o *BulkPutAppsDatastoreItemsRequestData) SetAttributes(v BulkPutAppsDatastoreItemsRequestDataAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *BulkPutAppsDatastoreItemsRequestData) GetType() DatastoreItemsDataType { + if o == nil { + var ret DatastoreItemsDataType + 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 *BulkPutAppsDatastoreItemsRequestData) GetTypeOk() (*DatastoreItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *BulkPutAppsDatastoreItemsRequestData) SetType(v DatastoreItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o BulkPutAppsDatastoreItemsRequestData) 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["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *BulkPutAppsDatastoreItemsRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *BulkPutAppsDatastoreItemsRequestDataAttributes `json:"attributes,omitempty"` + Type *DatastoreItemsDataType `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", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + 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_bulk_put_apps_datastore_items_request_data_attributes.go b/api/datadogV2/model_bulk_put_apps_datastore_items_request_data_attributes.go new file mode 100644 index 00000000000..05560c12d67 --- /dev/null +++ b/api/datadogV2/model_bulk_put_apps_datastore_items_request_data_attributes.go @@ -0,0 +1,146 @@ +// 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" +) + +// BulkPutAppsDatastoreItemsRequestDataAttributes Configuration for bulk inserting multiple items into a datastore. +type BulkPutAppsDatastoreItemsRequestDataAttributes struct { + // How to handle conflicts when inserting items that already exist in the datastore. + ConflictMode *DatastoreItemConflictMode `json:"conflict_mode,omitempty"` + // An array of items to add to the datastore, where each item is a set of key-value pairs representing the item's data. Up to 100 items can be updated in a single request. + Values []map[string]interface{} `json:"values"` + // 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:"-"` +} + +// NewBulkPutAppsDatastoreItemsRequestDataAttributes instantiates a new BulkPutAppsDatastoreItemsRequestDataAttributes 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 NewBulkPutAppsDatastoreItemsRequestDataAttributes(values []map[string]interface{}) *BulkPutAppsDatastoreItemsRequestDataAttributes { + this := BulkPutAppsDatastoreItemsRequestDataAttributes{} + this.Values = values + return &this +} + +// NewBulkPutAppsDatastoreItemsRequestDataAttributesWithDefaults instantiates a new BulkPutAppsDatastoreItemsRequestDataAttributes 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 NewBulkPutAppsDatastoreItemsRequestDataAttributesWithDefaults() *BulkPutAppsDatastoreItemsRequestDataAttributes { + this := BulkPutAppsDatastoreItemsRequestDataAttributes{} + return &this +} + +// GetConflictMode returns the ConflictMode field value if set, zero value otherwise. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) GetConflictMode() DatastoreItemConflictMode { + if o == nil || o.ConflictMode == nil { + var ret DatastoreItemConflictMode + return ret + } + return *o.ConflictMode +} + +// GetConflictModeOk returns a tuple with the ConflictMode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) GetConflictModeOk() (*DatastoreItemConflictMode, bool) { + if o == nil || o.ConflictMode == nil { + return nil, false + } + return o.ConflictMode, true +} + +// HasConflictMode returns a boolean if a field has been set. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) HasConflictMode() bool { + return o != nil && o.ConflictMode != nil +} + +// SetConflictMode gets a reference to the given DatastoreItemConflictMode and assigns it to the ConflictMode field. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) SetConflictMode(v DatastoreItemConflictMode) { + o.ConflictMode = &v +} + +// GetValues returns the Values field value. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) GetValues() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value +// and a boolean to check if the value has been set. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) GetValuesOk() (*[]map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Values, true +} + +// SetValues sets field value. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) SetValues(v []map[string]interface{}) { + o.Values = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o BulkPutAppsDatastoreItemsRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ConflictMode != nil { + toSerialize["conflict_mode"] = o.ConflictMode + } + toSerialize["values"] = o.Values + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *BulkPutAppsDatastoreItemsRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ConflictMode *DatastoreItemConflictMode `json:"conflict_mode,omitempty"` + Values *[]map[string]interface{} `json:"values"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Values == nil { + return fmt.Errorf("required field values missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"conflict_mode", "values"}) + } else { + return err + } + + hasInvalidField := false + if all.ConflictMode != nil && !all.ConflictMode.IsValid() { + hasInvalidField = true + } else { + o.ConflictMode = all.ConflictMode + } + o.Values = *all.Values + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_apps_datastore_request.go b/api/datadogV2/model_create_apps_datastore_request.go new file mode 100644 index 00000000000..7750fabf8de --- /dev/null +++ b/api/datadogV2/model_create_apps_datastore_request.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" +) + +// CreateAppsDatastoreRequest Request to create a new datastore with specified configuration and metadata. +type CreateAppsDatastoreRequest struct { + // Data wrapper containing the configuration needed to create a new datastore. + Data *CreateAppsDatastoreRequestData `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:"-"` +} + +// NewCreateAppsDatastoreRequest instantiates a new CreateAppsDatastoreRequest 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 NewCreateAppsDatastoreRequest() *CreateAppsDatastoreRequest { + this := CreateAppsDatastoreRequest{} + return &this +} + +// NewCreateAppsDatastoreRequestWithDefaults instantiates a new CreateAppsDatastoreRequest 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 NewCreateAppsDatastoreRequestWithDefaults() *CreateAppsDatastoreRequest { + this := CreateAppsDatastoreRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CreateAppsDatastoreRequest) GetData() CreateAppsDatastoreRequestData { + if o == nil || o.Data == nil { + var ret CreateAppsDatastoreRequestData + 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 *CreateAppsDatastoreRequest) GetDataOk() (*CreateAppsDatastoreRequestData, 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 *CreateAppsDatastoreRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CreateAppsDatastoreRequestData and assigns it to the Data field. +func (o *CreateAppsDatastoreRequest) SetData(v CreateAppsDatastoreRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateAppsDatastoreRequest) 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 *CreateAppsDatastoreRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateAppsDatastoreRequestData `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_create_apps_datastore_request_data.go b/api/datadogV2/model_create_apps_datastore_request_data.go new file mode 100644 index 00000000000..8156ce4c184 --- /dev/null +++ b/api/datadogV2/model_create_apps_datastore_request_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" +) + +// CreateAppsDatastoreRequestData Data wrapper containing the configuration needed to create a new datastore. +type CreateAppsDatastoreRequestData struct { + // Configuration and metadata to create a new datastore. + Attributes *CreateAppsDatastoreRequestDataAttributes `json:"attributes,omitempty"` + // Optional ID for the new datastore. If not provided, one will be generated automatically. + Id *string `json:"id,omitempty"` + // The resource type for datastores. + Type DatastoreDataType `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:"-"` +} + +// NewCreateAppsDatastoreRequestData instantiates a new CreateAppsDatastoreRequestData 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 NewCreateAppsDatastoreRequestData(typeVar DatastoreDataType) *CreateAppsDatastoreRequestData { + this := CreateAppsDatastoreRequestData{} + this.Type = typeVar + return &this +} + +// NewCreateAppsDatastoreRequestDataWithDefaults instantiates a new CreateAppsDatastoreRequestData 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 NewCreateAppsDatastoreRequestDataWithDefaults() *CreateAppsDatastoreRequestData { + this := CreateAppsDatastoreRequestData{} + var typeVar DatastoreDataType = DATASTOREDATATYPE_DATASTORES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CreateAppsDatastoreRequestData) GetAttributes() CreateAppsDatastoreRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret CreateAppsDatastoreRequestDataAttributes + 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 *CreateAppsDatastoreRequestData) GetAttributesOk() (*CreateAppsDatastoreRequestDataAttributes, 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 *CreateAppsDatastoreRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CreateAppsDatastoreRequestDataAttributes and assigns it to the Attributes field. +func (o *CreateAppsDatastoreRequestData) SetAttributes(v CreateAppsDatastoreRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateAppsDatastoreRequestData) 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 *CreateAppsDatastoreRequestData) 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 *CreateAppsDatastoreRequestData) 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 *CreateAppsDatastoreRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *CreateAppsDatastoreRequestData) GetType() DatastoreDataType { + if o == nil { + var ret DatastoreDataType + 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 *CreateAppsDatastoreRequestData) GetTypeOk() (*DatastoreDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateAppsDatastoreRequestData) SetType(v DatastoreDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateAppsDatastoreRequestData) 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 *CreateAppsDatastoreRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateAppsDatastoreRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *DatastoreDataType `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_create_apps_datastore_request_data_attributes.go b/api/datadogV2/model_create_apps_datastore_request_data_attributes.go new file mode 100644 index 00000000000..dabbc9928c5 --- /dev/null +++ b/api/datadogV2/model_create_apps_datastore_request_data_attributes.go @@ -0,0 +1,254 @@ +// 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" +) + +// CreateAppsDatastoreRequestDataAttributes Configuration and metadata to create a new datastore. +type CreateAppsDatastoreRequestDataAttributes struct { + // A human-readable description about the datastore. + Description *string `json:"description,omitempty"` + // The display name for the new datastore. + Name string `json:"name"` + // The organization access level for the datastore. For example, 'contributor'. + OrgAccess *CreateAppsDatastoreRequestDataAttributesOrgAccess `json:"org_access,omitempty"` + // The name of the primary key column for this datastore. Primary column names: + // - Must abide by both [PostgreSQL naming conventions](https://www.postgresql.org/docs/7.0/syntax525.htm) + // - Cannot exceed 63 characters + PrimaryColumnName string `json:"primary_column_name"` + // Can be set to `uuid` to automatically generate primary keys when new items are added. Default value is `none`, which requires you to supply a primary key for each new item. + PrimaryKeyGenerationStrategy *DatastorePrimaryKeyGenerationStrategy `json:"primary_key_generation_strategy,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:"-"` +} + +// NewCreateAppsDatastoreRequestDataAttributes instantiates a new CreateAppsDatastoreRequestDataAttributes 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 NewCreateAppsDatastoreRequestDataAttributes(name string, primaryColumnName string) *CreateAppsDatastoreRequestDataAttributes { + this := CreateAppsDatastoreRequestDataAttributes{} + this.Name = name + this.PrimaryColumnName = primaryColumnName + return &this +} + +// NewCreateAppsDatastoreRequestDataAttributesWithDefaults instantiates a new CreateAppsDatastoreRequestDataAttributes 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 NewCreateAppsDatastoreRequestDataAttributesWithDefaults() *CreateAppsDatastoreRequestDataAttributes { + this := CreateAppsDatastoreRequestDataAttributes{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAppsDatastoreRequestDataAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateAppsDatastoreRequestDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value. +func (o *CreateAppsDatastoreRequestDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *CreateAppsDatastoreRequestDataAttributes) SetName(v string) { + o.Name = v +} + +// GetOrgAccess returns the OrgAccess field value if set, zero value otherwise. +func (o *CreateAppsDatastoreRequestDataAttributes) GetOrgAccess() CreateAppsDatastoreRequestDataAttributesOrgAccess { + if o == nil || o.OrgAccess == nil { + var ret CreateAppsDatastoreRequestDataAttributesOrgAccess + return ret + } + return *o.OrgAccess +} + +// GetOrgAccessOk returns a tuple with the OrgAccess field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) GetOrgAccessOk() (*CreateAppsDatastoreRequestDataAttributesOrgAccess, bool) { + if o == nil || o.OrgAccess == nil { + return nil, false + } + return o.OrgAccess, true +} + +// HasOrgAccess returns a boolean if a field has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) HasOrgAccess() bool { + return o != nil && o.OrgAccess != nil +} + +// SetOrgAccess gets a reference to the given CreateAppsDatastoreRequestDataAttributesOrgAccess and assigns it to the OrgAccess field. +func (o *CreateAppsDatastoreRequestDataAttributes) SetOrgAccess(v CreateAppsDatastoreRequestDataAttributesOrgAccess) { + o.OrgAccess = &v +} + +// GetPrimaryColumnName returns the PrimaryColumnName field value. +func (o *CreateAppsDatastoreRequestDataAttributes) GetPrimaryColumnName() string { + if o == nil { + var ret string + return ret + } + return o.PrimaryColumnName +} + +// GetPrimaryColumnNameOk returns a tuple with the PrimaryColumnName field value +// and a boolean to check if the value has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) GetPrimaryColumnNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PrimaryColumnName, true +} + +// SetPrimaryColumnName sets field value. +func (o *CreateAppsDatastoreRequestDataAttributes) SetPrimaryColumnName(v string) { + o.PrimaryColumnName = v +} + +// GetPrimaryKeyGenerationStrategy returns the PrimaryKeyGenerationStrategy field value if set, zero value otherwise. +func (o *CreateAppsDatastoreRequestDataAttributes) GetPrimaryKeyGenerationStrategy() DatastorePrimaryKeyGenerationStrategy { + if o == nil || o.PrimaryKeyGenerationStrategy == nil { + var ret DatastorePrimaryKeyGenerationStrategy + return ret + } + return *o.PrimaryKeyGenerationStrategy +} + +// GetPrimaryKeyGenerationStrategyOk returns a tuple with the PrimaryKeyGenerationStrategy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) GetPrimaryKeyGenerationStrategyOk() (*DatastorePrimaryKeyGenerationStrategy, bool) { + if o == nil || o.PrimaryKeyGenerationStrategy == nil { + return nil, false + } + return o.PrimaryKeyGenerationStrategy, true +} + +// HasPrimaryKeyGenerationStrategy returns a boolean if a field has been set. +func (o *CreateAppsDatastoreRequestDataAttributes) HasPrimaryKeyGenerationStrategy() bool { + return o != nil && o.PrimaryKeyGenerationStrategy != nil +} + +// SetPrimaryKeyGenerationStrategy gets a reference to the given DatastorePrimaryKeyGenerationStrategy and assigns it to the PrimaryKeyGenerationStrategy field. +func (o *CreateAppsDatastoreRequestDataAttributes) SetPrimaryKeyGenerationStrategy(v DatastorePrimaryKeyGenerationStrategy) { + o.PrimaryKeyGenerationStrategy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateAppsDatastoreRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + toSerialize["name"] = o.Name + if o.OrgAccess != nil { + toSerialize["org_access"] = o.OrgAccess + } + toSerialize["primary_column_name"] = o.PrimaryColumnName + if o.PrimaryKeyGenerationStrategy != nil { + toSerialize["primary_key_generation_strategy"] = o.PrimaryKeyGenerationStrategy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateAppsDatastoreRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name"` + OrgAccess *CreateAppsDatastoreRequestDataAttributesOrgAccess `json:"org_access,omitempty"` + PrimaryColumnName *string `json:"primary_column_name"` + PrimaryKeyGenerationStrategy *DatastorePrimaryKeyGenerationStrategy `json:"primary_key_generation_strategy,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.PrimaryColumnName == nil { + return fmt.Errorf("required field primary_column_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "org_access", "primary_column_name", "primary_key_generation_strategy"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + o.Name = *all.Name + if all.OrgAccess != nil && !all.OrgAccess.IsValid() { + hasInvalidField = true + } else { + o.OrgAccess = all.OrgAccess + } + o.PrimaryColumnName = *all.PrimaryColumnName + if all.PrimaryKeyGenerationStrategy != nil && !all.PrimaryKeyGenerationStrategy.IsValid() { + hasInvalidField = true + } else { + o.PrimaryKeyGenerationStrategy = all.PrimaryKeyGenerationStrategy + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_apps_datastore_request_data_attributes_org_access.go b/api/datadogV2/model_create_apps_datastore_request_data_attributes_org_access.go new file mode 100644 index 00000000000..89bd993a443 --- /dev/null +++ b/api/datadogV2/model_create_apps_datastore_request_data_attributes_org_access.go @@ -0,0 +1,68 @@ +// 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" +) + +// CreateAppsDatastoreRequestDataAttributesOrgAccess The organization access level for the datastore. For example, 'contributor'. +type CreateAppsDatastoreRequestDataAttributesOrgAccess string + +// List of CreateAppsDatastoreRequestDataAttributesOrgAccess. +const ( + CREATEAPPSDATASTOREREQUESTDATAATTRIBUTESORGACCESS_CONTRIBUTOR CreateAppsDatastoreRequestDataAttributesOrgAccess = "contributor" + CREATEAPPSDATASTOREREQUESTDATAATTRIBUTESORGACCESS_VIEWER CreateAppsDatastoreRequestDataAttributesOrgAccess = "viewer" + CREATEAPPSDATASTOREREQUESTDATAATTRIBUTESORGACCESS_MANAGER CreateAppsDatastoreRequestDataAttributesOrgAccess = "manager" +) + +var allowedCreateAppsDatastoreRequestDataAttributesOrgAccessEnumValues = []CreateAppsDatastoreRequestDataAttributesOrgAccess{ + CREATEAPPSDATASTOREREQUESTDATAATTRIBUTESORGACCESS_CONTRIBUTOR, + CREATEAPPSDATASTOREREQUESTDATAATTRIBUTESORGACCESS_VIEWER, + CREATEAPPSDATASTOREREQUESTDATAATTRIBUTESORGACCESS_MANAGER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CreateAppsDatastoreRequestDataAttributesOrgAccess) GetAllowedValues() []CreateAppsDatastoreRequestDataAttributesOrgAccess { + return allowedCreateAppsDatastoreRequestDataAttributesOrgAccessEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CreateAppsDatastoreRequestDataAttributesOrgAccess) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CreateAppsDatastoreRequestDataAttributesOrgAccess(value) + return nil +} + +// NewCreateAppsDatastoreRequestDataAttributesOrgAccessFromValue returns a pointer to a valid CreateAppsDatastoreRequestDataAttributesOrgAccess +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCreateAppsDatastoreRequestDataAttributesOrgAccessFromValue(v string) (*CreateAppsDatastoreRequestDataAttributesOrgAccess, error) { + ev := CreateAppsDatastoreRequestDataAttributesOrgAccess(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CreateAppsDatastoreRequestDataAttributesOrgAccess: valid values are %v", v, allowedCreateAppsDatastoreRequestDataAttributesOrgAccessEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CreateAppsDatastoreRequestDataAttributesOrgAccess) IsValid() bool { + for _, existing := range allowedCreateAppsDatastoreRequestDataAttributesOrgAccessEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CreateAppsDatastoreRequestDataAttributesOrgAccess value. +func (v CreateAppsDatastoreRequestDataAttributesOrgAccess) Ptr() *CreateAppsDatastoreRequestDataAttributesOrgAccess { + return &v +} diff --git a/api/datadogV2/model_create_apps_datastore_response.go b/api/datadogV2/model_create_apps_datastore_response.go new file mode 100644 index 00000000000..ac0391e54c5 --- /dev/null +++ b/api/datadogV2/model_create_apps_datastore_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateAppsDatastoreResponse Response after successfully creating a new datastore, containing the datastore's assigned ID. +type CreateAppsDatastoreResponse struct { + // The newly created datastore's data. + Data *CreateAppsDatastoreResponseData `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:"-"` +} + +// NewCreateAppsDatastoreResponse instantiates a new CreateAppsDatastoreResponse 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 NewCreateAppsDatastoreResponse() *CreateAppsDatastoreResponse { + this := CreateAppsDatastoreResponse{} + return &this +} + +// NewCreateAppsDatastoreResponseWithDefaults instantiates a new CreateAppsDatastoreResponse 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 NewCreateAppsDatastoreResponseWithDefaults() *CreateAppsDatastoreResponse { + this := CreateAppsDatastoreResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CreateAppsDatastoreResponse) GetData() CreateAppsDatastoreResponseData { + if o == nil || o.Data == nil { + var ret CreateAppsDatastoreResponseData + 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 *CreateAppsDatastoreResponse) GetDataOk() (*CreateAppsDatastoreResponseData, 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 *CreateAppsDatastoreResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CreateAppsDatastoreResponseData and assigns it to the Data field. +func (o *CreateAppsDatastoreResponse) SetData(v CreateAppsDatastoreResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateAppsDatastoreResponse) 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 *CreateAppsDatastoreResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateAppsDatastoreResponseData `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_create_apps_datastore_response_data.go b/api/datadogV2/model_create_apps_datastore_response_data.go new file mode 100644 index 00000000000..74735e946f1 --- /dev/null +++ b/api/datadogV2/model_create_apps_datastore_response_data.go @@ -0,0 +1,148 @@ +// 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" +) + +// CreateAppsDatastoreResponseData The newly created datastore's data. +type CreateAppsDatastoreResponseData struct { + // The unique identifier assigned to the newly created datastore. + Id *string `json:"id,omitempty"` + // The resource type for datastores. + Type DatastoreDataType `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:"-"` +} + +// NewCreateAppsDatastoreResponseData instantiates a new CreateAppsDatastoreResponseData 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 NewCreateAppsDatastoreResponseData(typeVar DatastoreDataType) *CreateAppsDatastoreResponseData { + this := CreateAppsDatastoreResponseData{} + this.Type = typeVar + return &this +} + +// NewCreateAppsDatastoreResponseDataWithDefaults instantiates a new CreateAppsDatastoreResponseData 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 NewCreateAppsDatastoreResponseDataWithDefaults() *CreateAppsDatastoreResponseData { + this := CreateAppsDatastoreResponseData{} + var typeVar DatastoreDataType = DATASTOREDATATYPE_DATASTORES + this.Type = typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateAppsDatastoreResponseData) 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 *CreateAppsDatastoreResponseData) 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 *CreateAppsDatastoreResponseData) 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 *CreateAppsDatastoreResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *CreateAppsDatastoreResponseData) GetType() DatastoreDataType { + if o == nil { + var ret DatastoreDataType + 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 *CreateAppsDatastoreResponseData) GetTypeOk() (*DatastoreDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateAppsDatastoreResponseData) SetType(v DatastoreDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateAppsDatastoreResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *CreateAppsDatastoreResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Type *DatastoreDataType `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{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + 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_datastore.go b/api/datadogV2/model_datastore.go new file mode 100644 index 00000000000..8eaf88582c7 --- /dev/null +++ b/api/datadogV2/model_datastore.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" +) + +// Datastore A datastore's complete configuration and metadata. +type Datastore struct { + // Core information about a datastore, including its unique identifier and attributes. + Data *DatastoreData `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:"-"` +} + +// NewDatastore instantiates a new Datastore 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 NewDatastore() *Datastore { + this := Datastore{} + return &this +} + +// NewDatastoreWithDefaults instantiates a new Datastore 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 NewDatastoreWithDefaults() *Datastore { + this := Datastore{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *Datastore) GetData() DatastoreData { + if o == nil || o.Data == nil { + var ret DatastoreData + 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 *Datastore) GetDataOk() (*DatastoreData, 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 *Datastore) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DatastoreData and assigns it to the Data field. +func (o *Datastore) SetData(v DatastoreData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Datastore) 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 *Datastore) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DatastoreData `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_datastore_array.go b/api/datadogV2/model_datastore_array.go new file mode 100644 index 00000000000..3c8640db869 --- /dev/null +++ b/api/datadogV2/model_datastore_array.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" +) + +// DatastoreArray A collection of datastores returned by list operations. +type DatastoreArray struct { + // An array of datastore objects containing their configurations and metadata. + Data []DatastoreData `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:"-"` +} + +// NewDatastoreArray instantiates a new DatastoreArray 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 NewDatastoreArray(data []DatastoreData) *DatastoreArray { + this := DatastoreArray{} + this.Data = data + return &this +} + +// NewDatastoreArrayWithDefaults instantiates a new DatastoreArray 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 NewDatastoreArrayWithDefaults() *DatastoreArray { + this := DatastoreArray{} + return &this +} + +// GetData returns the Data field value. +func (o *DatastoreArray) GetData() []DatastoreData { + if o == nil { + var ret []DatastoreData + 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 *DatastoreArray) GetDataOk() (*[]DatastoreData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *DatastoreArray) SetData(v []DatastoreData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DatastoreArray) 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 *DatastoreArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]DatastoreData `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_datastore_data.go b/api/datadogV2/model_datastore_data.go new file mode 100644 index 00000000000..46fbaa383c8 --- /dev/null +++ b/api/datadogV2/model_datastore_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" +) + +// DatastoreData Core information about a datastore, including its unique identifier and attributes. +type DatastoreData struct { + // Detailed information about a datastore. + Attributes *DatastoreDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the datastore. + Id *string `json:"id,omitempty"` + // The resource type for datastores. + Type DatastoreDataType `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:"-"` +} + +// NewDatastoreData instantiates a new DatastoreData 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 NewDatastoreData(typeVar DatastoreDataType) *DatastoreData { + this := DatastoreData{} + this.Type = typeVar + return &this +} + +// NewDatastoreDataWithDefaults instantiates a new DatastoreData 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 NewDatastoreDataWithDefaults() *DatastoreData { + this := DatastoreData{} + var typeVar DatastoreDataType = DATASTOREDATATYPE_DATASTORES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *DatastoreData) GetAttributes() DatastoreDataAttributes { + if o == nil || o.Attributes == nil { + var ret DatastoreDataAttributes + 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 *DatastoreData) GetAttributesOk() (*DatastoreDataAttributes, 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 *DatastoreData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given DatastoreDataAttributes and assigns it to the Attributes field. +func (o *DatastoreData) SetAttributes(v DatastoreDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DatastoreData) 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 *DatastoreData) 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 *DatastoreData) 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 *DatastoreData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *DatastoreData) GetType() DatastoreDataType { + if o == nil { + var ret DatastoreDataType + 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 *DatastoreData) GetTypeOk() (*DatastoreDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DatastoreData) SetType(v DatastoreDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DatastoreData) 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 *DatastoreData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DatastoreDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *DatastoreDataType `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_datastore_data_attributes.go b/api/datadogV2/model_datastore_data_attributes.go new file mode 100644 index 00000000000..67c1c3bdecd --- /dev/null +++ b/api/datadogV2/model_datastore_data_attributes.go @@ -0,0 +1,404 @@ +// 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 ( + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DatastoreDataAttributes Detailed information about a datastore. +type DatastoreDataAttributes struct { + // Timestamp when the datastore was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // The numeric ID of the user who created the datastore. + CreatorUserId *int64 `json:"creator_user_id,omitempty"` + // The UUID of the user who created the datastore. + CreatorUserUuid *string `json:"creator_user_uuid,omitempty"` + // A human-readable description about the datastore. + Description *string `json:"description,omitempty"` + // Timestamp when the datastore was last modified. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // The display name of the datastore. + Name *string `json:"name,omitempty"` + // The ID of the organization that owns this datastore. + OrgId *int64 `json:"org_id,omitempty"` + // The name of the primary key column for this datastore. Primary column names: + // - Must abide by both [PostgreSQL naming conventions](https://www.postgresql.org/docs/7.0/syntax525.htm) + // - Cannot exceed 63 characters + PrimaryColumnName *string `json:"primary_column_name,omitempty"` + // Can be set to `uuid` to automatically generate primary keys when new items are added. Default value is `none`, which requires you to supply a primary key for each new item. + PrimaryKeyGenerationStrategy *DatastorePrimaryKeyGenerationStrategy `json:"primary_key_generation_strategy,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:"-"` +} + +// NewDatastoreDataAttributes instantiates a new DatastoreDataAttributes 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 NewDatastoreDataAttributes() *DatastoreDataAttributes { + this := DatastoreDataAttributes{} + return &this +} + +// NewDatastoreDataAttributesWithDefaults instantiates a new DatastoreDataAttributes 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 NewDatastoreDataAttributesWithDefaults() *DatastoreDataAttributes { + this := DatastoreDataAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *DatastoreDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatorUserId returns the CreatorUserId field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetCreatorUserId() int64 { + if o == nil || o.CreatorUserId == nil { + var ret int64 + return ret + } + return *o.CreatorUserId +} + +// GetCreatorUserIdOk returns a tuple with the CreatorUserId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetCreatorUserIdOk() (*int64, bool) { + if o == nil || o.CreatorUserId == nil { + return nil, false + } + return o.CreatorUserId, true +} + +// HasCreatorUserId returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasCreatorUserId() bool { + return o != nil && o.CreatorUserId != nil +} + +// SetCreatorUserId gets a reference to the given int64 and assigns it to the CreatorUserId field. +func (o *DatastoreDataAttributes) SetCreatorUserId(v int64) { + o.CreatorUserId = &v +} + +// GetCreatorUserUuid returns the CreatorUserUuid field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetCreatorUserUuid() string { + if o == nil || o.CreatorUserUuid == nil { + var ret string + return ret + } + return *o.CreatorUserUuid +} + +// GetCreatorUserUuidOk returns a tuple with the CreatorUserUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetCreatorUserUuidOk() (*string, bool) { + if o == nil || o.CreatorUserUuid == nil { + return nil, false + } + return o.CreatorUserUuid, true +} + +// HasCreatorUserUuid returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasCreatorUserUuid() bool { + return o != nil && o.CreatorUserUuid != nil +} + +// SetCreatorUserUuid gets a reference to the given string and assigns it to the CreatorUserUuid field. +func (o *DatastoreDataAttributes) SetCreatorUserUuid(v string) { + o.CreatorUserUuid = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *DatastoreDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *DatastoreDataAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DatastoreDataAttributes) SetName(v string) { + o.Name = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *DatastoreDataAttributes) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetPrimaryColumnName returns the PrimaryColumnName field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetPrimaryColumnName() string { + if o == nil || o.PrimaryColumnName == nil { + var ret string + return ret + } + return *o.PrimaryColumnName +} + +// GetPrimaryColumnNameOk returns a tuple with the PrimaryColumnName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetPrimaryColumnNameOk() (*string, bool) { + if o == nil || o.PrimaryColumnName == nil { + return nil, false + } + return o.PrimaryColumnName, true +} + +// HasPrimaryColumnName returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasPrimaryColumnName() bool { + return o != nil && o.PrimaryColumnName != nil +} + +// SetPrimaryColumnName gets a reference to the given string and assigns it to the PrimaryColumnName field. +func (o *DatastoreDataAttributes) SetPrimaryColumnName(v string) { + o.PrimaryColumnName = &v +} + +// GetPrimaryKeyGenerationStrategy returns the PrimaryKeyGenerationStrategy field value if set, zero value otherwise. +func (o *DatastoreDataAttributes) GetPrimaryKeyGenerationStrategy() DatastorePrimaryKeyGenerationStrategy { + if o == nil || o.PrimaryKeyGenerationStrategy == nil { + var ret DatastorePrimaryKeyGenerationStrategy + return ret + } + return *o.PrimaryKeyGenerationStrategy +} + +// GetPrimaryKeyGenerationStrategyOk returns a tuple with the PrimaryKeyGenerationStrategy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatastoreDataAttributes) GetPrimaryKeyGenerationStrategyOk() (*DatastorePrimaryKeyGenerationStrategy, bool) { + if o == nil || o.PrimaryKeyGenerationStrategy == nil { + return nil, false + } + return o.PrimaryKeyGenerationStrategy, true +} + +// HasPrimaryKeyGenerationStrategy returns a boolean if a field has been set. +func (o *DatastoreDataAttributes) HasPrimaryKeyGenerationStrategy() bool { + return o != nil && o.PrimaryKeyGenerationStrategy != nil +} + +// SetPrimaryKeyGenerationStrategy gets a reference to the given DatastorePrimaryKeyGenerationStrategy and assigns it to the PrimaryKeyGenerationStrategy field. +func (o *DatastoreDataAttributes) SetPrimaryKeyGenerationStrategy(v DatastorePrimaryKeyGenerationStrategy) { + o.PrimaryKeyGenerationStrategy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DatastoreDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.CreatorUserId != nil { + toSerialize["creator_user_id"] = o.CreatorUserId + } + if o.CreatorUserUuid != nil { + toSerialize["creator_user_uuid"] = o.CreatorUserUuid + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.PrimaryColumnName != nil { + toSerialize["primary_column_name"] = o.PrimaryColumnName + } + if o.PrimaryKeyGenerationStrategy != nil { + toSerialize["primary_key_generation_strategy"] = o.PrimaryKeyGenerationStrategy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DatastoreDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatorUserId *int64 `json:"creator_user_id,omitempty"` + CreatorUserUuid *string `json:"creator_user_uuid,omitempty"` + Description *string `json:"description,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + PrimaryColumnName *string `json:"primary_column_name,omitempty"` + PrimaryKeyGenerationStrategy *DatastorePrimaryKeyGenerationStrategy `json:"primary_key_generation_strategy,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{"created_at", "creator_user_id", "creator_user_uuid", "description", "modified_at", "name", "org_id", "primary_column_name", "primary_key_generation_strategy"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = all.CreatedAt + o.CreatorUserId = all.CreatorUserId + o.CreatorUserUuid = all.CreatorUserUuid + o.Description = all.Description + o.ModifiedAt = all.ModifiedAt + o.Name = all.Name + o.OrgId = all.OrgId + o.PrimaryColumnName = all.PrimaryColumnName + if all.PrimaryKeyGenerationStrategy != nil && !all.PrimaryKeyGenerationStrategy.IsValid() { + hasInvalidField = true + } else { + o.PrimaryKeyGenerationStrategy = all.PrimaryKeyGenerationStrategy + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_datastore_data_type.go b/api/datadogV2/model_datastore_data_type.go new file mode 100644 index 00000000000..87297e41da3 --- /dev/null +++ b/api/datadogV2/model_datastore_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" +) + +// DatastoreDataType The resource type for datastores. +type DatastoreDataType string + +// List of DatastoreDataType. +const ( + DATASTOREDATATYPE_DATASTORES DatastoreDataType = "datastores" +) + +var allowedDatastoreDataTypeEnumValues = []DatastoreDataType{ + DATASTOREDATATYPE_DATASTORES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DatastoreDataType) GetAllowedValues() []DatastoreDataType { + return allowedDatastoreDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DatastoreDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DatastoreDataType(value) + return nil +} + +// NewDatastoreDataTypeFromValue returns a pointer to a valid DatastoreDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDatastoreDataTypeFromValue(v string) (*DatastoreDataType, error) { + ev := DatastoreDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DatastoreDataType: valid values are %v", v, allowedDatastoreDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DatastoreDataType) IsValid() bool { + for _, existing := range allowedDatastoreDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DatastoreDataType value. +func (v DatastoreDataType) Ptr() *DatastoreDataType { + return &v +} diff --git a/api/datadogV2/model_datastore_item_conflict_mode.go b/api/datadogV2/model_datastore_item_conflict_mode.go new file mode 100644 index 00000000000..7da0b553322 --- /dev/null +++ b/api/datadogV2/model_datastore_item_conflict_mode.go @@ -0,0 +1,66 @@ +// 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" +) + +// DatastoreItemConflictMode How to handle conflicts when inserting items that already exist in the datastore. +type DatastoreItemConflictMode string + +// List of DatastoreItemConflictMode. +const ( + DATASTOREITEMCONFLICTMODE_FAIL_ON_CONFLICT DatastoreItemConflictMode = "fail_on_conflict" + DATASTOREITEMCONFLICTMODE_OVERWRITE_ON_CONFLICT DatastoreItemConflictMode = "overwrite_on_conflict" +) + +var allowedDatastoreItemConflictModeEnumValues = []DatastoreItemConflictMode{ + DATASTOREITEMCONFLICTMODE_FAIL_ON_CONFLICT, + DATASTOREITEMCONFLICTMODE_OVERWRITE_ON_CONFLICT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DatastoreItemConflictMode) GetAllowedValues() []DatastoreItemConflictMode { + return allowedDatastoreItemConflictModeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DatastoreItemConflictMode) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DatastoreItemConflictMode(value) + return nil +} + +// NewDatastoreItemConflictModeFromValue returns a pointer to a valid DatastoreItemConflictMode +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDatastoreItemConflictModeFromValue(v string) (*DatastoreItemConflictMode, error) { + ev := DatastoreItemConflictMode(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DatastoreItemConflictMode: valid values are %v", v, allowedDatastoreItemConflictModeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DatastoreItemConflictMode) IsValid() bool { + for _, existing := range allowedDatastoreItemConflictModeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DatastoreItemConflictMode value. +func (v DatastoreItemConflictMode) Ptr() *DatastoreItemConflictMode { + return &v +} diff --git a/api/datadogV2/model_datastore_items_data_type.go b/api/datadogV2/model_datastore_items_data_type.go new file mode 100644 index 00000000000..3cb9e0a8e14 --- /dev/null +++ b/api/datadogV2/model_datastore_items_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" +) + +// DatastoreItemsDataType The resource type for datastore items. +type DatastoreItemsDataType string + +// List of DatastoreItemsDataType. +const ( + DATASTOREITEMSDATATYPE_ITEMS DatastoreItemsDataType = "items" +) + +var allowedDatastoreItemsDataTypeEnumValues = []DatastoreItemsDataType{ + DATASTOREITEMSDATATYPE_ITEMS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DatastoreItemsDataType) GetAllowedValues() []DatastoreItemsDataType { + return allowedDatastoreItemsDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DatastoreItemsDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DatastoreItemsDataType(value) + return nil +} + +// NewDatastoreItemsDataTypeFromValue returns a pointer to a valid DatastoreItemsDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDatastoreItemsDataTypeFromValue(v string) (*DatastoreItemsDataType, error) { + ev := DatastoreItemsDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DatastoreItemsDataType: valid values are %v", v, allowedDatastoreItemsDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DatastoreItemsDataType) IsValid() bool { + for _, existing := range allowedDatastoreItemsDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DatastoreItemsDataType value. +func (v DatastoreItemsDataType) Ptr() *DatastoreItemsDataType { + return &v +} diff --git a/api/datadogV2/model_datastore_primary_key_generation_strategy.go b/api/datadogV2/model_datastore_primary_key_generation_strategy.go new file mode 100644 index 00000000000..28d0ce5e848 --- /dev/null +++ b/api/datadogV2/model_datastore_primary_key_generation_strategy.go @@ -0,0 +1,66 @@ +// 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" +) + +// DatastorePrimaryKeyGenerationStrategy Can be set to `uuid` to automatically generate primary keys when new items are added. Default value is `none`, which requires you to supply a primary key for each new item. +type DatastorePrimaryKeyGenerationStrategy string + +// List of DatastorePrimaryKeyGenerationStrategy. +const ( + DATASTOREPRIMARYKEYGENERATIONSTRATEGY_NONE DatastorePrimaryKeyGenerationStrategy = "none" + DATASTOREPRIMARYKEYGENERATIONSTRATEGY_UUID DatastorePrimaryKeyGenerationStrategy = "uuid" +) + +var allowedDatastorePrimaryKeyGenerationStrategyEnumValues = []DatastorePrimaryKeyGenerationStrategy{ + DATASTOREPRIMARYKEYGENERATIONSTRATEGY_NONE, + DATASTOREPRIMARYKEYGENERATIONSTRATEGY_UUID, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DatastorePrimaryKeyGenerationStrategy) GetAllowedValues() []DatastorePrimaryKeyGenerationStrategy { + return allowedDatastorePrimaryKeyGenerationStrategyEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DatastorePrimaryKeyGenerationStrategy) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DatastorePrimaryKeyGenerationStrategy(value) + return nil +} + +// NewDatastorePrimaryKeyGenerationStrategyFromValue returns a pointer to a valid DatastorePrimaryKeyGenerationStrategy +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDatastorePrimaryKeyGenerationStrategyFromValue(v string) (*DatastorePrimaryKeyGenerationStrategy, error) { + ev := DatastorePrimaryKeyGenerationStrategy(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DatastorePrimaryKeyGenerationStrategy: valid values are %v", v, allowedDatastorePrimaryKeyGenerationStrategyEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DatastorePrimaryKeyGenerationStrategy) IsValid() bool { + for _, existing := range allowedDatastorePrimaryKeyGenerationStrategyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DatastorePrimaryKeyGenerationStrategy value. +func (v DatastorePrimaryKeyGenerationStrategy) Ptr() *DatastorePrimaryKeyGenerationStrategy { + return &v +} diff --git a/api/datadogV2/model_delete_apps_datastore_item_request.go b/api/datadogV2/model_delete_apps_datastore_item_request.go new file mode 100644 index 00000000000..226d0873fca --- /dev/null +++ b/api/datadogV2/model_delete_apps_datastore_item_request.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" +) + +// DeleteAppsDatastoreItemRequest Request to delete a specific item from a datastore by its primary key. +type DeleteAppsDatastoreItemRequest struct { + // Data wrapper containing the information needed to identify and delete a specific datastore item. + Data *DeleteAppsDatastoreItemRequestData `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:"-"` +} + +// NewDeleteAppsDatastoreItemRequest instantiates a new DeleteAppsDatastoreItemRequest 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 NewDeleteAppsDatastoreItemRequest() *DeleteAppsDatastoreItemRequest { + this := DeleteAppsDatastoreItemRequest{} + return &this +} + +// NewDeleteAppsDatastoreItemRequestWithDefaults instantiates a new DeleteAppsDatastoreItemRequest 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 NewDeleteAppsDatastoreItemRequestWithDefaults() *DeleteAppsDatastoreItemRequest { + this := DeleteAppsDatastoreItemRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DeleteAppsDatastoreItemRequest) GetData() DeleteAppsDatastoreItemRequestData { + if o == nil || o.Data == nil { + var ret DeleteAppsDatastoreItemRequestData + 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 *DeleteAppsDatastoreItemRequest) GetDataOk() (*DeleteAppsDatastoreItemRequestData, 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 *DeleteAppsDatastoreItemRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DeleteAppsDatastoreItemRequestData and assigns it to the Data field. +func (o *DeleteAppsDatastoreItemRequest) SetData(v DeleteAppsDatastoreItemRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeleteAppsDatastoreItemRequest) 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 *DeleteAppsDatastoreItemRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DeleteAppsDatastoreItemRequestData `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_delete_apps_datastore_item_request_data.go b/api/datadogV2/model_delete_apps_datastore_item_request_data.go new file mode 100644 index 00000000000..9d26d83fc7c --- /dev/null +++ b/api/datadogV2/model_delete_apps_datastore_item_request_data.go @@ -0,0 +1,151 @@ +// 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" +) + +// DeleteAppsDatastoreItemRequestData Data wrapper containing the information needed to identify and delete a specific datastore item. +type DeleteAppsDatastoreItemRequestData struct { + // Attributes specifying which datastore item to delete by its primary key. + Attributes *DeleteAppsDatastoreItemRequestDataAttributes `json:"attributes,omitempty"` + // The resource type for datastore items. + Type DatastoreItemsDataType `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:"-"` +} + +// NewDeleteAppsDatastoreItemRequestData instantiates a new DeleteAppsDatastoreItemRequestData 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 NewDeleteAppsDatastoreItemRequestData(typeVar DatastoreItemsDataType) *DeleteAppsDatastoreItemRequestData { + this := DeleteAppsDatastoreItemRequestData{} + this.Type = typeVar + return &this +} + +// NewDeleteAppsDatastoreItemRequestDataWithDefaults instantiates a new DeleteAppsDatastoreItemRequestData 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 NewDeleteAppsDatastoreItemRequestDataWithDefaults() *DeleteAppsDatastoreItemRequestData { + this := DeleteAppsDatastoreItemRequestData{} + var typeVar DatastoreItemsDataType = DATASTOREITEMSDATATYPE_ITEMS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *DeleteAppsDatastoreItemRequestData) GetAttributes() DeleteAppsDatastoreItemRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret DeleteAppsDatastoreItemRequestDataAttributes + 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 *DeleteAppsDatastoreItemRequestData) GetAttributesOk() (*DeleteAppsDatastoreItemRequestDataAttributes, 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 *DeleteAppsDatastoreItemRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given DeleteAppsDatastoreItemRequestDataAttributes and assigns it to the Attributes field. +func (o *DeleteAppsDatastoreItemRequestData) SetAttributes(v DeleteAppsDatastoreItemRequestDataAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *DeleteAppsDatastoreItemRequestData) GetType() DatastoreItemsDataType { + if o == nil { + var ret DatastoreItemsDataType + 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 *DeleteAppsDatastoreItemRequestData) GetTypeOk() (*DatastoreItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DeleteAppsDatastoreItemRequestData) SetType(v DatastoreItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeleteAppsDatastoreItemRequestData) 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["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeleteAppsDatastoreItemRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DeleteAppsDatastoreItemRequestDataAttributes `json:"attributes,omitempty"` + Type *DatastoreItemsDataType `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", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + 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_delete_apps_datastore_item_request_data_attributes.go b/api/datadogV2/model_delete_apps_datastore_item_request_data_attributes.go new file mode 100644 index 00000000000..a7fec6368bd --- /dev/null +++ b/api/datadogV2/model_delete_apps_datastore_item_request_data_attributes.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" +) + +// DeleteAppsDatastoreItemRequestDataAttributes Attributes specifying which datastore item to delete by its primary key. +type DeleteAppsDatastoreItemRequestDataAttributes struct { + // Optional unique identifier of the item to delete. + Id *string `json:"id,omitempty"` + // The primary key value that identifies the item to delete. Cannot exceed 256 characters. + ItemKey string `json:"item_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:"-"` +} + +// NewDeleteAppsDatastoreItemRequestDataAttributes instantiates a new DeleteAppsDatastoreItemRequestDataAttributes 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 NewDeleteAppsDatastoreItemRequestDataAttributes(itemKey string) *DeleteAppsDatastoreItemRequestDataAttributes { + this := DeleteAppsDatastoreItemRequestDataAttributes{} + this.ItemKey = itemKey + return &this +} + +// NewDeleteAppsDatastoreItemRequestDataAttributesWithDefaults instantiates a new DeleteAppsDatastoreItemRequestDataAttributes 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 NewDeleteAppsDatastoreItemRequestDataAttributesWithDefaults() *DeleteAppsDatastoreItemRequestDataAttributes { + this := DeleteAppsDatastoreItemRequestDataAttributes{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DeleteAppsDatastoreItemRequestDataAttributes) 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 *DeleteAppsDatastoreItemRequestDataAttributes) 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 *DeleteAppsDatastoreItemRequestDataAttributes) 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 *DeleteAppsDatastoreItemRequestDataAttributes) SetId(v string) { + o.Id = &v +} + +// GetItemKey returns the ItemKey field value. +func (o *DeleteAppsDatastoreItemRequestDataAttributes) GetItemKey() string { + if o == nil { + var ret string + return ret + } + return o.ItemKey +} + +// GetItemKeyOk returns a tuple with the ItemKey field value +// and a boolean to check if the value has been set. +func (o *DeleteAppsDatastoreItemRequestDataAttributes) GetItemKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ItemKey, true +} + +// SetItemKey sets field value. +func (o *DeleteAppsDatastoreItemRequestDataAttributes) SetItemKey(v string) { + o.ItemKey = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeleteAppsDatastoreItemRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["item_key"] = o.ItemKey + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeleteAppsDatastoreItemRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + ItemKey *string `json:"item_key"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ItemKey == nil { + return fmt.Errorf("required field item_key missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "item_key"}) + } else { + return err + } + o.Id = all.Id + o.ItemKey = *all.ItemKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_delete_apps_datastore_item_response.go b/api/datadogV2/model_delete_apps_datastore_item_response.go new file mode 100644 index 00000000000..a705739ad22 --- /dev/null +++ b/api/datadogV2/model_delete_apps_datastore_item_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DeleteAppsDatastoreItemResponse Response from successfully deleting a datastore item. +type DeleteAppsDatastoreItemResponse struct { + // Data containing the identifier of the datastore item that was successfully deleted. + Data *DeleteAppsDatastoreItemResponseData `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:"-"` +} + +// NewDeleteAppsDatastoreItemResponse instantiates a new DeleteAppsDatastoreItemResponse 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 NewDeleteAppsDatastoreItemResponse() *DeleteAppsDatastoreItemResponse { + this := DeleteAppsDatastoreItemResponse{} + return &this +} + +// NewDeleteAppsDatastoreItemResponseWithDefaults instantiates a new DeleteAppsDatastoreItemResponse 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 NewDeleteAppsDatastoreItemResponseWithDefaults() *DeleteAppsDatastoreItemResponse { + this := DeleteAppsDatastoreItemResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DeleteAppsDatastoreItemResponse) GetData() DeleteAppsDatastoreItemResponseData { + if o == nil || o.Data == nil { + var ret DeleteAppsDatastoreItemResponseData + 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 *DeleteAppsDatastoreItemResponse) GetDataOk() (*DeleteAppsDatastoreItemResponseData, 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 *DeleteAppsDatastoreItemResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DeleteAppsDatastoreItemResponseData and assigns it to the Data field. +func (o *DeleteAppsDatastoreItemResponse) SetData(v DeleteAppsDatastoreItemResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeleteAppsDatastoreItemResponse) 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 *DeleteAppsDatastoreItemResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DeleteAppsDatastoreItemResponseData `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_delete_apps_datastore_item_response_data.go b/api/datadogV2/model_delete_apps_datastore_item_response_data.go new file mode 100644 index 00000000000..9512a2da4ec --- /dev/null +++ b/api/datadogV2/model_delete_apps_datastore_item_response_data.go @@ -0,0 +1,148 @@ +// 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" +) + +// DeleteAppsDatastoreItemResponseData Data containing the identifier of the datastore item that was successfully deleted. +type DeleteAppsDatastoreItemResponseData struct { + // The unique identifier of the item that was deleted. + Id *string `json:"id,omitempty"` + // The resource type for datastore items. + Type DatastoreItemsDataType `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:"-"` +} + +// NewDeleteAppsDatastoreItemResponseData instantiates a new DeleteAppsDatastoreItemResponseData 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 NewDeleteAppsDatastoreItemResponseData(typeVar DatastoreItemsDataType) *DeleteAppsDatastoreItemResponseData { + this := DeleteAppsDatastoreItemResponseData{} + this.Type = typeVar + return &this +} + +// NewDeleteAppsDatastoreItemResponseDataWithDefaults instantiates a new DeleteAppsDatastoreItemResponseData 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 NewDeleteAppsDatastoreItemResponseDataWithDefaults() *DeleteAppsDatastoreItemResponseData { + this := DeleteAppsDatastoreItemResponseData{} + var typeVar DatastoreItemsDataType = DATASTOREITEMSDATATYPE_ITEMS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DeleteAppsDatastoreItemResponseData) 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 *DeleteAppsDatastoreItemResponseData) 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 *DeleteAppsDatastoreItemResponseData) 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 *DeleteAppsDatastoreItemResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *DeleteAppsDatastoreItemResponseData) GetType() DatastoreItemsDataType { + if o == nil { + var ret DatastoreItemsDataType + 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 *DeleteAppsDatastoreItemResponseData) GetTypeOk() (*DatastoreItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DeleteAppsDatastoreItemResponseData) SetType(v DatastoreItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeleteAppsDatastoreItemResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *DeleteAppsDatastoreItemResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Type *DatastoreItemsDataType `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{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + 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_item_api_payload.go b/api/datadogV2/model_item_api_payload.go new file mode 100644 index 00000000000..3b727dee962 --- /dev/null +++ b/api/datadogV2/model_item_api_payload.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" +) + +// ItemApiPayload A single datastore item with its content and metadata. +type ItemApiPayload struct { + // Core data and metadata for a single datastore item. + Data *ItemApiPayloadData `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:"-"` +} + +// NewItemApiPayload instantiates a new ItemApiPayload 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 NewItemApiPayload() *ItemApiPayload { + this := ItemApiPayload{} + return &this +} + +// NewItemApiPayloadWithDefaults instantiates a new ItemApiPayload 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 NewItemApiPayloadWithDefaults() *ItemApiPayload { + this := ItemApiPayload{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *ItemApiPayload) GetData() ItemApiPayloadData { + if o == nil || o.Data == nil { + var ret ItemApiPayloadData + 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 *ItemApiPayload) GetDataOk() (*ItemApiPayloadData, 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 *ItemApiPayload) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given ItemApiPayloadData and assigns it to the Data field. +func (o *ItemApiPayload) SetData(v ItemApiPayloadData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayload) 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 *ItemApiPayload) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *ItemApiPayloadData `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_item_api_payload_array.go b/api/datadogV2/model_item_api_payload_array.go new file mode 100644 index 00000000000..af709924a24 --- /dev/null +++ b/api/datadogV2/model_item_api_payload_array.go @@ -0,0 +1,145 @@ +// 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" +) + +// ItemApiPayloadArray A collection of datastore items with pagination and schema metadata. +type ItemApiPayloadArray struct { + // An array of datastore items with their content and metadata. + Data []ItemApiPayloadData `json:"data"` + // Additional metadata about a collection of datastore items, including pagination and schema information. + Meta *ItemApiPayloadMeta `json:"meta,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:"-"` +} + +// NewItemApiPayloadArray instantiates a new ItemApiPayloadArray 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 NewItemApiPayloadArray(data []ItemApiPayloadData) *ItemApiPayloadArray { + this := ItemApiPayloadArray{} + this.Data = data + return &this +} + +// NewItemApiPayloadArrayWithDefaults instantiates a new ItemApiPayloadArray 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 NewItemApiPayloadArrayWithDefaults() *ItemApiPayloadArray { + this := ItemApiPayloadArray{} + return &this +} + +// GetData returns the Data field value. +func (o *ItemApiPayloadArray) GetData() []ItemApiPayloadData { + if o == nil { + var ret []ItemApiPayloadData + 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 *ItemApiPayloadArray) GetDataOk() (*[]ItemApiPayloadData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *ItemApiPayloadArray) SetData(v []ItemApiPayloadData) { + o.Data = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *ItemApiPayloadArray) GetMeta() ItemApiPayloadMeta { + if o == nil || o.Meta == nil { + var ret ItemApiPayloadMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadArray) GetMetaOk() (*ItemApiPayloadMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *ItemApiPayloadArray) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given ItemApiPayloadMeta and assigns it to the Meta field. +func (o *ItemApiPayloadArray) SetMeta(v ItemApiPayloadMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadArray) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ItemApiPayloadArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]ItemApiPayloadData `json:"data"` + Meta *ItemApiPayloadMeta `json:"meta,omitempty"` + }{} + 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", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = *all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_item_api_payload_data.go b/api/datadogV2/model_item_api_payload_data.go new file mode 100644 index 00000000000..aab3f5c91f5 --- /dev/null +++ b/api/datadogV2/model_item_api_payload_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" +) + +// ItemApiPayloadData Core data and metadata for a single datastore item. +type ItemApiPayloadData struct { + // Metadata and content of a datastore item. + Attributes *ItemApiPayloadDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the datastore. + Id *string `json:"id,omitempty"` + // The resource type for datastore items. + Type DatastoreItemsDataType `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:"-"` +} + +// NewItemApiPayloadData instantiates a new ItemApiPayloadData 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 NewItemApiPayloadData(typeVar DatastoreItemsDataType) *ItemApiPayloadData { + this := ItemApiPayloadData{} + this.Type = typeVar + return &this +} + +// NewItemApiPayloadDataWithDefaults instantiates a new ItemApiPayloadData 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 NewItemApiPayloadDataWithDefaults() *ItemApiPayloadData { + this := ItemApiPayloadData{} + var typeVar DatastoreItemsDataType = DATASTOREITEMSDATATYPE_ITEMS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *ItemApiPayloadData) GetAttributes() ItemApiPayloadDataAttributes { + if o == nil || o.Attributes == nil { + var ret ItemApiPayloadDataAttributes + 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 *ItemApiPayloadData) GetAttributesOk() (*ItemApiPayloadDataAttributes, 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 *ItemApiPayloadData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given ItemApiPayloadDataAttributes and assigns it to the Attributes field. +func (o *ItemApiPayloadData) SetAttributes(v ItemApiPayloadDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ItemApiPayloadData) 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 *ItemApiPayloadData) 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 *ItemApiPayloadData) 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 *ItemApiPayloadData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *ItemApiPayloadData) GetType() DatastoreItemsDataType { + if o == nil { + var ret DatastoreItemsDataType + 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 *ItemApiPayloadData) GetTypeOk() (*DatastoreItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ItemApiPayloadData) SetType(v DatastoreItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadData) 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 *ItemApiPayloadData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *ItemApiPayloadDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *DatastoreItemsDataType `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_item_api_payload_data_attributes.go b/api/datadogV2/model_item_api_payload_data_attributes.go new file mode 100644 index 00000000000..0722749a6cb --- /dev/null +++ b/api/datadogV2/model_item_api_payload_data_attributes.go @@ -0,0 +1,324 @@ +// 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 ( + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ItemApiPayloadDataAttributes Metadata and content of a datastore item. +type ItemApiPayloadDataAttributes struct { + // Timestamp when the item was first created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Timestamp when the item was last modified. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // The ID of the organization that owns this item. + OrgId *int64 `json:"org_id,omitempty"` + // The name of the primary key column for this datastore. Primary column names: + // - Must abide by both [PostgreSQL naming conventions](https://www.postgresql.org/docs/7.0/syntax525.htm) + // - Cannot exceed 63 characters + PrimaryColumnName *string `json:"primary_column_name,omitempty"` + // A unique signature identifying this item version. + Signature *string `json:"signature,omitempty"` + // The unique identifier of the datastore containing this item. + StoreId *string `json:"store_id,omitempty"` + // The data content (as key-value pairs) of a datastore item. + Value map[string]interface{} `json:"value,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:"-"` +} + +// NewItemApiPayloadDataAttributes instantiates a new ItemApiPayloadDataAttributes 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 NewItemApiPayloadDataAttributes() *ItemApiPayloadDataAttributes { + this := ItemApiPayloadDataAttributes{} + return &this +} + +// NewItemApiPayloadDataAttributesWithDefaults instantiates a new ItemApiPayloadDataAttributes 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 NewItemApiPayloadDataAttributesWithDefaults() *ItemApiPayloadDataAttributes { + this := ItemApiPayloadDataAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ItemApiPayloadDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *ItemApiPayloadDataAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetOrgId() int64 { + if o == nil || o.OrgId == nil { + var ret int64 + return ret + } + return *o.OrgId +} + +// GetOrgIdOk returns a tuple with the OrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetOrgIdOk() (*int64, bool) { + if o == nil || o.OrgId == nil { + return nil, false + } + return o.OrgId, true +} + +// HasOrgId returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *ItemApiPayloadDataAttributes) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetPrimaryColumnName returns the PrimaryColumnName field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetPrimaryColumnName() string { + if o == nil || o.PrimaryColumnName == nil { + var ret string + return ret + } + return *o.PrimaryColumnName +} + +// GetPrimaryColumnNameOk returns a tuple with the PrimaryColumnName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetPrimaryColumnNameOk() (*string, bool) { + if o == nil || o.PrimaryColumnName == nil { + return nil, false + } + return o.PrimaryColumnName, true +} + +// HasPrimaryColumnName returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasPrimaryColumnName() bool { + return o != nil && o.PrimaryColumnName != nil +} + +// SetPrimaryColumnName gets a reference to the given string and assigns it to the PrimaryColumnName field. +func (o *ItemApiPayloadDataAttributes) SetPrimaryColumnName(v string) { + o.PrimaryColumnName = &v +} + +// GetSignature returns the Signature field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetSignature() string { + if o == nil || o.Signature == nil { + var ret string + return ret + } + return *o.Signature +} + +// GetSignatureOk returns a tuple with the Signature field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetSignatureOk() (*string, bool) { + if o == nil || o.Signature == nil { + return nil, false + } + return o.Signature, true +} + +// HasSignature returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasSignature() bool { + return o != nil && o.Signature != nil +} + +// SetSignature gets a reference to the given string and assigns it to the Signature field. +func (o *ItemApiPayloadDataAttributes) SetSignature(v string) { + o.Signature = &v +} + +// GetStoreId returns the StoreId field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetStoreId() string { + if o == nil || o.StoreId == nil { + var ret string + return ret + } + return *o.StoreId +} + +// GetStoreIdOk returns a tuple with the StoreId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetStoreIdOk() (*string, bool) { + if o == nil || o.StoreId == nil { + return nil, false + } + return o.StoreId, true +} + +// HasStoreId returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasStoreId() bool { + return o != nil && o.StoreId != nil +} + +// SetStoreId gets a reference to the given string and assigns it to the StoreId field. +func (o *ItemApiPayloadDataAttributes) SetStoreId(v string) { + o.StoreId = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *ItemApiPayloadDataAttributes) GetValue() map[string]interface{} { + if o == nil || o.Value == nil { + var ret map[string]interface{} + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadDataAttributes) GetValueOk() (*map[string]interface{}, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return &o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *ItemApiPayloadDataAttributes) HasValue() bool { + return o != nil && o.Value != nil +} + +// SetValue gets a reference to the given map[string]interface{} and assigns it to the Value field. +func (o *ItemApiPayloadDataAttributes) SetValue(v map[string]interface{}) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.PrimaryColumnName != nil { + toSerialize["primary_column_name"] = o.PrimaryColumnName + } + if o.Signature != nil { + toSerialize["signature"] = o.Signature + } + if o.StoreId != nil { + toSerialize["store_id"] = o.StoreId + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ItemApiPayloadDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + PrimaryColumnName *string `json:"primary_column_name,omitempty"` + Signature *string `json:"signature,omitempty"` + StoreId *string `json:"store_id,omitempty"` + Value map[string]interface{} `json:"value,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{"created_at", "modified_at", "org_id", "primary_column_name", "signature", "store_id", "value"}) + } else { + return err + } + o.CreatedAt = all.CreatedAt + o.ModifiedAt = all.ModifiedAt + o.OrgId = all.OrgId + o.PrimaryColumnName = all.PrimaryColumnName + o.Signature = all.Signature + o.StoreId = all.StoreId + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_item_api_payload_meta.go b/api/datadogV2/model_item_api_payload_meta.go new file mode 100644 index 00000000000..a7d3375ba0c --- /dev/null +++ b/api/datadogV2/model_item_api_payload_meta.go @@ -0,0 +1,149 @@ +// 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" +) + +// ItemApiPayloadMeta Additional metadata about a collection of datastore items, including pagination and schema information. +type ItemApiPayloadMeta struct { + // Pagination information for a collection of datastore items. + Page *ItemApiPayloadMetaPage `json:"page,omitempty"` + // Schema information about the datastore, including its primary key and field definitions. + Schema *ItemApiPayloadMetaSchema `json:"schema,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:"-"` +} + +// NewItemApiPayloadMeta instantiates a new ItemApiPayloadMeta 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 NewItemApiPayloadMeta() *ItemApiPayloadMeta { + this := ItemApiPayloadMeta{} + return &this +} + +// NewItemApiPayloadMetaWithDefaults instantiates a new ItemApiPayloadMeta 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 NewItemApiPayloadMetaWithDefaults() *ItemApiPayloadMeta { + this := ItemApiPayloadMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *ItemApiPayloadMeta) GetPage() ItemApiPayloadMetaPage { + if o == nil || o.Page == nil { + var ret ItemApiPayloadMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMeta) GetPageOk() (*ItemApiPayloadMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *ItemApiPayloadMeta) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given ItemApiPayloadMetaPage and assigns it to the Page field. +func (o *ItemApiPayloadMeta) SetPage(v ItemApiPayloadMetaPage) { + o.Page = &v +} + +// GetSchema returns the Schema field value if set, zero value otherwise. +func (o *ItemApiPayloadMeta) GetSchema() ItemApiPayloadMetaSchema { + if o == nil || o.Schema == nil { + var ret ItemApiPayloadMetaSchema + return ret + } + return *o.Schema +} + +// GetSchemaOk returns a tuple with the Schema field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMeta) GetSchemaOk() (*ItemApiPayloadMetaSchema, bool) { + if o == nil || o.Schema == nil { + return nil, false + } + return o.Schema, true +} + +// HasSchema returns a boolean if a field has been set. +func (o *ItemApiPayloadMeta) HasSchema() bool { + return o != nil && o.Schema != nil +} + +// SetSchema gets a reference to the given ItemApiPayloadMetaSchema and assigns it to the Schema field. +func (o *ItemApiPayloadMeta) SetSchema(v ItemApiPayloadMetaSchema) { + o.Schema = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + if o.Schema != nil { + toSerialize["schema"] = o.Schema + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ItemApiPayloadMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Page *ItemApiPayloadMetaPage `json:"page,omitempty"` + Schema *ItemApiPayloadMetaSchema `json:"schema,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{"page", "schema"}) + } else { + return err + } + + hasInvalidField := false + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + if all.Schema != nil && all.Schema.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Schema = all.Schema + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_item_api_payload_meta_page.go b/api/datadogV2/model_item_api_payload_meta_page.go new file mode 100644 index 00000000000..68a8efcf5a6 --- /dev/null +++ b/api/datadogV2/model_item_api_payload_meta_page.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" +) + +// ItemApiPayloadMetaPage Pagination information for a collection of datastore items. +type ItemApiPayloadMetaPage struct { + // Whether there are additional pages of items beyond the current page. + HasMore *bool `json:"hasMore,omitempty"` + // The total number of items in the datastore, ignoring any filters. + TotalCount *int64 `json:"totalCount,omitempty"` + // The total number of items that match the current filter criteria. + TotalFilteredCount *int64 `json:"totalFilteredCount,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:"-"` +} + +// NewItemApiPayloadMetaPage instantiates a new ItemApiPayloadMetaPage 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 NewItemApiPayloadMetaPage() *ItemApiPayloadMetaPage { + this := ItemApiPayloadMetaPage{} + return &this +} + +// NewItemApiPayloadMetaPageWithDefaults instantiates a new ItemApiPayloadMetaPage 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 NewItemApiPayloadMetaPageWithDefaults() *ItemApiPayloadMetaPage { + this := ItemApiPayloadMetaPage{} + return &this +} + +// GetHasMore returns the HasMore field value if set, zero value otherwise. +func (o *ItemApiPayloadMetaPage) GetHasMore() bool { + if o == nil || o.HasMore == nil { + var ret bool + return ret + } + return *o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMetaPage) GetHasMoreOk() (*bool, bool) { + if o == nil || o.HasMore == nil { + return nil, false + } + return o.HasMore, true +} + +// HasHasMore returns a boolean if a field has been set. +func (o *ItemApiPayloadMetaPage) HasHasMore() bool { + return o != nil && o.HasMore != nil +} + +// SetHasMore gets a reference to the given bool and assigns it to the HasMore field. +func (o *ItemApiPayloadMetaPage) SetHasMore(v bool) { + o.HasMore = &v +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *ItemApiPayloadMetaPage) GetTotalCount() int64 { + if o == nil || o.TotalCount == nil { + var ret int64 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMetaPage) GetTotalCountOk() (*int64, bool) { + if o == nil || o.TotalCount == nil { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *ItemApiPayloadMetaPage) HasTotalCount() bool { + return o != nil && o.TotalCount != nil +} + +// SetTotalCount gets a reference to the given int64 and assigns it to the TotalCount field. +func (o *ItemApiPayloadMetaPage) SetTotalCount(v int64) { + o.TotalCount = &v +} + +// GetTotalFilteredCount returns the TotalFilteredCount field value if set, zero value otherwise. +func (o *ItemApiPayloadMetaPage) GetTotalFilteredCount() int64 { + if o == nil || o.TotalFilteredCount == nil { + var ret int64 + return ret + } + return *o.TotalFilteredCount +} + +// GetTotalFilteredCountOk returns a tuple with the TotalFilteredCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMetaPage) GetTotalFilteredCountOk() (*int64, bool) { + if o == nil || o.TotalFilteredCount == nil { + return nil, false + } + return o.TotalFilteredCount, true +} + +// HasTotalFilteredCount returns a boolean if a field has been set. +func (o *ItemApiPayloadMetaPage) HasTotalFilteredCount() bool { + return o != nil && o.TotalFilteredCount != nil +} + +// SetTotalFilteredCount gets a reference to the given int64 and assigns it to the TotalFilteredCount field. +func (o *ItemApiPayloadMetaPage) SetTotalFilteredCount(v int64) { + o.TotalFilteredCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.HasMore != nil { + toSerialize["hasMore"] = o.HasMore + } + if o.TotalCount != nil { + toSerialize["totalCount"] = o.TotalCount + } + if o.TotalFilteredCount != nil { + toSerialize["totalFilteredCount"] = o.TotalFilteredCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ItemApiPayloadMetaPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + HasMore *bool `json:"hasMore,omitempty"` + TotalCount *int64 `json:"totalCount,omitempty"` + TotalFilteredCount *int64 `json:"totalFilteredCount,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{"hasMore", "totalCount", "totalFilteredCount"}) + } else { + return err + } + o.HasMore = all.HasMore + o.TotalCount = all.TotalCount + o.TotalFilteredCount = all.TotalFilteredCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_item_api_payload_meta_schema.go b/api/datadogV2/model_item_api_payload_meta_schema.go new file mode 100644 index 00000000000..95121d54a21 --- /dev/null +++ b/api/datadogV2/model_item_api_payload_meta_schema.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" +) + +// ItemApiPayloadMetaSchema Schema information about the datastore, including its primary key and field definitions. +type ItemApiPayloadMetaSchema struct { + // An array describing the columns available in this datastore. + Fields []ItemApiPayloadMetaSchemaField `json:"fields,omitempty"` + // The name of the primary key column for this datastore. + PrimaryKey *string `json:"primary_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:"-"` +} + +// NewItemApiPayloadMetaSchema instantiates a new ItemApiPayloadMetaSchema 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 NewItemApiPayloadMetaSchema() *ItemApiPayloadMetaSchema { + this := ItemApiPayloadMetaSchema{} + return &this +} + +// NewItemApiPayloadMetaSchemaWithDefaults instantiates a new ItemApiPayloadMetaSchema 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 NewItemApiPayloadMetaSchemaWithDefaults() *ItemApiPayloadMetaSchema { + this := ItemApiPayloadMetaSchema{} + return &this +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *ItemApiPayloadMetaSchema) GetFields() []ItemApiPayloadMetaSchemaField { + if o == nil || o.Fields == nil { + var ret []ItemApiPayloadMetaSchemaField + return ret + } + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMetaSchema) GetFieldsOk() (*[]ItemApiPayloadMetaSchemaField, bool) { + if o == nil || o.Fields == nil { + return nil, false + } + return &o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *ItemApiPayloadMetaSchema) HasFields() bool { + return o != nil && o.Fields != nil +} + +// SetFields gets a reference to the given []ItemApiPayloadMetaSchemaField and assigns it to the Fields field. +func (o *ItemApiPayloadMetaSchema) SetFields(v []ItemApiPayloadMetaSchemaField) { + o.Fields = v +} + +// GetPrimaryKey returns the PrimaryKey field value if set, zero value otherwise. +func (o *ItemApiPayloadMetaSchema) GetPrimaryKey() string { + if o == nil || o.PrimaryKey == nil { + var ret string + return ret + } + return *o.PrimaryKey +} + +// GetPrimaryKeyOk returns a tuple with the PrimaryKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMetaSchema) GetPrimaryKeyOk() (*string, bool) { + if o == nil || o.PrimaryKey == nil { + return nil, false + } + return o.PrimaryKey, true +} + +// HasPrimaryKey returns a boolean if a field has been set. +func (o *ItemApiPayloadMetaSchema) HasPrimaryKey() bool { + return o != nil && o.PrimaryKey != nil +} + +// SetPrimaryKey gets a reference to the given string and assigns it to the PrimaryKey field. +func (o *ItemApiPayloadMetaSchema) SetPrimaryKey(v string) { + o.PrimaryKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadMetaSchema) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Fields != nil { + toSerialize["fields"] = o.Fields + } + if o.PrimaryKey != nil { + toSerialize["primary_key"] = o.PrimaryKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ItemApiPayloadMetaSchema) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Fields []ItemApiPayloadMetaSchemaField `json:"fields,omitempty"` + PrimaryKey *string `json:"primary_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{"fields", "primary_key"}) + } else { + return err + } + o.Fields = all.Fields + o.PrimaryKey = all.PrimaryKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_item_api_payload_meta_schema_field.go b/api/datadogV2/model_item_api_payload_meta_schema_field.go new file mode 100644 index 00000000000..936e8bd7b78 --- /dev/null +++ b/api/datadogV2/model_item_api_payload_meta_schema_field.go @@ -0,0 +1,133 @@ +// 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" +) + +// ItemApiPayloadMetaSchemaField Information about a specific column in the datastore schema. +type ItemApiPayloadMetaSchemaField struct { + // The name of this column in the datastore. + Name string `json:"name"` + // The data type of this column. For example, 'string', 'number', or 'boolean'. + Type string `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:"-"` +} + +// NewItemApiPayloadMetaSchemaField instantiates a new ItemApiPayloadMetaSchemaField 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 NewItemApiPayloadMetaSchemaField(name string, typeVar string) *ItemApiPayloadMetaSchemaField { + this := ItemApiPayloadMetaSchemaField{} + this.Name = name + this.Type = typeVar + return &this +} + +// NewItemApiPayloadMetaSchemaFieldWithDefaults instantiates a new ItemApiPayloadMetaSchemaField 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 NewItemApiPayloadMetaSchemaFieldWithDefaults() *ItemApiPayloadMetaSchemaField { + this := ItemApiPayloadMetaSchemaField{} + return &this +} + +// GetName returns the Name field value. +func (o *ItemApiPayloadMetaSchemaField) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ItemApiPayloadMetaSchemaField) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *ItemApiPayloadMetaSchemaField) SetName(v string) { + o.Name = v +} + +// GetType returns the Type field value. +func (o *ItemApiPayloadMetaSchemaField) GetType() string { + if o == nil { + var ret string + 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 *ItemApiPayloadMetaSchemaField) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ItemApiPayloadMetaSchemaField) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ItemApiPayloadMetaSchemaField) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ItemApiPayloadMetaSchemaField) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name 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{"name", "type"}) + } else { + return err + } + o.Name = *all.Name + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_put_apps_datastore_item_response_array.go b/api/datadogV2/model_put_apps_datastore_item_response_array.go new file mode 100644 index 00000000000..6c9ab13766a --- /dev/null +++ b/api/datadogV2/model_put_apps_datastore_item_response_array.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" +) + +// PutAppsDatastoreItemResponseArray Response after successfully inserting multiple items into a datastore, containing the identifiers of the created items. +type PutAppsDatastoreItemResponseArray struct { + // An array of data objects containing the identifiers of the successfully inserted items. + Data []PutAppsDatastoreItemResponseData `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:"-"` +} + +// NewPutAppsDatastoreItemResponseArray instantiates a new PutAppsDatastoreItemResponseArray 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 NewPutAppsDatastoreItemResponseArray(data []PutAppsDatastoreItemResponseData) *PutAppsDatastoreItemResponseArray { + this := PutAppsDatastoreItemResponseArray{} + this.Data = data + return &this +} + +// NewPutAppsDatastoreItemResponseArrayWithDefaults instantiates a new PutAppsDatastoreItemResponseArray 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 NewPutAppsDatastoreItemResponseArrayWithDefaults() *PutAppsDatastoreItemResponseArray { + this := PutAppsDatastoreItemResponseArray{} + return &this +} + +// GetData returns the Data field value. +func (o *PutAppsDatastoreItemResponseArray) GetData() []PutAppsDatastoreItemResponseData { + if o == nil { + var ret []PutAppsDatastoreItemResponseData + 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 *PutAppsDatastoreItemResponseArray) GetDataOk() (*[]PutAppsDatastoreItemResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *PutAppsDatastoreItemResponseArray) SetData(v []PutAppsDatastoreItemResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PutAppsDatastoreItemResponseArray) 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 *PutAppsDatastoreItemResponseArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]PutAppsDatastoreItemResponseData `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_put_apps_datastore_item_response_data.go b/api/datadogV2/model_put_apps_datastore_item_response_data.go new file mode 100644 index 00000000000..b31fb34c0b9 --- /dev/null +++ b/api/datadogV2/model_put_apps_datastore_item_response_data.go @@ -0,0 +1,148 @@ +// 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" +) + +// PutAppsDatastoreItemResponseData Data containing the identifier of a single item that was successfully inserted into the datastore. +type PutAppsDatastoreItemResponseData struct { + // The unique identifier assigned to the inserted item. + Id *string `json:"id,omitempty"` + // The resource type for datastore items. + Type DatastoreItemsDataType `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:"-"` +} + +// NewPutAppsDatastoreItemResponseData instantiates a new PutAppsDatastoreItemResponseData 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 NewPutAppsDatastoreItemResponseData(typeVar DatastoreItemsDataType) *PutAppsDatastoreItemResponseData { + this := PutAppsDatastoreItemResponseData{} + this.Type = typeVar + return &this +} + +// NewPutAppsDatastoreItemResponseDataWithDefaults instantiates a new PutAppsDatastoreItemResponseData 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 NewPutAppsDatastoreItemResponseDataWithDefaults() *PutAppsDatastoreItemResponseData { + this := PutAppsDatastoreItemResponseData{} + var typeVar DatastoreItemsDataType = DATASTOREITEMSDATATYPE_ITEMS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PutAppsDatastoreItemResponseData) 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 *PutAppsDatastoreItemResponseData) 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 *PutAppsDatastoreItemResponseData) 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 *PutAppsDatastoreItemResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *PutAppsDatastoreItemResponseData) GetType() DatastoreItemsDataType { + if o == nil { + var ret DatastoreItemsDataType + 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 *PutAppsDatastoreItemResponseData) GetTypeOk() (*DatastoreItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *PutAppsDatastoreItemResponseData) SetType(v DatastoreItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o PutAppsDatastoreItemResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *PutAppsDatastoreItemResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Type *DatastoreItemsDataType `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{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + 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_apps_datastore_item_request.go b/api/datadogV2/model_update_apps_datastore_item_request.go new file mode 100644 index 00000000000..8fba595f631 --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_item_request.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" +) + +// UpdateAppsDatastoreItemRequest Request to update specific fields on an existing datastore item. +type UpdateAppsDatastoreItemRequest struct { + // Data wrapper containing the item identifier and the changes to apply during the update operation. + Data *UpdateAppsDatastoreItemRequestData `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:"-"` +} + +// NewUpdateAppsDatastoreItemRequest instantiates a new UpdateAppsDatastoreItemRequest 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 NewUpdateAppsDatastoreItemRequest() *UpdateAppsDatastoreItemRequest { + this := UpdateAppsDatastoreItemRequest{} + return &this +} + +// NewUpdateAppsDatastoreItemRequestWithDefaults instantiates a new UpdateAppsDatastoreItemRequest 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 NewUpdateAppsDatastoreItemRequestWithDefaults() *UpdateAppsDatastoreItemRequest { + this := UpdateAppsDatastoreItemRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreItemRequest) GetData() UpdateAppsDatastoreItemRequestData { + if o == nil || o.Data == nil { + var ret UpdateAppsDatastoreItemRequestData + 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 *UpdateAppsDatastoreItemRequest) GetDataOk() (*UpdateAppsDatastoreItemRequestData, 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 *UpdateAppsDatastoreItemRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given UpdateAppsDatastoreItemRequestData and assigns it to the Data field. +func (o *UpdateAppsDatastoreItemRequest) SetData(v UpdateAppsDatastoreItemRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreItemRequest) 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 *UpdateAppsDatastoreItemRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *UpdateAppsDatastoreItemRequestData `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_update_apps_datastore_item_request_data.go b/api/datadogV2/model_update_apps_datastore_item_request_data.go new file mode 100644 index 00000000000..45f5b30acc5 --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_item_request_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" +) + +// UpdateAppsDatastoreItemRequestData Data wrapper containing the item identifier and the changes to apply during the update operation. +type UpdateAppsDatastoreItemRequestData struct { + // Attributes for updating a datastore item, including the item key and changes to apply. + Attributes *UpdateAppsDatastoreItemRequestDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the datastore item. + Id *string `json:"id,omitempty"` + // The resource type for datastore items. + Type UpdateAppsDatastoreItemRequestDataType `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:"-"` +} + +// NewUpdateAppsDatastoreItemRequestData instantiates a new UpdateAppsDatastoreItemRequestData 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 NewUpdateAppsDatastoreItemRequestData(typeVar UpdateAppsDatastoreItemRequestDataType) *UpdateAppsDatastoreItemRequestData { + this := UpdateAppsDatastoreItemRequestData{} + this.Type = typeVar + return &this +} + +// NewUpdateAppsDatastoreItemRequestDataWithDefaults instantiates a new UpdateAppsDatastoreItemRequestData 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 NewUpdateAppsDatastoreItemRequestDataWithDefaults() *UpdateAppsDatastoreItemRequestData { + this := UpdateAppsDatastoreItemRequestData{} + var typeVar UpdateAppsDatastoreItemRequestDataType = UPDATEAPPSDATASTOREITEMREQUESTDATATYPE_ITEMS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreItemRequestData) GetAttributes() UpdateAppsDatastoreItemRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret UpdateAppsDatastoreItemRequestDataAttributes + 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 *UpdateAppsDatastoreItemRequestData) GetAttributesOk() (*UpdateAppsDatastoreItemRequestDataAttributes, 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 *UpdateAppsDatastoreItemRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UpdateAppsDatastoreItemRequestDataAttributes and assigns it to the Attributes field. +func (o *UpdateAppsDatastoreItemRequestData) SetAttributes(v UpdateAppsDatastoreItemRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreItemRequestData) 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 *UpdateAppsDatastoreItemRequestData) 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 *UpdateAppsDatastoreItemRequestData) 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 *UpdateAppsDatastoreItemRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *UpdateAppsDatastoreItemRequestData) GetType() UpdateAppsDatastoreItemRequestDataType { + if o == nil { + var ret UpdateAppsDatastoreItemRequestDataType + 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 *UpdateAppsDatastoreItemRequestData) GetTypeOk() (*UpdateAppsDatastoreItemRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UpdateAppsDatastoreItemRequestData) SetType(v UpdateAppsDatastoreItemRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreItemRequestData) 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 *UpdateAppsDatastoreItemRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UpdateAppsDatastoreItemRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *UpdateAppsDatastoreItemRequestDataType `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_update_apps_datastore_item_request_data_attributes.go b/api/datadogV2/model_update_apps_datastore_item_request_data_attributes.go new file mode 100644 index 00000000000..18ed2438392 --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_item_request_data_attributes.go @@ -0,0 +1,177 @@ +// 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" +) + +// UpdateAppsDatastoreItemRequestDataAttributes Attributes for updating a datastore item, including the item key and changes to apply. +type UpdateAppsDatastoreItemRequestDataAttributes struct { + // The unique identifier of the item being updated. + Id *string `json:"id,omitempty"` + // Changes to apply to a datastore item using set operations. + ItemChanges UpdateAppsDatastoreItemRequestDataAttributesItemChanges `json:"item_changes"` + // The primary key that identifies the item to update. Cannot exceed 256 characters. + ItemKey string `json:"item_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:"-"` +} + +// NewUpdateAppsDatastoreItemRequestDataAttributes instantiates a new UpdateAppsDatastoreItemRequestDataAttributes 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 NewUpdateAppsDatastoreItemRequestDataAttributes(itemChanges UpdateAppsDatastoreItemRequestDataAttributesItemChanges, itemKey string) *UpdateAppsDatastoreItemRequestDataAttributes { + this := UpdateAppsDatastoreItemRequestDataAttributes{} + this.ItemChanges = itemChanges + this.ItemKey = itemKey + return &this +} + +// NewUpdateAppsDatastoreItemRequestDataAttributesWithDefaults instantiates a new UpdateAppsDatastoreItemRequestDataAttributes 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 NewUpdateAppsDatastoreItemRequestDataAttributesWithDefaults() *UpdateAppsDatastoreItemRequestDataAttributes { + this := UpdateAppsDatastoreItemRequestDataAttributes{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) 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 *UpdateAppsDatastoreItemRequestDataAttributes) 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 *UpdateAppsDatastoreItemRequestDataAttributes) 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 *UpdateAppsDatastoreItemRequestDataAttributes) SetId(v string) { + o.Id = &v +} + +// GetItemChanges returns the ItemChanges field value. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) GetItemChanges() UpdateAppsDatastoreItemRequestDataAttributesItemChanges { + if o == nil { + var ret UpdateAppsDatastoreItemRequestDataAttributesItemChanges + return ret + } + return o.ItemChanges +} + +// GetItemChangesOk returns a tuple with the ItemChanges field value +// and a boolean to check if the value has been set. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) GetItemChangesOk() (*UpdateAppsDatastoreItemRequestDataAttributesItemChanges, bool) { + if o == nil { + return nil, false + } + return &o.ItemChanges, true +} + +// SetItemChanges sets field value. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) SetItemChanges(v UpdateAppsDatastoreItemRequestDataAttributesItemChanges) { + o.ItemChanges = v +} + +// GetItemKey returns the ItemKey field value. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) GetItemKey() string { + if o == nil { + var ret string + return ret + } + return o.ItemKey +} + +// GetItemKeyOk returns a tuple with the ItemKey field value +// and a boolean to check if the value has been set. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) GetItemKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ItemKey, true +} + +// SetItemKey sets field value. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) SetItemKey(v string) { + o.ItemKey = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreItemRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["item_changes"] = o.ItemChanges + toSerialize["item_key"] = o.ItemKey + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateAppsDatastoreItemRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + ItemChanges *UpdateAppsDatastoreItemRequestDataAttributesItemChanges `json:"item_changes"` + ItemKey *string `json:"item_key"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ItemChanges == nil { + return fmt.Errorf("required field item_changes missing") + } + if all.ItemKey == nil { + return fmt.Errorf("required field item_key missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "item_changes", "item_key"}) + } else { + return err + } + + hasInvalidField := false + o.Id = all.Id + if all.ItemChanges.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ItemChanges = *all.ItemChanges + o.ItemKey = *all.ItemKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_update_apps_datastore_item_request_data_attributes_item_changes.go b/api/datadogV2/model_update_apps_datastore_item_request_data_attributes_item_changes.go new file mode 100644 index 00000000000..20584924eeb --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_item_request_data_attributes_item_changes.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" +) + +// UpdateAppsDatastoreItemRequestDataAttributesItemChanges Changes to apply to a datastore item using set operations. +type UpdateAppsDatastoreItemRequestDataAttributesItemChanges struct { + // Set operation that contains key-value pairs to set on the datastore item. + OpsSet map[string]interface{} `json:"ops_set,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:"-"` +} + +// NewUpdateAppsDatastoreItemRequestDataAttributesItemChanges instantiates a new UpdateAppsDatastoreItemRequestDataAttributesItemChanges 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 NewUpdateAppsDatastoreItemRequestDataAttributesItemChanges() *UpdateAppsDatastoreItemRequestDataAttributesItemChanges { + this := UpdateAppsDatastoreItemRequestDataAttributesItemChanges{} + return &this +} + +// NewUpdateAppsDatastoreItemRequestDataAttributesItemChangesWithDefaults instantiates a new UpdateAppsDatastoreItemRequestDataAttributesItemChanges 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 NewUpdateAppsDatastoreItemRequestDataAttributesItemChangesWithDefaults() *UpdateAppsDatastoreItemRequestDataAttributesItemChanges { + this := UpdateAppsDatastoreItemRequestDataAttributesItemChanges{} + return &this +} + +// GetOpsSet returns the OpsSet field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreItemRequestDataAttributesItemChanges) GetOpsSet() map[string]interface{} { + if o == nil || o.OpsSet == nil { + var ret map[string]interface{} + return ret + } + return o.OpsSet +} + +// GetOpsSetOk returns a tuple with the OpsSet field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAppsDatastoreItemRequestDataAttributesItemChanges) GetOpsSetOk() (*map[string]interface{}, bool) { + if o == nil || o.OpsSet == nil { + return nil, false + } + return &o.OpsSet, true +} + +// HasOpsSet returns a boolean if a field has been set. +func (o *UpdateAppsDatastoreItemRequestDataAttributesItemChanges) HasOpsSet() bool { + return o != nil && o.OpsSet != nil +} + +// SetOpsSet gets a reference to the given map[string]interface{} and assigns it to the OpsSet field. +func (o *UpdateAppsDatastoreItemRequestDataAttributesItemChanges) SetOpsSet(v map[string]interface{}) { + o.OpsSet = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreItemRequestDataAttributesItemChanges) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.OpsSet != nil { + toSerialize["ops_set"] = o.OpsSet + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateAppsDatastoreItemRequestDataAttributesItemChanges) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + OpsSet map[string]interface{} `json:"ops_set,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{"ops_set"}) + } else { + return err + } + o.OpsSet = all.OpsSet + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_apps_datastore_item_request_data_type.go b/api/datadogV2/model_update_apps_datastore_item_request_data_type.go new file mode 100644 index 00000000000..918b00039ab --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_item_request_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" +) + +// UpdateAppsDatastoreItemRequestDataType The resource type for datastore items. +type UpdateAppsDatastoreItemRequestDataType string + +// List of UpdateAppsDatastoreItemRequestDataType. +const ( + UPDATEAPPSDATASTOREITEMREQUESTDATATYPE_ITEMS UpdateAppsDatastoreItemRequestDataType = "items" +) + +var allowedUpdateAppsDatastoreItemRequestDataTypeEnumValues = []UpdateAppsDatastoreItemRequestDataType{ + UPDATEAPPSDATASTOREITEMREQUESTDATATYPE_ITEMS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *UpdateAppsDatastoreItemRequestDataType) GetAllowedValues() []UpdateAppsDatastoreItemRequestDataType { + return allowedUpdateAppsDatastoreItemRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *UpdateAppsDatastoreItemRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = UpdateAppsDatastoreItemRequestDataType(value) + return nil +} + +// NewUpdateAppsDatastoreItemRequestDataTypeFromValue returns a pointer to a valid UpdateAppsDatastoreItemRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewUpdateAppsDatastoreItemRequestDataTypeFromValue(v string) (*UpdateAppsDatastoreItemRequestDataType, error) { + ev := UpdateAppsDatastoreItemRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for UpdateAppsDatastoreItemRequestDataType: valid values are %v", v, allowedUpdateAppsDatastoreItemRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v UpdateAppsDatastoreItemRequestDataType) IsValid() bool { + for _, existing := range allowedUpdateAppsDatastoreItemRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to UpdateAppsDatastoreItemRequestDataType value. +func (v UpdateAppsDatastoreItemRequestDataType) Ptr() *UpdateAppsDatastoreItemRequestDataType { + return &v +} diff --git a/api/datadogV2/model_update_apps_datastore_request.go b/api/datadogV2/model_update_apps_datastore_request.go new file mode 100644 index 00000000000..fc1ed8f35db --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_request.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" +) + +// UpdateAppsDatastoreRequest Request to update a datastore's configuration such as its name or description. +type UpdateAppsDatastoreRequest struct { + // Data wrapper containing the datastore identifier and the attributes to update. + Data *UpdateAppsDatastoreRequestData `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:"-"` +} + +// NewUpdateAppsDatastoreRequest instantiates a new UpdateAppsDatastoreRequest 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 NewUpdateAppsDatastoreRequest() *UpdateAppsDatastoreRequest { + this := UpdateAppsDatastoreRequest{} + return &this +} + +// NewUpdateAppsDatastoreRequestWithDefaults instantiates a new UpdateAppsDatastoreRequest 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 NewUpdateAppsDatastoreRequestWithDefaults() *UpdateAppsDatastoreRequest { + this := UpdateAppsDatastoreRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreRequest) GetData() UpdateAppsDatastoreRequestData { + if o == nil || o.Data == nil { + var ret UpdateAppsDatastoreRequestData + 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 *UpdateAppsDatastoreRequest) GetDataOk() (*UpdateAppsDatastoreRequestData, 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 *UpdateAppsDatastoreRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given UpdateAppsDatastoreRequestData and assigns it to the Data field. +func (o *UpdateAppsDatastoreRequest) SetData(v UpdateAppsDatastoreRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreRequest) 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 *UpdateAppsDatastoreRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *UpdateAppsDatastoreRequestData `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_update_apps_datastore_request_data.go b/api/datadogV2/model_update_apps_datastore_request_data.go new file mode 100644 index 00000000000..4a15da0ef32 --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_request_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" +) + +// UpdateAppsDatastoreRequestData Data wrapper containing the datastore identifier and the attributes to update. +type UpdateAppsDatastoreRequestData struct { + // Attributes that can be updated on a datastore. + Attributes *UpdateAppsDatastoreRequestDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the datastore to update. + Id *string `json:"id,omitempty"` + // The resource type for datastores. + Type DatastoreDataType `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:"-"` +} + +// NewUpdateAppsDatastoreRequestData instantiates a new UpdateAppsDatastoreRequestData 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 NewUpdateAppsDatastoreRequestData(typeVar DatastoreDataType) *UpdateAppsDatastoreRequestData { + this := UpdateAppsDatastoreRequestData{} + this.Type = typeVar + return &this +} + +// NewUpdateAppsDatastoreRequestDataWithDefaults instantiates a new UpdateAppsDatastoreRequestData 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 NewUpdateAppsDatastoreRequestDataWithDefaults() *UpdateAppsDatastoreRequestData { + this := UpdateAppsDatastoreRequestData{} + var typeVar DatastoreDataType = DATASTOREDATATYPE_DATASTORES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreRequestData) GetAttributes() UpdateAppsDatastoreRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret UpdateAppsDatastoreRequestDataAttributes + 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 *UpdateAppsDatastoreRequestData) GetAttributesOk() (*UpdateAppsDatastoreRequestDataAttributes, 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 *UpdateAppsDatastoreRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UpdateAppsDatastoreRequestDataAttributes and assigns it to the Attributes field. +func (o *UpdateAppsDatastoreRequestData) SetAttributes(v UpdateAppsDatastoreRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreRequestData) 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 *UpdateAppsDatastoreRequestData) 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 *UpdateAppsDatastoreRequestData) 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 *UpdateAppsDatastoreRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *UpdateAppsDatastoreRequestData) GetType() DatastoreDataType { + if o == nil { + var ret DatastoreDataType + 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 *UpdateAppsDatastoreRequestData) GetTypeOk() (*DatastoreDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UpdateAppsDatastoreRequestData) SetType(v DatastoreDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreRequestData) 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 *UpdateAppsDatastoreRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UpdateAppsDatastoreRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *DatastoreDataType `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_update_apps_datastore_request_data_attributes.go b/api/datadogV2/model_update_apps_datastore_request_data_attributes.go new file mode 100644 index 00000000000..1369ba00335 --- /dev/null +++ b/api/datadogV2/model_update_apps_datastore_request_data_attributes.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" +) + +// UpdateAppsDatastoreRequestDataAttributes Attributes that can be updated on a datastore. +type UpdateAppsDatastoreRequestDataAttributes struct { + // A human-readable description about the datastore. + Description *string `json:"description,omitempty"` + // The display name of the datastore. + Name *string `json:"name,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:"-"` +} + +// NewUpdateAppsDatastoreRequestDataAttributes instantiates a new UpdateAppsDatastoreRequestDataAttributes 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 NewUpdateAppsDatastoreRequestDataAttributes() *UpdateAppsDatastoreRequestDataAttributes { + this := UpdateAppsDatastoreRequestDataAttributes{} + return &this +} + +// NewUpdateAppsDatastoreRequestDataAttributesWithDefaults instantiates a new UpdateAppsDatastoreRequestDataAttributes 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 NewUpdateAppsDatastoreRequestDataAttributesWithDefaults() *UpdateAppsDatastoreRequestDataAttributes { + this := UpdateAppsDatastoreRequestDataAttributes{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreRequestDataAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAppsDatastoreRequestDataAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAppsDatastoreRequestDataAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateAppsDatastoreRequestDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateAppsDatastoreRequestDataAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAppsDatastoreRequestDataAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateAppsDatastoreRequestDataAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateAppsDatastoreRequestDataAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateAppsDatastoreRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateAppsDatastoreRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,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{"description", "name"}) + } else { + return err + } + o.Description = all.Description + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/actions-datastores/BulkWriteDatastoreItems.go b/examples/v2/actions-datastores/BulkWriteDatastoreItems.go new file mode 100644 index 00000000000..e7e06ae8ca7 --- /dev/null +++ b/examples/v2/actions-datastores/BulkWriteDatastoreItems.go @@ -0,0 +1,49 @@ +// Bulk write datastore items 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + body := datadogV2.BulkPutAppsDatastoreItemsRequest{ + Data: &datadogV2.BulkPutAppsDatastoreItemsRequestData{ + Attributes: &datadogV2.BulkPutAppsDatastoreItemsRequestDataAttributes{ + Values: []map[string]interface{}{ + { + "id": "cust_3141", + "name": "Johnathan", + }, + { + "id": "cust_3142", + "name": "Mary", + }, + }, + }, + Type: datadogV2.DATASTOREITEMSDATATYPE_ITEMS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.BulkWriteDatastoreItems(ctx, DatastoreDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.BulkWriteDatastoreItems`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.BulkWriteDatastoreItems`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/CreateDatastore.go b/examples/v2/actions-datastores/CreateDatastore.go new file mode 100644 index 00000000000..7b9fcc537f9 --- /dev/null +++ b/examples/v2/actions-datastores/CreateDatastore.go @@ -0,0 +1,38 @@ +// Create datastore 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.CreateAppsDatastoreRequest{ + Data: &datadogV2.CreateAppsDatastoreRequestData{ + Attributes: &datadogV2.CreateAppsDatastoreRequestDataAttributes{ + Name: "datastore-name", + PrimaryColumnName: "primaryKey", + }, + Type: datadogV2.DATASTOREDATATYPE_DATASTORES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.CreateDatastore(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.CreateDatastore`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.CreateDatastore`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/DeleteDatastore.go b/examples/v2/actions-datastores/DeleteDatastore.go new file mode 100644 index 00000000000..fa042a7f8f3 --- /dev/null +++ b/examples/v2/actions-datastores/DeleteDatastore.go @@ -0,0 +1,28 @@ +// Delete datastore returns "OK" 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + r, err := api.DeleteDatastore(ctx, DatastoreDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.DeleteDatastore`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/actions-datastores/DeleteDatastoreItem.go b/examples/v2/actions-datastores/DeleteDatastoreItem.go new file mode 100644 index 00000000000..71a02769cf0 --- /dev/null +++ b/examples/v2/actions-datastores/DeleteDatastoreItem.go @@ -0,0 +1,40 @@ +// Delete datastore item 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + body := datadogV2.DeleteAppsDatastoreItemRequest{ + Data: &datadogV2.DeleteAppsDatastoreItemRequestData{ + Attributes: &datadogV2.DeleteAppsDatastoreItemRequestDataAttributes{ + ItemKey: "test-key", + }, + Type: datadogV2.DATASTOREITEMSDATATYPE_ITEMS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.DeleteDatastoreItem(ctx, DatastoreDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.DeleteDatastoreItem`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.DeleteDatastoreItem`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/GetDatastore.go b/examples/v2/actions-datastores/GetDatastore.go new file mode 100644 index 00000000000..76b6f7f5841 --- /dev/null +++ b/examples/v2/actions-datastores/GetDatastore.go @@ -0,0 +1,32 @@ +// Get datastore 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.GetDatastore(ctx, DatastoreDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.GetDatastore`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.GetDatastore`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/ListDatastoreItems.go b/examples/v2/actions-datastores/ListDatastoreItems.go new file mode 100644 index 00000000000..4892fa965ff --- /dev/null +++ b/examples/v2/actions-datastores/ListDatastoreItems.go @@ -0,0 +1,32 @@ +// List datastore items 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.ListDatastoreItems(ctx, DatastoreDataID, *datadogV2.NewListDatastoreItemsOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.ListDatastoreItems`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.ListDatastoreItems`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/ListDatastores.go b/examples/v2/actions-datastores/ListDatastores.go new file mode 100644 index 00000000000..18898a81fbf --- /dev/null +++ b/examples/v2/actions-datastores/ListDatastores.go @@ -0,0 +1,29 @@ +// List datastores 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.NewActionsDatastoresApi(apiClient) + resp, r, err := api.ListDatastores(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.ListDatastores`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.ListDatastores`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/UpdateDatastore.go b/examples/v2/actions-datastores/UpdateDatastore.go new file mode 100644 index 00000000000..15b77d8a576 --- /dev/null +++ b/examples/v2/actions-datastores/UpdateDatastore.go @@ -0,0 +1,41 @@ +// Update datastore 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + body := datadogV2.UpdateAppsDatastoreRequest{ + Data: &datadogV2.UpdateAppsDatastoreRequestData{ + Attributes: &datadogV2.UpdateAppsDatastoreRequestDataAttributes{ + Name: datadog.PtrString("updated name"), + }, + Type: datadogV2.DATASTOREDATATYPE_DATASTORES, + Id: datadog.PtrString(DatastoreDataID), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.UpdateDatastore(ctx, DatastoreDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.UpdateDatastore`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.UpdateDatastore`:\n%s\n", responseContent) +} diff --git a/examples/v2/actions-datastores/UpdateDatastoreItem.go b/examples/v2/actions-datastores/UpdateDatastoreItem.go new file mode 100644 index 00000000000..437c5f62980 --- /dev/null +++ b/examples/v2/actions-datastores/UpdateDatastoreItem.go @@ -0,0 +1,41 @@ +// Update datastore item 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() { + // there is a valid "datastore" in the system + DatastoreDataID := os.Getenv("DATASTORE_DATA_ID") + + body := datadogV2.UpdateAppsDatastoreItemRequest{ + Data: &datadogV2.UpdateAppsDatastoreItemRequestData{ + Attributes: &datadogV2.UpdateAppsDatastoreItemRequestDataAttributes{ + ItemChanges: datadogV2.UpdateAppsDatastoreItemRequestDataAttributesItemChanges{}, + ItemKey: "test-key", + }, + Type: datadogV2.UPDATEAPPSDATASTOREITEMREQUESTDATATYPE_ITEMS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewActionsDatastoresApi(apiClient) + resp, r, err := api.UpdateDatastoreItem(ctx, DatastoreDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ActionsDatastoresApi.UpdateDatastoreItem`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `ActionsDatastoresApi.UpdateDatastoreItem`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 27b5ccf0639..bd5aab9ab3d 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -44,6 +44,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "AuthenticationApi": reflect.ValueOf(datadogV1.NewAuthenticationApi), }, "v2": { + "ActionsDatastoresApi": reflect.ValueOf(datadogV2.NewActionsDatastoresApi), "ActionConnectionApi": reflect.ValueOf(datadogV2.NewActionConnectionApi), "AgentlessScanningApi": reflect.ValueOf(datadogV2.NewAgentlessScanningApi), "KeyManagementApi": reflect.ValueOf(datadogV2.NewKeyManagementApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..91fb9c71dbe --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-06T19:02:39.774Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..9a2c16c0d2e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Bad_Request_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"226df00a-c52e-41cd-9067-2b8c2b18649d","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"values":[{"id":"cust_3141","name":"Johnathan"},{"badPrimaryKey":"key2","name":"Johnathan"}]},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores/226df00a-c52e-41cd-9067-2b8c2b18649d/items/bulk + response: + body: '{"errors":[{"status":"400","id":"b6f27ea4-0a0b-43fa-92ef-b023f8e06e2c","title":"item + key missing or invalid","detail":"primary column \"id\" is missing"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/226df00a-c52e-41cd-9067-2b8c2b18649d + response: + body: '{"data":{"id":"226df00a-c52e-41cd-9067-2b8c2b18649d","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..468bf22ec4d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-06T19:02:54.153Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..6ab3b926d5a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"values":[{"id":"cust_3141","name":"Johnathan"},{"id":"cust_3142","name":"Mary"}]},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores/70b87c26-886f-497a-bd9d-09f53bc9b40c/items/bulk + response: + body: '{"errors":[{"status":"404","id":"b799bd68-cfb7-4c3d-8026-e0e00c27252f","title":"datastore + not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.freeze new file mode 100644 index 00000000000..315b978b48d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:06.486Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.yaml new file mode 100644 index 00000000000..bdfc2936ad1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Bulk_write_datastore_items_returns_OK_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"6c0dbbfd-a905-4f79-9c2f-16cb4d9a56a7","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"values":[{"id":"cust_3141","name":"Johnathan"},{"id":"cust_3142","name":"Mary"}]},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores/6c0dbbfd-a905-4f79-9c2f-16cb4d9a56a7/items/bulk + response: + body: '{"data":[{"id":"8c6bba37-01d4-4b49-9d90-4ac909aa8c9f","type":"items"},{"id":"285244c6-b07f-4502-928b-2444c1de31e7","type":"items"}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/6c0dbbfd-a905-4f79-9c2f-16cb4d9a56a7 + response: + body: '{"data":{"id":"6c0dbbfd-a905-4f79-9c2f-16cb4d9a56a7","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..bc7536ef1fc --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:06.982Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..8847ab0ff8b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_Bad_Request_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"name":"datastore-name","primary_column_name":"0invalid_key"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"errors":[{"status":"400","id":"78cd887f-1a77-421f-915d-4bfebb3784c0","title":"datastore + configuration invalid","detail":"column name ''0invalid_key'' does not start + with a letter or an underscore"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.freeze new file mode 100644 index 00000000000..6833aae6503 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:07.136Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.yaml new file mode 100644 index 00000000000..0deca2f39f9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Create_datastore_returns_OK_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"name":"datastore-name","primary_column_name":"primaryKey"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"040e45f8-b354-4817-8c01-e5d2bb8aa55d","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/040e45f8-b354-4817-8c01-e5d2bb8aa55d + response: + body: '{"data":{"id":"040e45f8-b354-4817-8c01-e5d2bb8aa55d","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..0bfb558f918 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-06T19:03:07.134Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..226ca97c006 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"item_key":"primaryKey"},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/invalid-uuid/items + response: + body: '{"errors":[{"status":"400","id":"5adc82ee-f920-4fe9-aafc-10cabac28b68","title":"invalid + path parameter","detail":"invalid datastoreId format in path","source":{"parameter":"datastoreId"}}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..2636c1d2bfe --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-06T19:03:18.396Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..f3fd9d33964 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"item_key":"primaryKey"},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/70b87c26-886f-497a-bd9d-09f53bc9b40c/items + response: + body: '{"errors":[{"status":"404","id":"38b88198-bd74-4494-8571-f689b21cd216","title":"datastore + not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.freeze new file mode 100644 index 00000000000..c639a010e96 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:07.743Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.yaml new file mode 100644 index 00000000000..6b50bcb1c1e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_item_returns_OK_response.yaml @@ -0,0 +1,79 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"ad9cc3b7-da9b-452d-8eab-a1e0a0a4e3d8","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"conflict_mode":"fail_on_conflict","values":[{"data":"test-value","id":"test-key"}]},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores/ad9cc3b7-da9b-452d-8eab-a1e0a0a4e3d8/items/bulk + response: + body: '{"data":[{"id":"8eee511f-e1bc-4a02-8805-1770bbdc4d2e","type":"items"}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"item_key":"test-key"},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/ad9cc3b7-da9b-452d-8eab-a1e0a0a4e3d8/items + response: + body: '{"data":{"id":"8eee511f-e1bc-4a02-8805-1770bbdc4d2e","type":"items"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/ad9cc3b7-da9b-452d-8eab-a1e0a0a4e3d8 + response: + body: '{"data":{"id":"ad9cc3b7-da9b-452d-8eab-a1e0a0a4e3d8","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..a262f922c45 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:08.448Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..3a2469dc11d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/invalid-uuid + response: + body: '{"errors":[{"status":"400","id":"ee853859-fef5-4771-98bd-1af309286bc0","title":"invalid + path parameter","detail":"invalid datastoreId format in path","source":{"parameter":"datastoreId"}}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.freeze new file mode 100644 index 00000000000..b46a8c75f26 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:08.615Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.yaml new file mode 100644 index 00000000000..8f517b1ba23 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Delete_datastore_returns_OK_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"8185f4a4-6cf6-4fde-a705-e248effe50fc","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/8185f4a4-6cf6-4fde-a705-e248effe50fc + response: + body: '{"data":{"id":"8185f4a4-6cf6-4fde-a705-e248effe50fc","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/8185f4a4-6cf6-4fde-a705-e248effe50fc + response: + body: '' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..17f435beab3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:09.096Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..ab39e007dfd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores/invalid-uuid + response: + body: '{"errors":[{"status":"400","id":"51295683-ce69-48d6-8efb-4d877ff7e1b2","title":"invalid + path parameter","detail":"invalid datastoreId format in path","source":{"parameter":"datastoreId"}}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..ae156efd1c0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:09.218Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..d22f086bf7f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_Not_Found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores/5bf53b3f-b230-4b35-ab1a-b39f2633eb22 + response: + body: '{"errors":[{"status":"404","id":"d4aab06a-e0f9-4aff-9af4-bc99e2938ec3","title":"datastore + not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.freeze new file mode 100644 index 00000000000..34a4f2a77cb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:09.394Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.yaml new file mode 100644 index 00000000000..823077f6edd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Get_datastore_returns_OK_response.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"b06309e7-b4e9-4edb-a494-e5dd27d9525f","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores/b06309e7-b4e9-4edb-a494-e5dd27d9525f + response: + body: '{"data":{"id":"b06309e7-b4e9-4edb-a494-e5dd27d9525f","type":"datastores","attributes":{"created_at":"2025-09-05T22:54:09.545626Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-09-05T22:54:09.545626Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/b06309e7-b4e9-4edb-a494-e5dd27d9525f + response: + body: '{"data":{"id":"b06309e7-b4e9-4edb-a494-e5dd27d9525f","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..b7c9ce7b394 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:09.863Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..146c61fd058 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores/invalid-uuid/items + response: + body: '{"errors":[{"status":"400","id":"d41a11e1-5db7-47bf-a542-b469768194dd","title":"invalid + path parameter","detail":"invalid datastoreId format in path","source":{"parameter":"datastoreId"}}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..0f045f4f811 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:10.018Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..c4ebcad9e1d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_Not_Found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores/3cfdd0b8-c490-4969-8d51-69add64a70ea/items + response: + body: '{"errors":[{"status":"404","id":"1fe0de3f-9e9c-475b-8cb4-6ea831aa167f","title":"datastore + not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.freeze new file mode 100644 index 00000000000..87a934a1bf2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:10.195Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.yaml new file mode 100644 index 00000000000..95cc7ec8656 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastore_items_returns_OK_response.yaml @@ -0,0 +1,76 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"edfe7784-570c-4984-a4ae-883642b561d8","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"conflict_mode":"fail_on_conflict","values":[{"data":"test-value","id":"test-key"}]},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores/edfe7784-570c-4984-a4ae-883642b561d8/items/bulk + response: + body: '{"data":[{"id":"b20fe87b-f383-4afc-91ee-8fbc178942a2","type":"items"}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 2 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores/edfe7784-570c-4984-a4ae-883642b561d8/items + response: + body: '{"data":[{"id":"b20fe87b-f383-4afc-91ee-8fbc178942a2","type":"items","attributes":{"created_at":"2025-09-05T22:54:10.544424Z","modified_at":"2025-09-05T22:54:10.544424Z","org_id":321813,"primary_column_name":"id","signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"voTcDho3mVIVzY8m98GyVfIib84TgbZoHSWzVQ09TFU=\\\",\\\"timestamp\\\":1757112850,\\\"proof\\\":\\\"MGUCMDX1ijfjUxZK9hVzaMIxU+DociQUkZpkz7FD7tAiykeviU/66p2j1sDf4fYGK3agCwIxALarzvBhasIVGC46VgJuoC0MIkb5WyVWZKh50ist9OfVCQbbe4ZTKKvrW3pVQN34rg==\\\"}\",\"version\":1}","store_id":"edfe7784-570c-4984-a4ae-883642b561d8","value":{"data":"test-value","id":"test-key"}}}],"meta":{"page":{"totalCount":1,"totalFilteredCount":1,"hasMore":false},"schema":{"primary_key":"id","fields":[{"name":"id","type":"STRING"},{"name":"data","type":"JSON"}]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/edfe7784-570c-4984-a4ae-883642b561d8 + response: + body: '{"data":{"id":"edfe7784-570c-4984-a4ae-883642b561d8","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.freeze new file mode 100644 index 00000000000..34ec023d7a2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:10.870Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.yaml new file mode 100644 index 00000000000..016be515586 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_List_datastores_returns_OK_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":[{"id":"0ff20856-6af3-4b8a-bfa6-26ffd7f61551","type":"datastores","attributes":{"created_at":"2025-08-08T13:45:48.532915Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:45:48.532915Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"1c60feb8-f9ea-4b81-9f7d-b0ae97b10cc7","type":"datastores","attributes":{"created_at":"2025-08-11T21:33:38.587401Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-11T21:33:38.587401Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"1d38b58d-d7ac-4a47-be37-6457cea49630","type":"datastores","attributes":{"created_at":"2025-08-08T17:42:31.923013Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:42:31.923013Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"1d6f1853-eb64-43a3-a85b-b187853393c7","type":"datastores","attributes":{"created_at":"2025-08-08T13:41:27.399846Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:41:27.399846Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"236e7736-44d9-40d0-985f-1ab73f25ad09","type":"datastores","attributes":{"created_at":"2025-08-08T18:02:29.490155Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T18:02:29.490155Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"2b0704ce-1efd-4485-976b-f272ea39a9b9","type":"datastores","attributes":{"created_at":"2025-08-08T14:02:11.360529Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T14:02:11.360529Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"2bccd24d-715d-473f-8771-eff9370d14b9","type":"datastores","attributes":{"created_at":"2025-08-11T22:19:07.258146Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-11T22:19:07.258146Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"31af63e6-8363-45a4-ad6b-d92ec256b005","type":"datastores","attributes":{"created_at":"2025-08-08T03:27:41.246238Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:27:41.246238Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"3d4f33dd-41af-4b4e-94e0-a142cd47f83d","type":"datastores","attributes":{"created_at":"2025-08-08T17:58:55.363703Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:58:55.363703Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"44f23b41-3925-4620-b5ad-641c0cac57b9","type":"datastores","attributes":{"created_at":"2025-08-08T17:30:39.520162Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:30:39.520162Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"457cae9c-32ad-4598-9ac0-489c7d4fc20b","type":"datastores","attributes":{"created_at":"2025-08-08T03:07:54.05107Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:07:54.05107Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"55a92f3e-6804-4f45-9ecf-7c09cef155ed","type":"datastores","attributes":{"created_at":"2025-08-08T13:33:42.534986Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:33:42.534987Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"5b3664f0-faaa-4f1b-b067-f521aa156516","type":"datastores","attributes":{"created_at":"2025-08-08T13:35:02.776449Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:35:02.776449Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"7059cb1d-20f6-44e6-a5ee-8eeb19b799e2","type":"datastores","attributes":{"created_at":"2025-08-08T17:24:03.907384Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:24:03.907384Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"7ef9ca96-be6d-435c-b452-9e562beedb4a","type":"datastores","attributes":{"created_at":"2025-08-08T17:27:38.411129Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:27:38.411129Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"8204dff8-7335-4e33-a28b-8f8a0dd47ad0","type":"datastores","attributes":{"created_at":"2025-08-08T14:08:19.382083Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T14:08:19.382083Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"84e4ca89-9266-4fb3-a552-e6da080abc3f","type":"datastores","attributes":{"created_at":"2025-08-08T18:11:58.405584Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T18:11:58.405584Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"858032d2-1c2f-4ac1-a434-de5773fc14c2","type":"datastores","attributes":{"created_at":"2025-08-08T02:55:43.831724Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T02:55:43.831724Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"89c95311-d63a-4535-be9d-92a3912ec074","type":"datastores","attributes":{"created_at":"2025-08-11T21:24:28.298273Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-11T21:24:28.298273Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"8b0fb519-c55f-45d5-b532-1645bed41a92","type":"datastores","attributes":{"created_at":"2025-08-08T13:54:02.27972Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:54:02.27972Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"99366571-d1de-4a6f-9213-5c77a5468de9","type":"datastores","attributes":{"created_at":"2025-08-08T13:50:10.748216Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:50:10.748217Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"9d9d7162-cfd2-40f1-b413-d2df89a5eba9","type":"datastores","attributes":{"created_at":"2025-08-08T03:28:50.178882Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:28:50.178882Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"a751bca4-54eb-4739-a4a3-4779650f9fad","type":"datastores","attributes":{"created_at":"2025-08-08T03:45:28.881437Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:45:28.881437Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"a78fe3e0-4325-459f-aca4-69c084ab818d","type":"datastores","attributes":{"created_at":"2025-08-08T13:22:37.043971Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:22:37.043972Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"aec831f3-cbc3-411f-8ef0-23fdb834d549","type":"datastores","attributes":{"created_at":"2025-08-08T17:36:12.428171Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:36:12.428171Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"b55b6d33-da75-4432-85fc-e0f0a28b4826","type":"datastores","attributes":{"created_at":"2025-08-08T13:38:13.641577Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:38:13.641578Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"bd5e4649-674b-444f-850c-74625b0be9ab","type":"datastores","attributes":{"created_at":"2025-08-08T18:03:00.425892Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T18:03:00.425892Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"be6825fd-82d5-4d9d-8db5-cc674404b710","type":"datastores","attributes":{"created_at":"2025-08-08T03:01:57.110842Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:01:57.110843Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"c412c4b3-7d3d-4ac3-ace6-99abfc0a8567","type":"datastores","attributes":{"created_at":"2025-08-08T02:57:09.998039Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T02:57:09.998039Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"c698d221-5dc9-44d3-ae61-a6a422d204ab","type":"datastores","attributes":{"created_at":"2025-08-08T03:18:11.876246Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:18:11.876246Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"cd915e84-87b1-495d-a868-9c24578696e3","type":"datastores","attributes":{"created_at":"2025-08-08T13:36:53.994588Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:36:53.994588Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"cfadef50-963b-45fa-8334-f33094ca6d76","type":"datastores","attributes":{"created_at":"2025-08-08T14:29:33.425183Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T14:29:33.425183Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"d018730c-26cb-47af-ba93-3604d8a8ad74","type":"datastores","attributes":{"created_at":"2025-08-08T17:35:23.034496Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:35:23.034496Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"d14f84a9-9a26-4b0d-bd6d-f7baf8c9a9ae","type":"datastores","attributes":{"created_at":"2025-08-08T17:30:07.452804Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:30:07.452804Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"d3dedf8d-6620-4dec-bb8b-b0fa53b19135","type":"datastores","attributes":{"created_at":"2025-08-08T13:45:16.371907Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:45:16.371907Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"d8cdfbae-8ec9-4c50-8459-5d55a7b5a945","type":"datastores","attributes":{"created_at":"2025-08-08T17:27:01.039091Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T17:27:01.039091Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"de765300-fca1-4ab2-a441-a6633cd7f976","type":"datastores","attributes":{"created_at":"2025-08-08T14:11:34.405607Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T14:11:34.405607Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"e174ff20-eff7-40b9-a472-b8ce2a8492d8","type":"datastores","attributes":{"created_at":"2025-08-11T20:40:08.137413Z","creator_user_id":2320499,"creator_user_uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","description":"","modified_at":"2025-08-11T20:40:08.137413Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"ea68e1d7-6e4d-40d2-a67f-f5c3c54aab2b","type":"datastores","attributes":{"created_at":"2025-08-08T03:03:21.673996Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:03:21.673996Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"ee56b789-56b6-481c-851b-d0c14a7228d4","type":"datastores","attributes":{"created_at":"2025-08-08T13:44:50.073893Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T13:44:50.073894Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}},{"id":"f5a8ac6e-0cfb-44ad-b71d-28fd40a210a6","type":"datastores","attributes":{"created_at":"2025-08-08T03:36:29.121686Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-08-08T03:36:29.121686Z","name":"Test + Datastore","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..184d2c8e929 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:11.057Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..47477bd3ea5 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"item_changes":{},"item_key":""},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/actions-datastores/invalid-uuid/items + response: + body: '{"errors":[{"status":"400","id":"f88d0b88-0d55-482b-9a90-3556ef7d6b4a","title":"invalid + path parameter","detail":"invalid datastoreId format in path","source":{"parameter":"datastoreId"}}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..d3523bfc49d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:11.195Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..18807396095 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"item_changes":{},"item_key":"itemKey"},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/actions-datastores/3cfdd0b8-c490-4969-8d51-69add64a70ea/items + response: + body: '{"errors":[{"status":"404","id":"d0d6adeb-c5cf-4dce-98d9-532cbc386b09","title":"datastore + not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.freeze new file mode 100644 index 00000000000..27714e5ed37 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:11.331Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.yaml new file mode 100644 index 00000000000..0d2064fa7a4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_item_returns_OK_response.yaml @@ -0,0 +1,79 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"6d5556c8-04d7-45dc-9a08-cd671c4e519a","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"conflict_mode":"fail_on_conflict","values":[{"data":"test-value","id":"test-key"}]},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores/6d5556c8-04d7-45dc-9a08-cd671c4e519a/items/bulk + response: + body: '{"data":[{"id":"94c791a3-9cc2-44be-857e-95c11eb1eefd","type":"items"}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"item_changes":{},"item_key":"test-key"},"type":"items"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: PATCH + url: https://api.datadoghq.com/api/v2/actions-datastores/6d5556c8-04d7-45dc-9a08-cd671c4e519a/items + response: + body: '{"data":{"id":"94c791a3-9cc2-44be-857e-95c11eb1eefd","type":"items","attributes":{"created_at":"2025-09-05T22:54:11.652289Z","modified_at":"2025-09-05T22:54:11.793763Z","org_id":321813,"primary_column_name":"id","signature":"{\"signature\":\"{\\\"version\\\":2,\\\"algorithm\\\":\\\"ecdsa-p384\\\",\\\"pubkey\\\":\\\"voTcDho3mVIVzY8m98GyVfIib84TgbZoHSWzVQ09TFU=\\\",\\\"timestamp\\\":1757112851,\\\"proof\\\":\\\"MGQCMGTEegXzPFeiOMj3tizwKvIXhJ2jLwzZW240N+HDLsvK2QIs1PD+6n/b15rdnABaigIwKYLG3PRtBKd8hV7eF4r9X5vM9fJvCyMPPi05K86m3lm22oxWEsDvLdgx0PxrojuT\\\"}\",\"version\":1}","store_id":"6d5556c8-04d7-45dc-9a08-cd671c4e519a","value":{"data":"test-value","id":"test-key"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/6d5556c8-04d7-45dc-9a08-cd671c4e519a + response: + body: '{"data":{"id":"6d5556c8-04d7-45dc-9a08-cd671c4e519a","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..46b1d9ed356 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:11.950Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..881b33e807a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{},"id":"invalid-uuid","type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/actions-datastores/invalid-uuid + response: + body: '{"errors":[{"status":"400","id":"22fc6f64-67c9-44ad-b6e0-094dd77c7690","title":"invalid + path parameter","detail":"invalid datastoreId format in path","source":{"parameter":"datastoreId"}}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..cd4a108daff --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:12.100Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..af770f6446c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"name":"updated name"},"id":"c1eb5bb8-726a-4e59-9a61-ccbb26f95329","type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/actions-datastores/c1eb5bb8-726a-4e59-9a61-ccbb26f95329 + response: + body: '{"errors":[{"status":"404","id":"9738106a-d613-4be1-ad98-88760c9e0e9f","title":"datastore + not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.freeze new file mode 100644 index 00000000000..b667a5007bb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-05T22:54:12.245Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.yaml new file mode 100644 index 00000000000..281f92e0cce --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Actions_Datastores/Scenario_Update_datastore_returns_OK_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"description":"","name":"Test Datastore","org_access":"contributor","primary_column_name":"id","primary_key_generation_strategy":"none"},"type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/actions-datastores + response: + body: '{"data":{"id":"785f6031-19e8-4dda-8ccc-f4e700ae5c99","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"name":"updated name"},"id":"785f6031-19e8-4dda-8ccc-f4e700ae5c99","type":"datastores"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/actions-datastores/785f6031-19e8-4dda-8ccc-f4e700ae5c99 + response: + body: '{"data":{"id":"785f6031-19e8-4dda-8ccc-f4e700ae5c99","type":"datastores","attributes":{"created_at":"2025-09-05T22:54:12.386695Z","creator_user_id":1445416,"creator_user_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"","modified_at":"2025-09-05T22:54:12.575024Z","name":"updated + name","org_id":321813,"primary_column_name":"id","primary_key_generation_strategy":"none"}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/actions-datastores/785f6031-19e8-4dda-8ccc-f4e700ae5c99 + response: + body: '{"data":{"id":"785f6031-19e8-4dda-8ccc-f4e700ae5c99","type":"datastores"}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/features/v2/actions_datastores.feature b/tests/scenarios/features/v2/actions_datastores.feature new file mode 100644 index 00000000000..ed19da3aec2 --- /dev/null +++ b/tests/scenarios/features/v2/actions_datastores.feature @@ -0,0 +1,220 @@ +@endpoint(actions-datastores) @endpoint(actions-datastores-v2) +Feature: Actions Datastores + Leverage the Actions Datastore API to create, modify, and delete items in + datastores owned by your organization. + + Background: + Given an instance of "ActionsDatastores" API + And a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + + @team:DataDog/app-builder-backend + Scenario: Bulk write datastore items returns "Bad Request" response + Given new "BulkWriteDatastoreItems" request + And there is a valid "datastore" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"values": [{"id": "cust_3141", "name": "Johnathan"}, {"badPrimaryKey": "key2", "name": "Johnathan"}]}, "type": "items"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "item key missing or invalid" + + @team:DataDog/app-builder-backend + Scenario: Bulk write datastore items returns "Not Found" response + Given new "BulkWriteDatastoreItems" request + And request contains "datastore_id" parameter with value "70b87c26-886f-497a-bd9d-09f53bc9b40c" + And body with value {"data": {"attributes": {"values": [{"id": "cust_3141", "name": "Johnathan"}, {"id": "cust_3142", "name": "Mary"}]}, "type": "items"}} + When the request is sent + Then the response status is 404 Not Found + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "datastore not found" + + @team:DataDog/app-builder-backend + Scenario: Bulk write datastore items returns "OK" response + Given new "BulkWriteDatastoreItems" request + And there is a valid "datastore" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"values": [{"id": "cust_3141", "name": "Johnathan"}, {"id": "cust_3142", "name": "Mary"}]}, "type": "items"}} + When the request is sent + Then the response status is 200 OK + And the response "data" has length 2 + + @team:DataDog/app-builder-backend + Scenario: Create datastore returns "Bad Request" response + Given new "CreateDatastore" request + And body with value {"data": {"attributes": {"name": "datastore-name", "primary_column_name": "0invalid_key"}, "type": "datastores"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "datastore configuration invalid" + + @team:DataDog/app-builder-backend + Scenario: Create datastore returns "OK" response + Given new "CreateDatastore" request + And body with value {"data": {"attributes": {"name": "datastore-name", "primary_column_name": "primaryKey"}, "type": "datastores"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/app-builder-backend + Scenario: Delete datastore item returns "Bad Request" response + Given new "DeleteDatastoreItem" request + And request contains "datastore_id" parameter with value "invalid-uuid" + And body with value {"data": {"attributes": {"item_key": "primaryKey"}, "type": "items"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "invalid path parameter" + + @team:DataDog/app-builder-backend + Scenario: Delete datastore item returns "Not Found" response + Given new "DeleteDatastoreItem" request + And request contains "datastore_id" parameter with value "70b87c26-886f-497a-bd9d-09f53bc9b40c" + And body with value {"data": {"attributes": {"item_key": "primaryKey"}, "type": "items"}} + When the request is sent + Then the response status is 404 Not Found + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "datastore not found" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Delete datastore item returns "OK" response + Given new "DeleteDatastoreItem" request + And there is a valid "datastore" in the system + And there is a valid "datastore_item" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"item_key": "test-key"}, "type": "items" }} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/app-builder-backend + Scenario: Delete datastore returns "Bad Request" response + Given new "DeleteDatastore" request + And request contains "datastore_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "invalid path parameter" + + @skip-typescript @skip-validation @team:DataDog/app-builder-backend + Scenario: Delete datastore returns "OK" response + Given new "DeleteDatastore" request + And there is a valid "datastore" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + When the request is sent + Then the response status is 200 OK + + @team:DataDog/app-builder-backend + Scenario: Get datastore returns "Bad Request" response + Given new "GetDatastore" request + And request contains "datastore_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "invalid path parameter" + + @team:DataDog/app-builder-backend + Scenario: Get datastore returns "Not Found" response + Given new "GetDatastore" request + And request contains "datastore_id" parameter with value "5bf53b3f-b230-4b35-ab1a-b39f2633eb22" + When the request is sent + Then the response status is 404 Not Found + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "datastore not found" + + @team:DataDog/app-builder-backend + Scenario: Get datastore returns "OK" response + Given new "GetDatastore" request + And there is a valid "datastore" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{datastore.data.id}}" + + @team:DataDog/app-builder-backend + Scenario: List datastore items returns "Bad Request" response + Given new "ListDatastoreItems" request + And request contains "datastore_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "invalid path parameter" + + @team:DataDog/app-builder-backend + Scenario: List datastore items returns "Not Found" response + Given new "ListDatastoreItems" request + And request contains "datastore_id" parameter with value "3cfdd0b8-c490-4969-8d51-69add64a70ea" + When the request is sent + Then the response status is 404 Not Found + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "datastore not found" + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: List datastore items returns "OK" response + Given new "ListDatastoreItems" request + And there is a valid "datastore" in the system + And there is a valid "datastore_item" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + + @team:DataDog/app-builder-backend + Scenario: List datastores returns "OK" response + Given new "ListDatastores" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/app-builder-backend + Scenario: Update datastore item returns "Bad Request" response + Given new "UpdateDatastoreItem" request + And request contains "datastore_id" parameter with value "invalid-uuid" + And body with value {"data": {"attributes": {"item_changes": {}, "item_key": ""}, "type": "items"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/app-builder-backend + Scenario: Update datastore item returns "Not Found" response + Given new "UpdateDatastoreItem" request + And request contains "datastore_id" parameter with value "3cfdd0b8-c490-4969-8d51-69add64a70ea" + And body with value {"data": {"attributes": {"item_changes": {}, "item_key": "itemKey"}, "type": "items"}} + When the request is sent + Then the response status is 404 Not Found + + @skip-typescript @team:DataDog/app-builder-backend + Scenario: Update datastore item returns "OK" response + Given new "UpdateDatastoreItem" request + And there is a valid "datastore" in the system + And there is a valid "datastore_item" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"item_changes": {}, "item_key": "test-key"}, "type": "items"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/app-builder-backend + Scenario: Update datastore returns "Bad Request" response + Given new "UpdateDatastore" request + And request contains "datastore_id" parameter with value "invalid-uuid" + And body with value {"data": {"attributes": {}, "type": "datastores", "id": "invalid-uuid"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "invalid path parameter" + + @team:DataDog/app-builder-backend + Scenario: Update datastore returns "Not Found" response + Given new "UpdateDatastore" request + And request contains "datastore_id" parameter with value "c1eb5bb8-726a-4e59-9a61-ccbb26f95329" + And body with value {"data": {"attributes": {"name": "updated name"}, "type": "datastores", "id": "c1eb5bb8-726a-4e59-9a61-ccbb26f95329"}} + When the request is sent + Then the response status is 404 Not Found + And the response "errors" has length 1 + And the response "errors[0].title" is equal to "datastore not found" + + @team:DataDog/app-builder-backend + Scenario: Update datastore returns "OK" response + Given new "UpdateDatastore" request + And there is a valid "datastore" in the system + And request contains "datastore_id" parameter from "datastore.data.id" + And body with value {"data": {"attributes": {"name": "updated name"}, "type": "datastores", "id": "{{datastore.data.id}}"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "updated name" diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 4e0610f2f8f..a4872ca4d57 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -1,4 +1,32 @@ [ + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"datastores\",\n \"attributes\": {\n \"name\": \"Test Datastore\",\n \"primary_column_name\": \"id\",\n \"primary_key_generation_strategy\": \"none\",\n \"description\": \"\",\n \"org_access\": \"contributor\"\n }\n }\n}" + } + ], + "step": "there is a valid \"datastore\" in the system", + "key": "datastore", + "tag": "Actions Datastores", + "operationId": "CreateDatastore" + }, + { + "parameters": [ + { + "name": "datastore_id", + "source": "datastore.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"items\",\n \"attributes\": {\n \"conflict_mode\": \"fail_on_conflict\",\n \"values\": [\n {\n \"id\": \"test-key\",\n \"data\": \"test-value\"\n }\n ]\n }\n }\n}" + } + ], + "step": "there is a valid \"datastore_item\" in the system", + "key": "datastore_item", + "tag": "Actions Datastores", + "operationId": "BulkWriteDatastoreItems" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index f9424d938fd..9aa936bc995 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1,4 +1,65 @@ { + "ListDatastores": { + "tag": "Actions Datastores", + "undo": { + "type": "safe" + } + }, + "CreateDatastore": { + "tag": "Actions Datastores", + "undo": { + "operationId": "DeleteDatastore", + "parameters": [ + { + "name": "datastore_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteDatastore": { + "tag": "Actions Datastores", + "undo": { + "type": "idempotent" + } + }, + "GetDatastore": { + "tag": "Actions Datastores", + "undo": { + "type": "safe" + } + }, + "UpdateDatastore": { + "tag": "Actions Datastores", + "undo": { + "type": "idempotent" + } + }, + "DeleteDatastoreItem": { + "tag": "Actions Datastores", + "undo": { + "type": "idempotent" + } + }, + "ListDatastoreItems": { + "tag": "Actions Datastores", + "undo": { + "type": "safe" + } + }, + "UpdateDatastoreItem": { + "tag": "Actions Datastores", + "undo": { + "type": "idempotent" + } + }, + "BulkWriteDatastoreItems": { + "tag": "Actions Datastores", + "undo": { + "type": "idempotent" + } + }, "ListAppKeyRegistrations": { "tag": "Action Connection", "undo": {