diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ea8f0cd3e16b..eac2fa3c1792 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -65509,6 +65509,149 @@ components: type: string x-enum-varnames: - SUITES + SyntheticsTestFileAbortMultipartUploadRequest: + description: Request body for aborting a multipart file upload. + properties: + key: + description: The full storage path of the file whose upload should be aborted. + example: "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json" + type: string + uploadId: + description: The upload ID of the multipart upload to abort. + example: "upload-id-abc123" + type: string + required: + - uploadId + - key + type: object + SyntheticsTestFileCompleteMultipartUploadPart: + description: A completed part of a multipart upload. + properties: + ETag: + description: The ETag returned by the storage provider after uploading the part. + example: '"d41d8cd98f00b204e9800998ecf8427e"' + type: string + PartNumber: + description: The 1-indexed part number for the multipart upload. + example: 1 + format: int64 + type: integer + required: + - ETag + - PartNumber + type: object + SyntheticsTestFileCompleteMultipartUploadRequest: + description: Request body for completing a multipart file upload. + properties: + key: + description: The full storage path for the uploaded file. + example: "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json" + type: string + parts: + description: Array of completed parts with their ETags. + items: + $ref: "#/components/schemas/SyntheticsTestFileCompleteMultipartUploadPart" + type: array + uploadId: + description: The upload ID returned when the multipart upload was initiated. + example: "upload-id-abc123" + type: string + required: + - uploadId + - key + - parts + type: object + SyntheticsTestFileDownloadRequest: + description: Request body for getting a presigned download URL for a test file. + properties: + bucketKey: + description: The bucket key referencing the file to download. + example: "api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json" + minLength: 1 + type: string + required: + - bucketKey + type: object + SyntheticsTestFileDownloadResponse: + description: Response containing a presigned URL for downloading a test file. + properties: + url: + description: A presigned URL to download the file. The URL expires after a short period. + example: "https://storage.example.com/presigned-download-url" + type: string + type: object + SyntheticsTestFileMultipartPresignedUrlsParams: + description: Presigned URL parameters returned for a multipart upload. + properties: + key: + description: The full storage path for the file being uploaded. + example: "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json" + type: string + upload_id: + description: The upload ID assigned by the storage provider for this multipart upload. + example: "upload-id-abc123" + type: string + urls: + additionalProperties: + type: string + description: A map of part numbers to presigned upload URLs. + example: + "1": "https://storage.example.com/presigned-upload-url-part-1" + "2": "https://storage.example.com/presigned-upload-url-part-2" + type: object + type: object + SyntheticsTestFileMultipartPresignedUrlsPart: + description: A part descriptor for initiating a multipart upload. + properties: + md5: + description: Base64-encoded MD5 digest of the part content. + example: "1B2M2Y8AsgTpgAmY7PhCfg==" + maxLength: 24 + minLength: 22 + type: string + partNumber: + description: The 1-indexed part number for the multipart upload. + example: 1 + format: int64 + type: integer + required: + - md5 + - partNumber + type: object + SyntheticsTestFileMultipartPresignedUrlsRequest: + description: Request body for getting presigned URLs for a multipart file upload. + properties: + bucketKeyPrefix: + $ref: "#/components/schemas/SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix" + parts: + description: Array of part descriptors for the multipart upload. + items: + $ref: "#/components/schemas/SyntheticsTestFileMultipartPresignedUrlsPart" + type: array + required: + - bucketKeyPrefix + - parts + type: object + SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix: + description: The bucket key prefix indicating the type of file upload. + enum: + - api-upload-file + - browser-upload-file-step + example: "api-upload-file" + type: string + x-enum-varnames: + - API_UPLOAD_FILE + - BROWSER_UPLOAD_FILE_STEP + SyntheticsTestFileMultipartPresignedUrlsResponse: + description: Response containing presigned URLs for multipart file upload and the bucket key. + properties: + bucketKey: + description: The bucket key that references the uploaded file after completion. + example: "api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json" + type: string + multipart_presigned_urls_params: + $ref: "#/components/schemas/SyntheticsTestFileMultipartPresignedUrlsParams" + type: object SyntheticsTestOptions: description: Object describing the extra options for a Synthetic test. properties: @@ -107394,6 +107537,237 @@ paths: permissions: - synthetics_write - synthetics_create_edit_trigger + /api/v2/synthetics/tests/{public_id}/files/download: + post: + description: |- + Get a presigned URL to download a file attached to a Synthetic test. + The returned URL is temporary and expires after a short period. + operationId: GetTestFileDownloadUrl + parameters: + - description: The public ID of the Synthetic test. + in: path + name: public_id + required: true + schema: + example: abc-def-123 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsTestFileDownloadRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsTestFileDownloadResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - synthetics_read + summary: Get a presigned URL for downloading a test file + tags: + - Synthetics + x-permission: + operator: OR + permissions: + - synthetics_read + /api/v2/synthetics/tests/{public_id}/files/multipart-presigned-urls: + post: + description: |- + Get presigned URLs for uploading a file to a Synthetic test using multipart upload. + Returns the presigned URLs for each part along with the bucket key that references the file. + operationId: GetTestFileMultipartPresignedUrls + parameters: + - description: The public ID of the Synthetic test. + in: path + name: public_id + required: true + schema: + example: abc-def-123 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsTestFileMultipartPresignedUrlsRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsTestFileMultipartPresignedUrlsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - synthetics_write + summary: Get presigned URLs for uploading a test file + tags: + - Synthetics + x-permission: + operator: OR + permissions: + - synthetics_write + - synthetics_create_edit_trigger + /api/v2/synthetics/tests/{public_id}/files/multipart-upload-abort: + post: + description: |- + Abort an in-progress multipart file upload for a Synthetic test. This cancels the upload + and releases any storage used by already-uploaded parts. + operationId: AbortTestFileMultipartUpload + parameters: + - description: The public ID of the Synthetic test. + in: path + name: public_id + required: true + schema: + example: abc-def-123 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsTestFileAbortMultipartUploadRequest" + required: true + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - synthetics_write + summary: Abort a multipart upload of a test file + tags: + - Synthetics + x-permission: + operator: OR + permissions: + - synthetics_write + - synthetics_create_edit_trigger + /api/v2/synthetics/tests/{public_id}/files/multipart-upload-complete: + post: + description: |- + Complete a multipart file upload for a Synthetic test. Call this endpoint after all parts + have been uploaded using the presigned URLs obtained from the multipart presigned URLs endpoint. + operationId: CompleteTestFileMultipartUpload + parameters: + - description: The public ID of the Synthetic test. + in: path + name: public_id + required: true + schema: + example: abc-def-123 + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SyntheticsTestFileCompleteMultipartUploadRequest" + required: true + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: API error response. + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - synthetics_write + summary: Complete a multipart upload of a test file + tags: + - Synthetics + x-permission: + operator: OR + permissions: + - synthetics_write + - synthetics_create_edit_trigger /api/v2/synthetics/tests/{public_id}/parent-suites: get: description: Get the list of parent suites and their status for a given Synthetic test. diff --git a/examples/v2/synthetics/AbortTestFileMultipartUpload.rb b/examples/v2/synthetics/AbortTestFileMultipartUpload.rb new file mode 100644 index 000000000000..a117b6fed7d8 --- /dev/null +++ b/examples/v2/synthetics/AbortTestFileMultipartUpload.rb @@ -0,0 +1,10 @@ +# Abort a multipart upload of a test file returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SyntheticsAPI.new + +body = DatadogAPIClient::V2::SyntheticsTestFileAbortMultipartUploadRequest.new({ + key: "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", + upload_id: "upload-id-abc123", +}) +api_instance.abort_test_file_multipart_upload("abc-def-123", body) diff --git a/examples/v2/synthetics/CompleteTestFileMultipartUpload.rb b/examples/v2/synthetics/CompleteTestFileMultipartUpload.rb new file mode 100644 index 000000000000..61dbcbb5dfa0 --- /dev/null +++ b/examples/v2/synthetics/CompleteTestFileMultipartUpload.rb @@ -0,0 +1,16 @@ +# Complete a multipart upload of a test file returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SyntheticsAPI.new + +body = DatadogAPIClient::V2::SyntheticsTestFileCompleteMultipartUploadRequest.new({ + key: "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", + parts: [ + DatadogAPIClient::V2::SyntheticsTestFileCompleteMultipartUploadPart.new({ + e_tag: '"d41d8cd98f00b204e9800998ecf8427e"', + part_number: 1, + }), + ], + upload_id: "upload-id-abc123", +}) +api_instance.complete_test_file_multipart_upload("abc-def-123", body) diff --git a/examples/v2/synthetics/GetTestFileDownloadUrl.rb b/examples/v2/synthetics/GetTestFileDownloadUrl.rb new file mode 100644 index 000000000000..0112459caad5 --- /dev/null +++ b/examples/v2/synthetics/GetTestFileDownloadUrl.rb @@ -0,0 +1,9 @@ +# Get a presigned URL for downloading a test file returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SyntheticsAPI.new + +body = DatadogAPIClient::V2::SyntheticsTestFileDownloadRequest.new({ + bucket_key: "api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", +}) +p api_instance.get_test_file_download_url("abc-def-123", body) diff --git a/examples/v2/synthetics/GetTestFileMultipartPresignedUrls.rb b/examples/v2/synthetics/GetTestFileMultipartPresignedUrls.rb new file mode 100644 index 000000000000..2b39b2a67587 --- /dev/null +++ b/examples/v2/synthetics/GetTestFileMultipartPresignedUrls.rb @@ -0,0 +1,15 @@ +# Get presigned URLs for uploading a test file returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SyntheticsAPI.new + +body = DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsRequest.new({ + bucket_key_prefix: DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix::API_UPLOAD_FILE, + parts: [ + DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsPart.new({ + md5: "1B2M2Y8AsgTpgAmY7PhCfg==", + part_number: 1, + }), + ], +}) +p api_instance.get_test_file_multipart_presigned_urls("abc-def-123", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 96676513db7b..df090cea2c0a 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3975,6 +3975,22 @@ "public_id" => "String", "body" => "SyntheticsNetworkTestEditRequest", }, + "v2.GetTestFileDownloadUrl" => { + "public_id" => "String", + "body" => "SyntheticsTestFileDownloadRequest", + }, + "v2.GetTestFileMultipartPresignedUrls" => { + "public_id" => "String", + "body" => "SyntheticsTestFileMultipartPresignedUrlsRequest", + }, + "v2.AbortTestFileMultipartUpload" => { + "public_id" => "String", + "body" => "SyntheticsTestFileAbortMultipartUploadRequest", + }, + "v2.CompleteTestFileMultipartUpload" => { + "public_id" => "String", + "body" => "SyntheticsTestFileCompleteMultipartUploadRequest", + }, "v2.GetTestParentSuites" => { "public_id" => "String", }, diff --git a/features/v2/synthetics.feature b/features/v2/synthetics.feature index 8ed9b98adf40..2cdf9231fbc6 100644 --- a/features/v2/synthetics.feature +++ b/features/v2/synthetics.feature @@ -17,6 +17,22 @@ Feature: Synthetics And a valid "appKeyAuth" key in the system And an instance of "Synthetics" API + @generated @skip @team:DataDog/synthetics-managing + Scenario: Abort a multipart upload of a test file returns "API error response." response + Given new "AbortTestFileMultipartUpload" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"key": "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", "uploadId": "upload-id-abc123"} + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Abort a multipart upload of a test file returns "No Content" response + Given new "AbortTestFileMultipartUpload" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"key": "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", "uploadId": "upload-id-abc123"} + When the request is sent + Then the response status is 204 No Content + @generated @skip @team:DataDog/synthetics-managing Scenario: Bulk delete suites returns "API error response." response Given new "DeleteSyntheticsSuites" request @@ -45,6 +61,22 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing + Scenario: Complete a multipart upload of a test file returns "API error response." response + Given new "CompleteTestFileMultipartUpload" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"key": "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", "parts": [{"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"", "PartNumber": 1}], "uploadId": "upload-id-abc123"} + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Complete a multipart upload of a test file returns "No Content" response + Given new "CompleteTestFileMultipartUpload" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"key": "org-123/api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json", "parts": [{"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"", "PartNumber": 1}], "uploadId": "upload-id-abc123"} + When the request is sent + Then the response status is 204 No Content + @generated @skip @team:DataDog/synthetics-managing Scenario: Create a Network Path test returns "API error response." response Given new "CreateSyntheticsNetworkTest" request @@ -133,6 +165,22 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing + Scenario: Get a presigned URL for downloading a test file returns "API error response." response + Given new "GetTestFileDownloadUrl" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"bucketKey": "api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json"} + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Get a presigned URL for downloading a test file returns "OK" response + Given new "GetTestFileDownloadUrl" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"bucketKey": "api-upload-file/abc-def-123/2024-01-01T00:00:00_uuid.json"} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing Scenario: Get a specific version of a test returns "API error response." response Given new "GetSyntheticsTestVersion" request @@ -198,6 +246,22 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/synthetics-managing + Scenario: Get presigned URLs for uploading a test file returns "API error response." response + Given new "GetTestFileMultipartPresignedUrls" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"bucketKeyPrefix": "api-upload-file", "parts": [{"md5": "1B2M2Y8AsgTpgAmY7PhCfg==", "partNumber": 1}]} + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/synthetics-managing + Scenario: Get presigned URLs for uploading a test file returns "OK" response + Given new "GetTestFileMultipartPresignedUrls" request + And request contains "public_id" parameter from "REPLACE.ME" + And body with value {"bucketKeyPrefix": "api-upload-file", "parts": [{"md5": "1B2M2Y8AsgTpgAmY7PhCfg==", "partNumber": 1}]} + When the request is sent + Then the response status is 200 OK + @team:DataDog/synthetics-managing Scenario: Get the on-demand concurrency cap returns "OK" response Given new "GetOnDemandConcurrencyCap" request diff --git a/features/v2/undo.json b/features/v2/undo.json index dcdc0219f9ca..29b9dc1ab270 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5913,6 +5913,30 @@ "type": "idempotent" } }, + "GetTestFileDownloadUrl": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, + "GetTestFileMultipartPresignedUrls": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, + "AbortTestFileMultipartUpload": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, + "CompleteTestFileMultipartUpload": { + "tag": "Synthetics", + "undo": { + "type": "safe" + } + }, "GetTestParentSuites": { "tag": "Synthetics", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6afa8980a892..1ad2605d59ac 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5265,6 +5265,16 @@ def overrides "v2.synthetics_suite_test_alerting_criticality" => "SyntheticsSuiteTestAlertingCriticality", "v2.synthetics_suite_type" => "SyntheticsSuiteType", "v2.synthetics_suite_types" => "SyntheticsSuiteTypes", + "v2.synthetics_test_file_abort_multipart_upload_request" => "SyntheticsTestFileAbortMultipartUploadRequest", + "v2.synthetics_test_file_complete_multipart_upload_part" => "SyntheticsTestFileCompleteMultipartUploadPart", + "v2.synthetics_test_file_complete_multipart_upload_request" => "SyntheticsTestFileCompleteMultipartUploadRequest", + "v2.synthetics_test_file_download_request" => "SyntheticsTestFileDownloadRequest", + "v2.synthetics_test_file_download_response" => "SyntheticsTestFileDownloadResponse", + "v2.synthetics_test_file_multipart_presigned_urls_params" => "SyntheticsTestFileMultipartPresignedUrlsParams", + "v2.synthetics_test_file_multipart_presigned_urls_part" => "SyntheticsTestFileMultipartPresignedUrlsPart", + "v2.synthetics_test_file_multipart_presigned_urls_request" => "SyntheticsTestFileMultipartPresignedUrlsRequest", + "v2.synthetics_test_file_multipart_presigned_urls_request_bucket_key_prefix" => "SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix", + "v2.synthetics_test_file_multipart_presigned_urls_response" => "SyntheticsTestFileMultipartPresignedUrlsResponse", "v2.synthetics_test_options" => "SyntheticsTestOptions", "v2.synthetics_test_options_monitor_options" => "SyntheticsTestOptionsMonitorOptions", "v2.synthetics_test_options_monitor_options_notification_preset_name" => "SyntheticsTestOptionsMonitorOptionsNotificationPresetName", diff --git a/lib/datadog_api_client/v2/api/synthetics_api.rb b/lib/datadog_api_client/v2/api/synthetics_api.rb index bd3b98b6790f..cd5046e1ae2e 100644 --- a/lib/datadog_api_client/v2/api/synthetics_api.rb +++ b/lib/datadog_api_client/v2/api/synthetics_api.rb @@ -23,6 +23,152 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Abort a multipart upload of a test file. + # + # @see #abort_test_file_multipart_upload_with_http_info + def abort_test_file_multipart_upload(public_id, body, opts = {}) + abort_test_file_multipart_upload_with_http_info(public_id, body, opts) + nil + end + + # Abort a multipart upload of a test file. + # + # Abort an in-progress multipart file upload for a Synthetic test. This cancels the upload + # and releases any storage used by already-uploaded parts. + # + # @param public_id [String] The public ID of the Synthetic test. + # @param body [SyntheticsTestFileAbortMultipartUploadRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def abort_test_file_multipart_upload_with_http_info(public_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.abort_test_file_multipart_upload ...' + end + # verify the required parameter 'public_id' is set + if @api_client.config.client_side_validation && public_id.nil? + fail ArgumentError, "Missing the required parameter 'public_id' when calling SyntheticsAPI.abort_test_file_multipart_upload" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SyntheticsAPI.abort_test_file_multipart_upload" + end + # resource path + local_var_path = '/api/v2/synthetics/tests/{public_id}/files/multipart-upload-abort'.sub('{public_id}', CGI.escape(public_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :abort_test_file_multipart_upload, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SyntheticsAPI#abort_test_file_multipart_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Complete a multipart upload of a test file. + # + # @see #complete_test_file_multipart_upload_with_http_info + def complete_test_file_multipart_upload(public_id, body, opts = {}) + complete_test_file_multipart_upload_with_http_info(public_id, body, opts) + nil + end + + # Complete a multipart upload of a test file. + # + # Complete a multipart file upload for a Synthetic test. Call this endpoint after all parts + # have been uploaded using the presigned URLs obtained from the multipart presigned URLs endpoint. + # + # @param public_id [String] The public ID of the Synthetic test. + # @param body [SyntheticsTestFileCompleteMultipartUploadRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def complete_test_file_multipart_upload_with_http_info(public_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.complete_test_file_multipart_upload ...' + end + # verify the required parameter 'public_id' is set + if @api_client.config.client_side_validation && public_id.nil? + fail ArgumentError, "Missing the required parameter 'public_id' when calling SyntheticsAPI.complete_test_file_multipart_upload" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SyntheticsAPI.complete_test_file_multipart_upload" + end + # resource path + local_var_path = '/api/v2/synthetics/tests/{public_id}/files/multipart-upload-complete'.sub('{public_id}', CGI.escape(public_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :complete_test_file_multipart_upload, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SyntheticsAPI#complete_test_file_multipart_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a Network Path test. # # @see #create_synthetics_network_test_with_http_info @@ -800,6 +946,152 @@ def get_synthetics_test_version_with_http_info(public_id, version_number, opts = return data, status_code, headers end + # Get a presigned URL for downloading a test file. + # + # @see #get_test_file_download_url_with_http_info + def get_test_file_download_url(public_id, body, opts = {}) + data, _status_code, _headers = get_test_file_download_url_with_http_info(public_id, body, opts) + data + end + + # Get a presigned URL for downloading a test file. + # + # Get a presigned URL to download a file attached to a Synthetic test. + # The returned URL is temporary and expires after a short period. + # + # @param public_id [String] The public ID of the Synthetic test. + # @param body [SyntheticsTestFileDownloadRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(SyntheticsTestFileDownloadResponse, Integer, Hash)>] SyntheticsTestFileDownloadResponse data, response status code and response headers + def get_test_file_download_url_with_http_info(public_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.get_test_file_download_url ...' + end + # verify the required parameter 'public_id' is set + if @api_client.config.client_side_validation && public_id.nil? + fail ArgumentError, "Missing the required parameter 'public_id' when calling SyntheticsAPI.get_test_file_download_url" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SyntheticsAPI.get_test_file_download_url" + end + # resource path + local_var_path = '/api/v2/synthetics/tests/{public_id}/files/download'.sub('{public_id}', CGI.escape(public_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'SyntheticsTestFileDownloadResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_test_file_download_url, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SyntheticsAPI#get_test_file_download_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get presigned URLs for uploading a test file. + # + # @see #get_test_file_multipart_presigned_urls_with_http_info + def get_test_file_multipart_presigned_urls(public_id, body, opts = {}) + data, _status_code, _headers = get_test_file_multipart_presigned_urls_with_http_info(public_id, body, opts) + data + end + + # Get presigned URLs for uploading a test file. + # + # Get presigned URLs for uploading a file to a Synthetic test using multipart upload. + # Returns the presigned URLs for each part along with the bucket key that references the file. + # + # @param public_id [String] The public ID of the Synthetic test. + # @param body [SyntheticsTestFileMultipartPresignedUrlsRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(SyntheticsTestFileMultipartPresignedUrlsResponse, Integer, Hash)>] SyntheticsTestFileMultipartPresignedUrlsResponse data, response status code and response headers + def get_test_file_multipart_presigned_urls_with_http_info(public_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SyntheticsAPI.get_test_file_multipart_presigned_urls ...' + end + # verify the required parameter 'public_id' is set + if @api_client.config.client_side_validation && public_id.nil? + fail ArgumentError, "Missing the required parameter 'public_id' when calling SyntheticsAPI.get_test_file_multipart_presigned_urls" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SyntheticsAPI.get_test_file_multipart_presigned_urls" + end + # resource path + local_var_path = '/api/v2/synthetics/tests/{public_id}/files/multipart-presigned-urls'.sub('{public_id}', CGI.escape(public_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'SyntheticsTestFileMultipartPresignedUrlsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_test_file_multipart_presigned_urls, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SyntheticsAPI#get_test_file_multipart_presigned_urls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get parent suites for a test. # # @see #get_test_parent_suites_with_http_info diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_abort_multipart_upload_request.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_abort_multipart_upload_request.rb new file mode 100644 index 000000000000..42f909c4b78a --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_abort_multipart_upload_request.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for aborting a multipart file upload. + class SyntheticsTestFileAbortMultipartUploadRequest + include BaseGenericModel + + # The full storage path of the file whose upload should be aborted. + attr_reader :key + + # The upload ID of the multipart upload to abort. + attr_reader :upload_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'key' => :'key', + :'upload_id' => :'uploadId' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'key' => :'String', + :'upload_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileAbortMultipartUploadRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'upload_id') + self.upload_id = attributes[:'upload_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @key.nil? + return false if @upload_id.nil? + true + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param upload_id [Object] Object to be assigned + # @!visibility private + def upload_id=(upload_id) + if upload_id.nil? + fail ArgumentError, 'invalid value for "upload_id", upload_id cannot be nil.' + end + @upload_id = upload_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + upload_id == o.upload_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [key, upload_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_complete_multipart_upload_part.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_complete_multipart_upload_part.rb new file mode 100644 index 000000000000..697ffb7f1916 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_complete_multipart_upload_part.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A completed part of a multipart upload. + class SyntheticsTestFileCompleteMultipartUploadPart + include BaseGenericModel + + # The ETag returned by the storage provider after uploading the part. + attr_reader :e_tag + + # The 1-indexed part number for the multipart upload. + attr_reader :part_number + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'e_tag' => :'ETag', + :'part_number' => :'PartNumber' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'e_tag' => :'String', + :'part_number' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileCompleteMultipartUploadPart` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'e_tag') + self.e_tag = attributes[:'e_tag'] + end + + if attributes.key?(:'part_number') + self.part_number = attributes[:'part_number'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @e_tag.nil? + return false if @part_number.nil? + true + end + + # Custom attribute writer method with validation + # @param e_tag [Object] Object to be assigned + # @!visibility private + def e_tag=(e_tag) + if e_tag.nil? + fail ArgumentError, 'invalid value for "e_tag", e_tag cannot be nil.' + end + @e_tag = e_tag + end + + # Custom attribute writer method with validation + # @param part_number [Object] Object to be assigned + # @!visibility private + def part_number=(part_number) + if part_number.nil? + fail ArgumentError, 'invalid value for "part_number", part_number cannot be nil.' + end + @part_number = part_number + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + e_tag == o.e_tag && + part_number == o.part_number && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [e_tag, part_number, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_complete_multipart_upload_request.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_complete_multipart_upload_request.rb new file mode 100644 index 000000000000..c84b937fb8ae --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_complete_multipart_upload_request.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for completing a multipart file upload. + class SyntheticsTestFileCompleteMultipartUploadRequest + include BaseGenericModel + + # The full storage path for the uploaded file. + attr_reader :key + + # Array of completed parts with their ETags. + attr_reader :parts + + # The upload ID returned when the multipart upload was initiated. + attr_reader :upload_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'key' => :'key', + :'parts' => :'parts', + :'upload_id' => :'uploadId' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'key' => :'String', + :'parts' => :'Array', + :'upload_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileCompleteMultipartUploadRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'parts') + if (value = attributes[:'parts']).is_a?(Array) + self.parts = value + end + end + + if attributes.key?(:'upload_id') + self.upload_id = attributes[:'upload_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @key.nil? + return false if @parts.nil? + return false if @upload_id.nil? + true + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param parts [Object] Object to be assigned + # @!visibility private + def parts=(parts) + if parts.nil? + fail ArgumentError, 'invalid value for "parts", parts cannot be nil.' + end + @parts = parts + end + + # Custom attribute writer method with validation + # @param upload_id [Object] Object to be assigned + # @!visibility private + def upload_id=(upload_id) + if upload_id.nil? + fail ArgumentError, 'invalid value for "upload_id", upload_id cannot be nil.' + end + @upload_id = upload_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + parts == o.parts && + upload_id == o.upload_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [key, parts, upload_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_download_request.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_download_request.rb new file mode 100644 index 000000000000..262a3015f1c5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_download_request.rb @@ -0,0 +1,127 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for getting a presigned download URL for a test file. + class SyntheticsTestFileDownloadRequest + include BaseGenericModel + + # The bucket key referencing the file to download. + attr_reader :bucket_key + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bucket_key' => :'bucketKey' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bucket_key' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileDownloadRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'bucket_key') + self.bucket_key = attributes[:'bucket_key'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @bucket_key.nil? + return false if @bucket_key.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param bucket_key [Object] Object to be assigned + # @!visibility private + def bucket_key=(bucket_key) + if bucket_key.nil? + fail ArgumentError, 'invalid value for "bucket_key", bucket_key cannot be nil.' + end + if bucket_key.to_s.length < 1 + fail ArgumentError, 'invalid value for "bucket_key", the character length must be great than or equal to 1.' + end + @bucket_key = bucket_key + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bucket_key == o.bucket_key && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bucket_key, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_download_response.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_download_response.rb new file mode 100644 index 000000000000..8bfc4e428d73 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_download_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a presigned URL for downloading a test file. + class SyntheticsTestFileDownloadResponse + include BaseGenericModel + + # A presigned URL to download the file. The URL expires after a short period. + attr_accessor :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileDownloadResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_params.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_params.rb new file mode 100644 index 000000000000..3d22d69c5841 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_params.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Presigned URL parameters returned for a multipart upload. + class SyntheticsTestFileMultipartPresignedUrlsParams + include BaseGenericModel + + # The full storage path for the file being uploaded. + attr_accessor :key + + # The upload ID assigned by the storage provider for this multipart upload. + attr_accessor :upload_id + + # A map of part numbers to presigned upload URLs. + attr_accessor :urls + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'key' => :'key', + :'upload_id' => :'upload_id', + :'urls' => :'urls' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'key' => :'String', + :'upload_id' => :'String', + :'urls' => :'Hash' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsParams` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'upload_id') + self.upload_id = attributes[:'upload_id'] + end + + if attributes.key?(:'urls') + self.urls = attributes[:'urls'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + upload_id == o.upload_id && + urls == o.urls && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [key, upload_id, urls, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_part.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_part.rb new file mode 100644 index 000000000000..15b7cc134be0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_part.rb @@ -0,0 +1,152 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A part descriptor for initiating a multipart upload. + class SyntheticsTestFileMultipartPresignedUrlsPart + include BaseGenericModel + + # Base64-encoded MD5 digest of the part content. + attr_reader :md5 + + # The 1-indexed part number for the multipart upload. + attr_reader :part_number + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'md5' => :'md5', + :'part_number' => :'partNumber' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'md5' => :'String', + :'part_number' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsPart` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'md5') + self.md5 = attributes[:'md5'] + end + + if attributes.key?(:'part_number') + self.part_number = attributes[:'part_number'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @md5.nil? + return false if @md5.to_s.length > 24 + return false if @md5.to_s.length < 22 + return false if @part_number.nil? + true + end + + # Custom attribute writer method with validation + # @param md5 [Object] Object to be assigned + # @!visibility private + def md5=(md5) + if md5.nil? + fail ArgumentError, 'invalid value for "md5", md5 cannot be nil.' + end + if md5.to_s.length > 24 + fail ArgumentError, 'invalid value for "md5", the character length must be smaller than or equal to 24.' + end + if md5.to_s.length < 22 + fail ArgumentError, 'invalid value for "md5", the character length must be great than or equal to 22.' + end + @md5 = md5 + end + + # Custom attribute writer method with validation + # @param part_number [Object] Object to be assigned + # @!visibility private + def part_number=(part_number) + if part_number.nil? + fail ArgumentError, 'invalid value for "part_number", part_number cannot be nil.' + end + @part_number = part_number + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + md5 == o.md5 && + part_number == o.part_number && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [md5, part_number, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_request.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_request.rb new file mode 100644 index 000000000000..a7009a25f638 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_request.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for getting presigned URLs for a multipart file upload. + class SyntheticsTestFileMultipartPresignedUrlsRequest + include BaseGenericModel + + # The bucket key prefix indicating the type of file upload. + attr_reader :bucket_key_prefix + + # Array of part descriptors for the multipart upload. + attr_reader :parts + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bucket_key_prefix' => :'bucketKeyPrefix', + :'parts' => :'parts' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bucket_key_prefix' => :'SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix', + :'parts' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'bucket_key_prefix') + self.bucket_key_prefix = attributes[:'bucket_key_prefix'] + end + + if attributes.key?(:'parts') + if (value = attributes[:'parts']).is_a?(Array) + self.parts = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @bucket_key_prefix.nil? + return false if @parts.nil? + true + end + + # Custom attribute writer method with validation + # @param bucket_key_prefix [Object] Object to be assigned + # @!visibility private + def bucket_key_prefix=(bucket_key_prefix) + if bucket_key_prefix.nil? + fail ArgumentError, 'invalid value for "bucket_key_prefix", bucket_key_prefix cannot be nil.' + end + @bucket_key_prefix = bucket_key_prefix + end + + # Custom attribute writer method with validation + # @param parts [Object] Object to be assigned + # @!visibility private + def parts=(parts) + if parts.nil? + fail ArgumentError, 'invalid value for "parts", parts cannot be nil.' + end + @parts = parts + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bucket_key_prefix == o.bucket_key_prefix && + parts == o.parts && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bucket_key_prefix, parts, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_request_bucket_key_prefix.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_request_bucket_key_prefix.rb new file mode 100644 index 000000000000..58931b29de10 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_request_bucket_key_prefix.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The bucket key prefix indicating the type of file upload. + class SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix + include BaseEnumModel + + API_UPLOAD_FILE = "api-upload-file".freeze + BROWSER_UPLOAD_FILE_STEP = "browser-upload-file-step".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_response.rb b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_response.rb new file mode 100644 index 000000000000..02dd64afcc83 --- /dev/null +++ b/lib/datadog_api_client/v2/models/synthetics_test_file_multipart_presigned_urls_response.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing presigned URLs for multipart file upload and the bucket key. + class SyntheticsTestFileMultipartPresignedUrlsResponse + include BaseGenericModel + + # The bucket key that references the uploaded file after completion. + attr_accessor :bucket_key + + # Presigned URL parameters returned for a multipart upload. + attr_accessor :multipart_presigned_urls_params + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'bucket_key' => :'bucketKey', + :'multipart_presigned_urls_params' => :'multipart_presigned_urls_params' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'bucket_key' => :'String', + :'multipart_presigned_urls_params' => :'SyntheticsTestFileMultipartPresignedUrlsParams' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'bucket_key') + self.bucket_key = attributes[:'bucket_key'] + end + + if attributes.key?(:'multipart_presigned_urls_params') + self.multipart_presigned_urls_params = attributes[:'multipart_presigned_urls_params'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bucket_key == o.bucket_key && + multipart_presigned_urls_params == o.multipart_presigned_urls_params && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [bucket_key, multipart_presigned_urls_params, additional_properties].hash + end + end +end