diff --git a/.apigentools-info b/.apigentools-info index 4a19497b5e5..3736e1744e4 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev2", - "regenerated": "2021-03-01 15:46:41.422776", - "spec_repo_commit": "46cbd6f" + "regenerated": "2021-03-02 15:01:17.396762", + "spec_repo_commit": "12c0486" }, "v2": { "apigentools_version": "1.4.1.dev2", - "regenerated": "2021-03-01 15:46:48.570789", - "spec_repo_commit": "46cbd6f" + "regenerated": "2021-03-02 15:01:25.866939", + "spec_repo_commit": "12c0486" } } } \ No newline at end of file diff --git a/api/v1/datadog/.openapi-generator/FILES b/api/v1/datadog/.openapi-generator/FILES index 2548c2dcf06..66b7b4bef90 100644 --- a/api/v1/datadog/.openapi-generator/FILES +++ b/api/v1/datadog/.openapi-generator/FILES @@ -327,11 +327,14 @@ docs/SlackIntegrationApi.md docs/SlackIntegrationChannel.md docs/SlackIntegrationChannelDisplay.md docs/SnapshotsApi.md +docs/SyntheticsAPITest.md +docs/SyntheticsAPITestConfig.md docs/SyntheticsAPITestResultData.md docs/SyntheticsAPITestResultFull.md docs/SyntheticsAPITestResultFullCheck.md docs/SyntheticsAPITestResultShort.md docs/SyntheticsAPITestResultShortResult.md +docs/SyntheticsAPITestType.md docs/SyntheticsApi.md docs/SyntheticsAssertion.md docs/SyntheticsAssertionJSONPathOperator.md @@ -343,11 +346,14 @@ docs/SyntheticsAssertionType.md docs/SyntheticsBasicAuth.md docs/SyntheticsBrowserError.md docs/SyntheticsBrowserErrorType.md +docs/SyntheticsBrowserTest.md +docs/SyntheticsBrowserTestConfig.md docs/SyntheticsBrowserTestResultData.md docs/SyntheticsBrowserTestResultFull.md docs/SyntheticsBrowserTestResultFullCheck.md docs/SyntheticsBrowserTestResultShort.md docs/SyntheticsBrowserTestResultShortResult.md +docs/SyntheticsBrowserTestType.md docs/SyntheticsBrowserVariable.md docs/SyntheticsBrowserVariableType.md docs/SyntheticsCITest.md @@ -820,11 +826,14 @@ model_slo_type.go model_slo_type_numeric.go model_slo_widget_definition.go model_slo_widget_definition_type.go +model_synthetics_api_test_.go +model_synthetics_api_test_config.go model_synthetics_api_test_result_data.go model_synthetics_api_test_result_full.go model_synthetics_api_test_result_full_check.go model_synthetics_api_test_result_short.go model_synthetics_api_test_result_short_result.go +model_synthetics_api_test_type.go model_synthetics_assertion.go model_synthetics_assertion_json_path_operator.go model_synthetics_assertion_json_path_target.go @@ -835,11 +844,14 @@ model_synthetics_assertion_type.go model_synthetics_basic_auth.go model_synthetics_browser_error.go model_synthetics_browser_error_type.go +model_synthetics_browser_test_.go +model_synthetics_browser_test_config.go model_synthetics_browser_test_result_data.go model_synthetics_browser_test_result_full.go model_synthetics_browser_test_result_full_check.go model_synthetics_browser_test_result_short.go model_synthetics_browser_test_result_short_result.go +model_synthetics_browser_test_type.go model_synthetics_browser_variable.go model_synthetics_browser_variable_type.go model_synthetics_check_type.go diff --git a/api/v1/datadog/README.md b/api/v1/datadog/README.md index f1d1a36bf06..680d6d83abc 100644 --- a/api/v1/datadog/README.md +++ b/api/v1/datadog/README.md @@ -194,6 +194,8 @@ Class | Method | HTTP request | Description *SnapshotsApi* | [**GetGraphSnapshot**](docs/SnapshotsApi.md#getgraphsnapshot) | **Get** /api/v1/graph/snapshot | Take graph snapshots *SyntheticsApi* | [**CreateGlobalVariable**](docs/SyntheticsApi.md#createglobalvariable) | **Post** /api/v1/synthetics/variables | Create a global variable *SyntheticsApi* | [**CreatePrivateLocation**](docs/SyntheticsApi.md#createprivatelocation) | **Post** /api/v1/synthetics/private-locations | Create a private location +*SyntheticsApi* | [**CreateSyntheticsAPITest**](docs/SyntheticsApi.md#createsyntheticsapitest) | **Post** /api/v1/synthetics/tests/api | Create an API test +*SyntheticsApi* | [**CreateSyntheticsBrowserTest**](docs/SyntheticsApi.md#createsyntheticsbrowsertest) | **Post** /api/v1/synthetics/tests/browser | Create a browser test *SyntheticsApi* | [**CreateTest**](docs/SyntheticsApi.md#createtest) | **Post** /api/v1/synthetics/tests | Create a test *SyntheticsApi* | [**DeleteGlobalVariable**](docs/SyntheticsApi.md#deleteglobalvariable) | **Delete** /api/v1/synthetics/variables/{variable_id} | Delete a global variable *SyntheticsApi* | [**DeletePrivateLocation**](docs/SyntheticsApi.md#deleteprivatelocation) | **Delete** /api/v1/synthetics/private-locations/{location_id} | Delete a private location @@ -210,6 +212,8 @@ Class | Method | HTTP request | Description *SyntheticsApi* | [**ListLocations**](docs/SyntheticsApi.md#listlocations) | **Get** /api/v1/synthetics/locations | Get all locations (public and private) *SyntheticsApi* | [**ListTests**](docs/SyntheticsApi.md#listtests) | **Get** /api/v1/synthetics/tests | Get the list of all tests *SyntheticsApi* | [**TriggerCITests**](docs/SyntheticsApi.md#triggercitests) | **Post** /api/v1/synthetics/tests/trigger/ci | Trigger some Synthetics tests for CI +*SyntheticsApi* | [**UpdateAPITest**](docs/SyntheticsApi.md#updateapitest) | **Put** /api/v1/synthetics/tests/api/{public_id} | Edit an API test +*SyntheticsApi* | [**UpdateBrowserTest**](docs/SyntheticsApi.md#updatebrowsertest) | **Put** /api/v1/synthetics/tests/browser/{public_id} | Edit a browser test *SyntheticsApi* | [**UpdatePrivateLocation**](docs/SyntheticsApi.md#updateprivatelocation) | **Put** /api/v1/synthetics/private-locations/{location_id} | Edit a private location *SyntheticsApi* | [**UpdateTest**](docs/SyntheticsApi.md#updatetest) | **Put** /api/v1/synthetics/tests/{public_id} | Edit a test *SyntheticsApi* | [**UpdateTestPauseStatus**](docs/SyntheticsApi.md#updatetestpausestatus) | **Put** /api/v1/synthetics/tests/{public_id}/status | Pause or start a test @@ -528,11 +532,14 @@ Class | Method | HTTP request | Description - [ServiceSummaryWidgetDefinitionType](docs/ServiceSummaryWidgetDefinitionType.md) - [SlackIntegrationChannel](docs/SlackIntegrationChannel.md) - [SlackIntegrationChannelDisplay](docs/SlackIntegrationChannelDisplay.md) + - [SyntheticsAPITest](docs/SyntheticsAPITest.md) + - [SyntheticsAPITestConfig](docs/SyntheticsAPITestConfig.md) - [SyntheticsAPITestResultData](docs/SyntheticsAPITestResultData.md) - [SyntheticsAPITestResultFull](docs/SyntheticsAPITestResultFull.md) - [SyntheticsAPITestResultFullCheck](docs/SyntheticsAPITestResultFullCheck.md) - [SyntheticsAPITestResultShort](docs/SyntheticsAPITestResultShort.md) - [SyntheticsAPITestResultShortResult](docs/SyntheticsAPITestResultShortResult.md) + - [SyntheticsAPITestType](docs/SyntheticsAPITestType.md) - [SyntheticsAssertion](docs/SyntheticsAssertion.md) - [SyntheticsAssertionJSONPathOperator](docs/SyntheticsAssertionJSONPathOperator.md) - [SyntheticsAssertionJSONPathTarget](docs/SyntheticsAssertionJSONPathTarget.md) @@ -543,11 +550,14 @@ Class | Method | HTTP request | Description - [SyntheticsBasicAuth](docs/SyntheticsBasicAuth.md) - [SyntheticsBrowserError](docs/SyntheticsBrowserError.md) - [SyntheticsBrowserErrorType](docs/SyntheticsBrowserErrorType.md) + - [SyntheticsBrowserTest](docs/SyntheticsBrowserTest.md) + - [SyntheticsBrowserTestConfig](docs/SyntheticsBrowserTestConfig.md) - [SyntheticsBrowserTestResultData](docs/SyntheticsBrowserTestResultData.md) - [SyntheticsBrowserTestResultFull](docs/SyntheticsBrowserTestResultFull.md) - [SyntheticsBrowserTestResultFullCheck](docs/SyntheticsBrowserTestResultFullCheck.md) - [SyntheticsBrowserTestResultShort](docs/SyntheticsBrowserTestResultShort.md) - [SyntheticsBrowserTestResultShortResult](docs/SyntheticsBrowserTestResultShortResult.md) + - [SyntheticsBrowserTestType](docs/SyntheticsBrowserTestType.md) - [SyntheticsBrowserVariable](docs/SyntheticsBrowserVariable.md) - [SyntheticsBrowserVariableType](docs/SyntheticsBrowserVariableType.md) - [SyntheticsCITest](docs/SyntheticsCITest.md) diff --git a/api/v1/datadog/api/openapi.yaml b/api/v1/datadog/api/openapi.yaml index 670970df943..d57c05778cf 100644 --- a/api/v1/datadog/api/openapi.yaml +++ b/api/v1/datadog/api/openapi.yaml @@ -5700,6 +5700,7 @@ paths: x-undo: type: safe post: + deprecated: true description: Create a Synthetic test. operationId: CreateTest requestBody: @@ -5744,6 +5745,146 @@ paths: operationId: TODO parameters: [] type: unsafe + /api/v1/synthetics/tests/api: + post: + description: Create a Synthetic API test. + operationId: CreateSyntheticsAPITest + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsAPITest' + description: Details of the test to create. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsAPITest' + description: OK - Returns the created test details. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: |- + - JSON format is wrong + - Creation failed + "402": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Test quota is reached + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + summary: Create an API test + tags: + - Synthetics + x-codegen-request-body-name: body + /api/v1/synthetics/tests/api/{public_id}: + put: + description: Edit the configuration of a Synthetic API test. + operationId: UpdateAPITest + parameters: + - description: The public ID of the test to get details from. + explode: false + in: path + name: public_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsAPITest' + description: New test details to be saved. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsAPITest' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: |- + - JSON format is wrong + - Updating sub-type is forbidden + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: |- + - Synthetic Monitoring is not activated for the user + - Test is not owned by the user + - Test can't be found + summary: Edit an API test + tags: + - Synthetics + x-codegen-request-body-name: body + x-undo: + type: idempotent + /api/v1/synthetics/tests/browser: + post: + description: Create a Synthetic browser test. + operationId: CreateSyntheticsBrowserTest + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsBrowserTest' + description: Details of the test to create. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsBrowserTest' + description: OK - Returns the created test details. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: |- + - JSON format is wrong + - Creation failed + "402": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Test quota is reached + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + summary: Create a browser test + tags: + - Synthetics + x-codegen-request-body-name: body /api/v1/synthetics/tests/browser/{public_id}: get: description: |- @@ -5785,6 +5926,61 @@ paths: - Synthetics x-undo: type: safe + put: + description: Edit the configuration of a Synthetic browser test. + operationId: UpdateBrowserTest + parameters: + - description: The public ID of the test to get details from. + explode: false + in: path + name: public_id + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsBrowserTest' + description: New test details to be saved. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/SyntheticsBrowserTest' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: |- + - JSON format is wrong + - Updating sub-type is forbidden + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: |- + - Synthetic Monitoring is not activated for the user + - Test is not owned by the user + - Test can't be found + summary: Edit a browser test + tags: + - Synthetics + x-codegen-request-body-name: body + x-undo: + type: idempotent /api/v1/synthetics/tests/browser/{public_id}/results: get: description: Get the last 50 test results summaries for a given Synthetics Browser @@ -6022,6 +6218,7 @@ paths: x-undo: type: safe put: + deprecated: true description: Edit the configuration of a Synthetic test. operationId: UpdateTest parameters: @@ -15497,6 +15694,154 @@ components: items: $ref: '#/components/schemas/SlackIntegrationChannel' type: array + SyntheticsAPITest: + description: Object containing details about a Synthetic API test. + example: + monitor_id: 0 + name: name + options: + min_location_failed: 5 + monitor_options: + renotify_interval: 331 + min_failure_duration: 5 + allow_insecure: true + device_ids: + - null + - null + follow_redirects: true + accept_self_signed: true + retry: + count: 7 + interval: 9.301444243932576 + locations: + - locations + - locations + message: message + type: api + config: + request: + headers: + key: headers + port: 0 + basicAuth: + password: "" + username: "" + query: '{}' + certificate: + cert: + filename: filename + content: content + updatedAt: updatedAt + key: + filename: filename + content: content + updatedAt: updatedAt + host: host + body: body + dnsServer: dnsServer + timeout: 6.027456183070403 + url: url + assertions: [] + configVariables: + - name: VARIABLE_NAME + pattern: pattern + example: example + - name: VARIABLE_NAME + pattern: pattern + example: example + public_id: public_id + tags: + - tags + - tags + properties: + config: + $ref: '#/components/schemas/SyntheticsAPITestConfig' + locations: + description: Array of locations used to run the test. + items: + description: A location from which the test was run. + type: string + type: array + message: + description: Notification message associated with the test. + type: string + monitor_id: + description: The associated monitor ID. + format: int64 + type: integer + name: + description: Name of the test. + type: string + options: + $ref: '#/components/schemas/SyntheticsTestOptions' + public_id: + description: The public ID for the test. + type: string + status: + $ref: '#/components/schemas/SyntheticsTestPauseStatus' + subtype: + $ref: '#/components/schemas/SyntheticsTestDetailsSubType' + tags: + description: Array of tags attached to the test. + items: + description: A tag attached to the test. + type: string + type: array + type: + $ref: '#/components/schemas/SyntheticsAPITestType' + type: object + SyntheticsAPITestConfig: + description: Configuration object for a Synthetic API test. + example: + request: + headers: + key: headers + port: 0 + basicAuth: + password: "" + username: "" + query: '{}' + certificate: + cert: + filename: filename + content: content + updatedAt: updatedAt + key: + filename: filename + content: content + updatedAt: updatedAt + host: host + body: body + dnsServer: dnsServer + timeout: 6.027456183070403 + url: url + assertions: [] + configVariables: + - name: VARIABLE_NAME + pattern: pattern + example: example + - name: VARIABLE_NAME + pattern: pattern + example: example + properties: + assertions: + default: [] + description: Array of assertions used for the test. + example: [] + items: + $ref: '#/components/schemas/SyntheticsAssertion' + type: array + configVariables: + description: Array of variables used for the test. + items: + $ref: '#/components/schemas/SyntheticsConfigVariable' + type: array + request: + $ref: '#/components/schemas/SyntheticsTestRequest' + required: + - assertions + - request + type: object SyntheticsAPITestResultData: description: Object containing results for your Synthetic API test. example: @@ -15732,6 +16077,15 @@ components: status: $ref: '#/components/schemas/SyntheticsTestMonitorStatus' type: object + SyntheticsAPITestType: + default: api + description: Type of the Synthetic test, `api`. + enum: + - api + example: api + type: string + x-enum-varnames: + - API SyntheticsAssertion: description: |- Object describing the assertions type, their associated operator, @@ -15890,6 +16244,170 @@ components: x-enum-varnames: - NETWORK - JS + SyntheticsBrowserTest: + description: Object containing details about a Synthetic browser test. + example: + monitor_id: 0 + name: name + options: + min_location_failed: 5 + monitor_options: + renotify_interval: 331 + min_failure_duration: 5 + allow_insecure: true + device_ids: + - null + - null + follow_redirects: true + accept_self_signed: true + retry: + count: 7 + interval: 9.301444243932576 + locations: + - locations + - locations + message: message + type: browser + config: + request: + headers: + key: headers + port: 0 + basicAuth: + password: "" + username: "" + query: '{}' + certificate: + cert: + filename: filename + content: content + updatedAt: updatedAt + key: + filename: filename + content: content + updatedAt: updatedAt + host: host + body: body + dnsServer: dnsServer + timeout: 6.027456183070403 + url: url + variables: + - name: VARIABLE_NAME + pattern: pattern + id: id + example: example + - name: VARIABLE_NAME + pattern: pattern + id: id + example: example + assertions: [] + steps: + - allowFailure: true + name: name + params: '{}' + timeout: 3 + - allowFailure: true + name: name + params: '{}' + timeout: 3 + public_id: public_id + tags: + - tags + - tags + properties: + config: + $ref: '#/components/schemas/SyntheticsBrowserTestConfig' + locations: + description: Array of locations used to run the test. + items: + description: A location from which the test was run. + type: string + type: array + message: + description: Notification message associated with the test. + type: string + monitor_id: + description: The associated monitor ID. + format: int64 + type: integer + name: + description: Name of the test. + type: string + options: + $ref: '#/components/schemas/SyntheticsTestOptions' + public_id: + description: The public ID of the test. + type: string + status: + $ref: '#/components/schemas/SyntheticsTestPauseStatus' + steps: + description: The steps of the test. + items: + $ref: '#/components/schemas/SyntheticsStep' + type: array + tags: + description: Array of tags attached to the test. + items: + description: A tag attached to the test. + type: string + type: array + type: + $ref: '#/components/schemas/SyntheticsBrowserTestType' + type: object + SyntheticsBrowserTestConfig: + description: Configuration object for a Synthetic browser test. + example: + request: + headers: + key: headers + port: 0 + basicAuth: + password: "" + username: "" + query: '{}' + certificate: + cert: + filename: filename + content: content + updatedAt: updatedAt + key: + filename: filename + content: content + updatedAt: updatedAt + host: host + body: body + dnsServer: dnsServer + timeout: 6.027456183070403 + url: url + variables: + - name: VARIABLE_NAME + pattern: pattern + id: id + example: example + - name: VARIABLE_NAME + pattern: pattern + id: id + example: example + assertions: [] + properties: + assertions: + default: [] + description: Array of assertions used for the test. + example: [] + items: + $ref: '#/components/schemas/SyntheticsAssertion' + type: array + request: + $ref: '#/components/schemas/SyntheticsTestRequest' + variables: + description: Array of variables used for the test steps. + items: + $ref: '#/components/schemas/SyntheticsBrowserVariable' + type: array + required: + - assertions + - request + type: object SyntheticsBrowserTestResultData: description: Object containing results for your Synthetic browser test. example: @@ -16162,6 +16680,15 @@ components: - from_ts - to_ts type: object + SyntheticsBrowserTestType: + default: browser + description: Type of the Synthetic test, `browser`. + enum: + - browser + example: browser + type: string + x-enum-varnames: + - BROWSER SyntheticsBrowserVariable: description: |- Object defining a variable that can be used in your browser test. diff --git a/api/v1/datadog/api_synthetics.go b/api/v1/datadog/api_synthetics.go index 98dffc2240b..bc3cc327ddd 100644 --- a/api/v1/datadog/api_synthetics.go +++ b/api/v1/datadog/api_synthetics.go @@ -349,29 +349,29 @@ func (a *SyntheticsApiService) CreatePrivateLocationExecute(r ApiCreatePrivateLo return localVarReturnValue, localVarHTTPResponse, nil } -type ApiCreateTestRequest struct { +type ApiCreateSyntheticsAPITestRequest struct { ctx _context.Context ApiService *SyntheticsApiService - body *SyntheticsTestDetails + body *SyntheticsAPITest } -func (r ApiCreateTestRequest) Body(body SyntheticsTestDetails) ApiCreateTestRequest { +func (r ApiCreateSyntheticsAPITestRequest) Body(body SyntheticsAPITest) ApiCreateSyntheticsAPITestRequest { r.body = &body return r } -func (r ApiCreateTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) { - return r.ApiService.CreateTestExecute(r) +func (r ApiCreateSyntheticsAPITestRequest) Execute() (SyntheticsAPITest, *_nethttp.Response, error) { + return r.ApiService.CreateSyntheticsAPITestExecute(r) } /* - * CreateTest Create a test - * Create a Synthetic test. + * CreateSyntheticsAPITest Create an API test + * Create a Synthetic API test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiCreateTestRequest + * @return ApiCreateSyntheticsAPITestRequest */ -func (a *SyntheticsApiService) CreateTest(ctx _context.Context) ApiCreateTestRequest { - return ApiCreateTestRequest{ +func (a *SyntheticsApiService) CreateSyntheticsAPITest(ctx _context.Context) ApiCreateSyntheticsAPITestRequest { + return ApiCreateSyntheticsAPITestRequest{ ApiService: a, ctx: ctx, } @@ -379,24 +379,24 @@ func (a *SyntheticsApiService) CreateTest(ctx _context.Context) ApiCreateTestReq /* * Execute executes the request - * @return SyntheticsTestDetails + * @return SyntheticsAPITest */ -func (a *SyntheticsApiService) CreateTestExecute(r ApiCreateTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { +func (a *SyntheticsApiService) CreateSyntheticsAPITestExecute(r ApiCreateSyntheticsAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsTestDetails + localVarReturnValue SyntheticsAPITest ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.CreateTest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.CreateSyntheticsAPITest") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests" + localVarPath := localBasePath + "/api/v1/synthetics/tests/api" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -424,7 +424,7 @@ func (a *SyntheticsApiService) CreateTestExecute(r ApiCreateTestRequest) (Synthe } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "CreateTest" + localVarHeaderParams["DD-OPERATION-ID"] = "CreateSyntheticsAPITest" // body params localVarPostBody = r.body @@ -521,57 +521,64 @@ func (a *SyntheticsApiService) CreateTestExecute(r ApiCreateTestRequest) (Synthe return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDeleteGlobalVariableRequest struct { +type ApiCreateSyntheticsBrowserTestRequest struct { ctx _context.Context ApiService *SyntheticsApiService - variableId string + body *SyntheticsBrowserTest } -func (r ApiDeleteGlobalVariableRequest) Execute() (*_nethttp.Response, error) { - return r.ApiService.DeleteGlobalVariableExecute(r) +func (r ApiCreateSyntheticsBrowserTestRequest) Body(body SyntheticsBrowserTest) ApiCreateSyntheticsBrowserTestRequest { + r.body = &body + return r +} + +func (r ApiCreateSyntheticsBrowserTestRequest) Execute() (SyntheticsBrowserTest, *_nethttp.Response, error) { + return r.ApiService.CreateSyntheticsBrowserTestExecute(r) } /* - * DeleteGlobalVariable Delete a global variable - * Delete a Synthetics global variable. + * CreateSyntheticsBrowserTest Create a browser test + * Create a Synthetic browser test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param variableId The ID of the global variable. - * @return ApiDeleteGlobalVariableRequest + * @return ApiCreateSyntheticsBrowserTestRequest */ -func (a *SyntheticsApiService) DeleteGlobalVariable(ctx _context.Context, variableId string) ApiDeleteGlobalVariableRequest { - return ApiDeleteGlobalVariableRequest{ +func (a *SyntheticsApiService) CreateSyntheticsBrowserTest(ctx _context.Context) ApiCreateSyntheticsBrowserTestRequest { + return ApiCreateSyntheticsBrowserTestRequest{ ApiService: a, ctx: ctx, - variableId: variableId, } } /* * Execute executes the request + * @return SyntheticsBrowserTest */ -func (a *SyntheticsApiService) DeleteGlobalVariableExecute(r ApiDeleteGlobalVariableRequest) (*_nethttp.Response, error) { +func (a *SyntheticsApiService) CreateSyntheticsBrowserTestExecute(r ApiCreateSyntheticsBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + localVarReturnValue SyntheticsBrowserTest ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.DeleteGlobalVariable") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.CreateSyntheticsBrowserTest") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" - localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(parameterToString(r.variableId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -589,8 +596,10 @@ func (a *SyntheticsApiService) DeleteGlobalVariableExecute(r ApiDeleteGlobalVari } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "DeleteGlobalVariable" + localVarHeaderParams["DD-OPERATION-ID"] = "CreateSyntheticsBrowserTest" + // body params + localVarPostBody = r.body if r.ctx != nil { // API Key Authentication if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { @@ -621,18 +630,18 @@ func (a *SyntheticsApiService) DeleteGlobalVariableExecute(r ApiDeleteGlobalVari } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -645,87 +654,103 @@ func (a *SyntheticsApiService) DeleteGlobalVariableExecute(r ApiDeleteGlobalVari err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 403 { + if localVarHTTPResponse.StatusCode == 402 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 403 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDeletePrivateLocationRequest struct { +type ApiCreateTestRequest struct { ctx _context.Context ApiService *SyntheticsApiService - locationId string + body *SyntheticsTestDetails } -func (r ApiDeletePrivateLocationRequest) Execute() (*_nethttp.Response, error) { - return r.ApiService.DeletePrivateLocationExecute(r) +func (r ApiCreateTestRequest) Body(body SyntheticsTestDetails) ApiCreateTestRequest { + r.body = &body + return r +} + +func (r ApiCreateTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) { + return r.ApiService.CreateTestExecute(r) } /* - * DeletePrivateLocation Delete a private location - * Delete a Synthetics private location. + * CreateTest Create a test + * Create a Synthetic test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param locationId The ID of the private location. - * @return ApiDeletePrivateLocationRequest + * @return ApiCreateTestRequest */ -func (a *SyntheticsApiService) DeletePrivateLocation(ctx _context.Context, locationId string) ApiDeletePrivateLocationRequest { - return ApiDeletePrivateLocationRequest{ +func (a *SyntheticsApiService) CreateTest(ctx _context.Context) ApiCreateTestRequest { + return ApiCreateTestRequest{ ApiService: a, ctx: ctx, - locationId: locationId, } } /* * Execute executes the request + * @return SyntheticsTestDetails */ -func (a *SyntheticsApiService) DeletePrivateLocationExecute(r ApiDeletePrivateLocationRequest) (*_nethttp.Response, error) { +func (a *SyntheticsApiService) CreateTestExecute(r ApiCreateTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte + localVarReturnValue SyntheticsTestDetails ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.DeletePrivateLocation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.CreateTest") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" - localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(parameterToString(r.locationId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/tests" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -743,8 +768,10 @@ func (a *SyntheticsApiService) DeletePrivateLocationExecute(r ApiDeletePrivateLo } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "DeletePrivateLocation" + localVarHeaderParams["DD-OPERATION-ID"] = "CreateTest" + // body params + localVarPostBody = r.body if r.ctx != nil { // API Key Authentication if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { @@ -775,18 +802,18 @@ func (a *SyntheticsApiService) DeletePrivateLocationExecute(r ApiDeletePrivateLo } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -794,79 +821,101 @@ func (a *SyntheticsApiService) DeletePrivateLocationExecute(r ApiDeletePrivateLo body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 400 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, newErr + if localVarHTTPResponse.StatusCode == 402 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDeleteTestsRequest struct { +type ApiDeleteGlobalVariableRequest struct { ctx _context.Context ApiService *SyntheticsApiService - body *SyntheticsDeleteTestsPayload -} - -func (r ApiDeleteTestsRequest) Body(body SyntheticsDeleteTestsPayload) ApiDeleteTestsRequest { - r.body = &body - return r + variableId string } -func (r ApiDeleteTestsRequest) Execute() (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { - return r.ApiService.DeleteTestsExecute(r) +func (r ApiDeleteGlobalVariableRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeleteGlobalVariableExecute(r) } /* - * DeleteTests Delete tests - * Delete multiple Synthetic tests by ID. + * DeleteGlobalVariable Delete a global variable + * Delete a Synthetics global variable. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiDeleteTestsRequest + * @param variableId The ID of the global variable. + * @return ApiDeleteGlobalVariableRequest */ -func (a *SyntheticsApiService) DeleteTests(ctx _context.Context) ApiDeleteTestsRequest { - return ApiDeleteTestsRequest{ +func (a *SyntheticsApiService) DeleteGlobalVariable(ctx _context.Context, variableId string) ApiDeleteGlobalVariableRequest { + return ApiDeleteGlobalVariableRequest{ ApiService: a, ctx: ctx, + variableId: variableId, } } /* * Execute executes the request - * @return SyntheticsDeleteTestsResponse */ -func (a *SyntheticsApiService) DeleteTestsExecute(r ApiDeleteTestsRequest) (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { +func (a *SyntheticsApiService) DeleteGlobalVariableExecute(r ApiDeleteGlobalVariableRequest) (*_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodPost + localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsDeleteTestsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.DeleteTests") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.DeleteGlobalVariable") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + return nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/delete" + localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" + localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(parameterToString(r.variableId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if r.body == nil { - return localVarReturnValue, nil, reportError("body is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -884,10 +933,8 @@ func (a *SyntheticsApiService) DeleteTestsExecute(r ApiDeleteTestsRequest) (Synt } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "DeleteTests" + localVarHeaderParams["DD-OPERATION-ID"] = "DeleteGlobalVariable" - // body params - localVarPostBody = r.body if r.ctx != nil { // API Key Authentication if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { @@ -918,18 +965,18 @@ func (a *SyntheticsApiService) DeleteTestsExecute(r ApiDeleteTestsRequest) (Synt } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -942,97 +989,218 @@ func (a *SyntheticsApiService) DeleteTestsExecute(r ApiDeleteTestsRequest) (Synt err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.model = v } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - return localVarReturnValue, localVarHTTPResponse, nil + return localVarHTTPResponse, nil } -type ApiEditGlobalVariableRequest struct { +type ApiDeletePrivateLocationRequest struct { ctx _context.Context ApiService *SyntheticsApiService - variableId string - body *SyntheticsGlobalVariable + locationId string } -func (r ApiEditGlobalVariableRequest) Body(body SyntheticsGlobalVariable) ApiEditGlobalVariableRequest { - r.body = &body - return r +func (r ApiDeletePrivateLocationRequest) Execute() (*_nethttp.Response, error) { + return r.ApiService.DeletePrivateLocationExecute(r) } -func (r ApiEditGlobalVariableRequest) Execute() (SyntheticsGlobalVariable, *_nethttp.Response, error) { - return r.ApiService.EditGlobalVariableExecute(r) +/* + * DeletePrivateLocation Delete a private location + * Delete a Synthetics private location. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param locationId The ID of the private location. + * @return ApiDeletePrivateLocationRequest + */ +func (a *SyntheticsApiService) DeletePrivateLocation(ctx _context.Context, locationId string) ApiDeletePrivateLocationRequest { + return ApiDeletePrivateLocationRequest{ + ApiService: a, + ctx: ctx, + locationId: locationId, + } } /* - * EditGlobalVariable Edit a global variable - * Edit a Synthetics global variable. + * Execute executes the request + */ +func (a *SyntheticsApiService) DeletePrivateLocationExecute(r ApiDeletePrivateLocationRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.DeletePrivateLocation") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" + localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(parameterToString(r.locationId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + + // Set Operation-ID header for telemetry + localVarHeaderParams["DD-OPERATION-ID"] = "DeletePrivateLocation" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteTestsRequest struct { + ctx _context.Context + ApiService *SyntheticsApiService + body *SyntheticsDeleteTestsPayload +} + +func (r ApiDeleteTestsRequest) Body(body SyntheticsDeleteTestsPayload) ApiDeleteTestsRequest { + r.body = &body + return r +} + +func (r ApiDeleteTestsRequest) Execute() (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { + return r.ApiService.DeleteTestsExecute(r) +} + +/* + * DeleteTests Delete tests + * Delete multiple Synthetic tests by ID. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param variableId The ID of the global variable. - * @return ApiEditGlobalVariableRequest + * @return ApiDeleteTestsRequest */ -func (a *SyntheticsApiService) EditGlobalVariable(ctx _context.Context, variableId string) ApiEditGlobalVariableRequest { - return ApiEditGlobalVariableRequest{ +func (a *SyntheticsApiService) DeleteTests(ctx _context.Context) ApiDeleteTestsRequest { + return ApiDeleteTestsRequest{ ApiService: a, ctx: ctx, - variableId: variableId, } } /* * Execute executes the request - * @return SyntheticsGlobalVariable + * @return SyntheticsDeleteTestsResponse */ -func (a *SyntheticsApiService) EditGlobalVariableExecute(r ApiEditGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { +func (a *SyntheticsApiService) DeleteTestsExecute(r ApiDeleteTestsRequest) (SyntheticsDeleteTestsResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodPut + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsGlobalVariable + localVarReturnValue SyntheticsDeleteTestsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.EditGlobalVariable") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.DeleteTests") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" - localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(parameterToString(r.variableId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/tests/delete" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1060,7 +1228,7 @@ func (a *SyntheticsApiService) EditGlobalVariableExecute(r ApiEditGlobalVariable } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "EditGlobalVariable" + localVarHeaderParams["DD-OPERATION-ID"] = "DeleteTests" // body params localVarPostBody = r.body @@ -1131,6 +1299,16 @@ func (a *SyntheticsApiService) EditGlobalVariableExecute(r ApiEditGlobalVariable return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1147,90 +1325,571 @@ func (a *SyntheticsApiService) EditGlobalVariableExecute(r ApiEditGlobalVariable return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetAPITestLatestResultsRequest struct { +type ApiEditGlobalVariableRequest struct { ctx _context.Context ApiService *SyntheticsApiService - publicId string - fromTs *int64 - toTs *int64 - probeDc *[]string + variableId string + body *SyntheticsGlobalVariable } -func (r ApiGetAPITestLatestResultsRequest) FromTs(fromTs int64) ApiGetAPITestLatestResultsRequest { - r.fromTs = &fromTs - return r -} -func (r ApiGetAPITestLatestResultsRequest) ToTs(toTs int64) ApiGetAPITestLatestResultsRequest { - r.toTs = &toTs - return r -} -func (r ApiGetAPITestLatestResultsRequest) ProbeDc(probeDc []string) ApiGetAPITestLatestResultsRequest { - r.probeDc = &probeDc +func (r ApiEditGlobalVariableRequest) Body(body SyntheticsGlobalVariable) ApiEditGlobalVariableRequest { + r.body = &body return r } -func (r ApiGetAPITestLatestResultsRequest) Execute() (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { - return r.ApiService.GetAPITestLatestResultsExecute(r) +func (r ApiEditGlobalVariableRequest) Execute() (SyntheticsGlobalVariable, *_nethttp.Response, error) { + return r.ApiService.EditGlobalVariableExecute(r) } /* - * GetAPITestLatestResults Get the test's latest results summaries (API) - * Get the last 50 test results summaries for a given Synthetics API test. + * EditGlobalVariable Edit a global variable + * Edit a Synthetics global variable. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param publicId The public ID of the test for which to search results for. - * @return ApiGetAPITestLatestResultsRequest + * @param variableId The ID of the global variable. + * @return ApiEditGlobalVariableRequest */ -func (a *SyntheticsApiService) GetAPITestLatestResults(ctx _context.Context, publicId string) ApiGetAPITestLatestResultsRequest { - return ApiGetAPITestLatestResultsRequest{ +func (a *SyntheticsApiService) EditGlobalVariable(ctx _context.Context, variableId string) ApiEditGlobalVariableRequest { + return ApiEditGlobalVariableRequest{ ApiService: a, ctx: ctx, - publicId: publicId, + variableId: variableId, } } /* * Execute executes the request - * @return SyntheticsGetAPITestLatestResultsResponse + * @return SyntheticsGlobalVariable + */ +func (a *SyntheticsApiService) EditGlobalVariableExecute(r ApiEditGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SyntheticsGlobalVariable + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.EditGlobalVariable") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" + localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(parameterToString(r.variableId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + + // Set Operation-ID header for telemetry + localVarHeaderParams["DD-OPERATION-ID"] = "EditGlobalVariable" + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetAPITestLatestResultsRequest struct { + ctx _context.Context + ApiService *SyntheticsApiService + publicId string + fromTs *int64 + toTs *int64 + probeDc *[]string +} + +func (r ApiGetAPITestLatestResultsRequest) FromTs(fromTs int64) ApiGetAPITestLatestResultsRequest { + r.fromTs = &fromTs + return r +} +func (r ApiGetAPITestLatestResultsRequest) ToTs(toTs int64) ApiGetAPITestLatestResultsRequest { + r.toTs = &toTs + return r +} +func (r ApiGetAPITestLatestResultsRequest) ProbeDc(probeDc []string) ApiGetAPITestLatestResultsRequest { + r.probeDc = &probeDc + return r +} + +func (r ApiGetAPITestLatestResultsRequest) Execute() (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { + return r.ApiService.GetAPITestLatestResultsExecute(r) +} + +/* + * GetAPITestLatestResults Get the test's latest results summaries (API) + * Get the last 50 test results summaries for a given Synthetics API test. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param publicId The public ID of the test for which to search results for. + * @return ApiGetAPITestLatestResultsRequest + */ +func (a *SyntheticsApiService) GetAPITestLatestResults(ctx _context.Context, publicId string) ApiGetAPITestLatestResultsRequest { + return ApiGetAPITestLatestResultsRequest{ + ApiService: a, + ctx: ctx, + publicId: publicId, + } +} + +/* + * Execute executes the request + * @return SyntheticsGetAPITestLatestResultsResponse + */ +func (a *SyntheticsApiService) GetAPITestLatestResultsExecute(r ApiGetAPITestLatestResultsRequest) (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SyntheticsGetAPITestLatestResultsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetAPITestLatestResults") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.fromTs != nil { + localVarQueryParams.Add("from_ts", parameterToString(*r.fromTs, "")) + } + if r.toTs != nil { + localVarQueryParams.Add("to_ts", parameterToString(*r.toTs, "")) + } + if r.probeDc != nil { + t := *r.probeDc + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("probe_dc", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("probe_dc", parameterToString(t, "multi")) + } + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + + // Set Operation-ID header for telemetry + localVarHeaderParams["DD-OPERATION-ID"] = "GetAPITestLatestResults" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetAPITestResultRequest struct { + ctx _context.Context + ApiService *SyntheticsApiService + publicId string + resultId string +} + +func (r ApiGetAPITestResultRequest) Execute() (SyntheticsAPITestResultFull, *_nethttp.Response, error) { + return r.ApiService.GetAPITestResultExecute(r) +} + +/* + * GetAPITestResult Get a test result (API) + * Get a specific full result from a given (API) Synthetic test. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param publicId The public ID of the API test to which the target result belongs. + * @param resultId The ID of the result to get. + * @return ApiGetAPITestResultRequest + */ +func (a *SyntheticsApiService) GetAPITestResult(ctx _context.Context, publicId string, resultId string) ApiGetAPITestResultRequest { + return ApiGetAPITestResultRequest{ + ApiService: a, + ctx: ctx, + publicId: publicId, + resultId: resultId, + } +} + +/* + * Execute executes the request + * @return SyntheticsAPITestResultFull + */ +func (a *SyntheticsApiService) GetAPITestResultExecute(r ApiGetAPITestResultRequest) (SyntheticsAPITestResultFull, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue SyntheticsAPITestResultFull + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetAPITestResult") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results/{result_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(parameterToString(r.resultId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + + // Set Operation-ID header for telemetry + localVarHeaderParams["DD-OPERATION-ID"] = "GetAPITestResult" + + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetBrowserTestRequest struct { + ctx _context.Context + ApiService *SyntheticsApiService + publicId string +} + +func (r ApiGetBrowserTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) { + return r.ApiService.GetBrowserTestExecute(r) +} + +/* + * GetBrowserTest Get a test configuration (browser) + * Get the detailed configuration (including steps) associated with +a Synthetic browser test. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param publicId The public ID of the test to get details from. + * @return ApiGetBrowserTestRequest +*/ +func (a *SyntheticsApiService) GetBrowserTest(ctx _context.Context, publicId string) ApiGetBrowserTestRequest { + return ApiGetBrowserTestRequest{ + ApiService: a, + ctx: ctx, + publicId: publicId, + } +} + +/* + * Execute executes the request + * @return SyntheticsTestDetails */ -func (a *SyntheticsApiService) GetAPITestLatestResultsExecute(r ApiGetAPITestLatestResultsRequest) (SyntheticsGetAPITestLatestResultsResponse, *_nethttp.Response, error) { +func (a *SyntheticsApiService) GetBrowserTestExecute(r ApiGetBrowserTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsGetAPITestLatestResultsResponse + localVarReturnValue SyntheticsTestDetails ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetAPITestLatestResults") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetBrowserTest") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results" + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if r.fromTs != nil { - localVarQueryParams.Add("from_ts", parameterToString(*r.fromTs, "")) - } - if r.toTs != nil { - localVarQueryParams.Add("to_ts", parameterToString(*r.toTs, "")) - } - if r.probeDc != nil { - t := *r.probeDc - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("probe_dc", parameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("probe_dc", parameterToString(t, "multi")) - } - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1250,7 +1909,7 @@ func (a *SyntheticsApiService) GetAPITestLatestResultsExecute(r ApiGetAPITestLat } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetAPITestLatestResults" + localVarHeaderParams["DD-OPERATION-ID"] = "GetBrowserTest" if r.ctx != nil { // API Key Authentication @@ -1335,61 +1994,90 @@ func (a *SyntheticsApiService) GetAPITestLatestResultsExecute(r ApiGetAPITestLat return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetAPITestResultRequest struct { +type ApiGetBrowserTestLatestResultsRequest struct { ctx _context.Context ApiService *SyntheticsApiService publicId string - resultId string + fromTs *int64 + toTs *int64 + probeDc *[]string } -func (r ApiGetAPITestResultRequest) Execute() (SyntheticsAPITestResultFull, *_nethttp.Response, error) { - return r.ApiService.GetAPITestResultExecute(r) +func (r ApiGetBrowserTestLatestResultsRequest) FromTs(fromTs int64) ApiGetBrowserTestLatestResultsRequest { + r.fromTs = &fromTs + return r +} +func (r ApiGetBrowserTestLatestResultsRequest) ToTs(toTs int64) ApiGetBrowserTestLatestResultsRequest { + r.toTs = &toTs + return r +} +func (r ApiGetBrowserTestLatestResultsRequest) ProbeDc(probeDc []string) ApiGetBrowserTestLatestResultsRequest { + r.probeDc = &probeDc + return r +} + +func (r ApiGetBrowserTestLatestResultsRequest) Execute() (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { + return r.ApiService.GetBrowserTestLatestResultsExecute(r) } /* - * GetAPITestResult Get a test result (API) - * Get a specific full result from a given (API) Synthetic test. + * GetBrowserTestLatestResults Get the test's latest results summaries (browser) + * Get the last 50 test results summaries for a given Synthetics Browser test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param publicId The public ID of the API test to which the target result belongs. - * @param resultId The ID of the result to get. - * @return ApiGetAPITestResultRequest + * @param publicId The public ID of the browser test for which to search results for. + * @return ApiGetBrowserTestLatestResultsRequest */ -func (a *SyntheticsApiService) GetAPITestResult(ctx _context.Context, publicId string, resultId string) ApiGetAPITestResultRequest { - return ApiGetAPITestResultRequest{ +func (a *SyntheticsApiService) GetBrowserTestLatestResults(ctx _context.Context, publicId string) ApiGetBrowserTestLatestResultsRequest { + return ApiGetBrowserTestLatestResultsRequest{ ApiService: a, ctx: ctx, publicId: publicId, - resultId: resultId, } } /* * Execute executes the request - * @return SyntheticsAPITestResultFull + * @return SyntheticsGetBrowserTestLatestResultsResponse */ -func (a *SyntheticsApiService) GetAPITestResultExecute(r ApiGetAPITestResultRequest) (SyntheticsAPITestResultFull, *_nethttp.Response, error) { +func (a *SyntheticsApiService) GetBrowserTestLatestResultsExecute(r ApiGetBrowserTestLatestResultsRequest) (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsAPITestResultFull + localVarReturnValue SyntheticsGetBrowserTestLatestResultsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetAPITestResult") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetBrowserTestLatestResults") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}/results/{result_id}" + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results" localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(parameterToString(r.resultId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.fromTs != nil { + localVarQueryParams.Add("from_ts", parameterToString(*r.fromTs, "")) + } + if r.toTs != nil { + localVarQueryParams.Add("to_ts", parameterToString(*r.toTs, "")) + } + if r.probeDc != nil { + t := *r.probeDc + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("probe_dc", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("probe_dc", parameterToString(t, "multi")) + } + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1409,7 +2097,7 @@ func (a *SyntheticsApiService) GetAPITestResultExecute(r ApiGetAPITestResultRequ } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetAPITestResult" + localVarHeaderParams["DD-OPERATION-ID"] = "GetBrowserTestLatestResults" if r.ctx != nil { // API Key Authentication @@ -1494,53 +2182,56 @@ func (a *SyntheticsApiService) GetAPITestResultExecute(r ApiGetAPITestResultRequ return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetBrowserTestRequest struct { +type ApiGetBrowserTestResultRequest struct { ctx _context.Context ApiService *SyntheticsApiService publicId string + resultId string } -func (r ApiGetBrowserTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) { - return r.ApiService.GetBrowserTestExecute(r) +func (r ApiGetBrowserTestResultRequest) Execute() (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { + return r.ApiService.GetBrowserTestResultExecute(r) } /* - * GetBrowserTest Get a test configuration (browser) - * Get the detailed configuration (including steps) associated with -a Synthetic browser test. + * GetBrowserTestResult Get a test result (browser) + * Get a specific full result from a given (browser) Synthetic test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param publicId The public ID of the test to get details from. - * @return ApiGetBrowserTestRequest -*/ -func (a *SyntheticsApiService) GetBrowserTest(ctx _context.Context, publicId string) ApiGetBrowserTestRequest { - return ApiGetBrowserTestRequest{ + * @param publicId The public ID of the browser test to which the target result belongs. + * @param resultId The ID of the result to get. + * @return ApiGetBrowserTestResultRequest + */ +func (a *SyntheticsApiService) GetBrowserTestResult(ctx _context.Context, publicId string, resultId string) ApiGetBrowserTestResultRequest { + return ApiGetBrowserTestResultRequest{ ApiService: a, ctx: ctx, publicId: publicId, + resultId: resultId, } } /* * Execute executes the request - * @return SyntheticsTestDetails + * @return SyntheticsBrowserTestResultFull */ -func (a *SyntheticsApiService) GetBrowserTestExecute(r ApiGetBrowserTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { +func (a *SyntheticsApiService) GetBrowserTestResultExecute(r ApiGetBrowserTestResultRequest) (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsTestDetails + localVarReturnValue SyntheticsBrowserTestResultFull ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetBrowserTest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetBrowserTestResult") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}" localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(parameterToString(r.resultId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1565,7 +2256,7 @@ func (a *SyntheticsApiService) GetBrowserTestExecute(r ApiGetBrowserTestRequest) } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetBrowserTest" + localVarHeaderParams["DD-OPERATION-ID"] = "GetBrowserTestResult" if r.ctx != nil { // API Key Authentication @@ -1650,90 +2341,57 @@ func (a *SyntheticsApiService) GetBrowserTestExecute(r ApiGetBrowserTestRequest) return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetBrowserTestLatestResultsRequest struct { +type ApiGetGlobalVariableRequest struct { ctx _context.Context ApiService *SyntheticsApiService - publicId string - fromTs *int64 - toTs *int64 - probeDc *[]string -} - -func (r ApiGetBrowserTestLatestResultsRequest) FromTs(fromTs int64) ApiGetBrowserTestLatestResultsRequest { - r.fromTs = &fromTs - return r -} -func (r ApiGetBrowserTestLatestResultsRequest) ToTs(toTs int64) ApiGetBrowserTestLatestResultsRequest { - r.toTs = &toTs - return r -} -func (r ApiGetBrowserTestLatestResultsRequest) ProbeDc(probeDc []string) ApiGetBrowserTestLatestResultsRequest { - r.probeDc = &probeDc - return r + variableId string } -func (r ApiGetBrowserTestLatestResultsRequest) Execute() (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { - return r.ApiService.GetBrowserTestLatestResultsExecute(r) +func (r ApiGetGlobalVariableRequest) Execute() (SyntheticsGlobalVariable, *_nethttp.Response, error) { + return r.ApiService.GetGlobalVariableExecute(r) } /* - * GetBrowserTestLatestResults Get the test's latest results summaries (browser) - * Get the last 50 test results summaries for a given Synthetics Browser test. + * GetGlobalVariable Get a global variable + * Get the detailed configuration of a global variable. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param publicId The public ID of the browser test for which to search results for. - * @return ApiGetBrowserTestLatestResultsRequest + * @param variableId The ID of the global variable. + * @return ApiGetGlobalVariableRequest */ -func (a *SyntheticsApiService) GetBrowserTestLatestResults(ctx _context.Context, publicId string) ApiGetBrowserTestLatestResultsRequest { - return ApiGetBrowserTestLatestResultsRequest{ +func (a *SyntheticsApiService) GetGlobalVariable(ctx _context.Context, variableId string) ApiGetGlobalVariableRequest { + return ApiGetGlobalVariableRequest{ ApiService: a, ctx: ctx, - publicId: publicId, + variableId: variableId, } } /* * Execute executes the request - * @return SyntheticsGetBrowserTestLatestResultsResponse + * @return SyntheticsGlobalVariable */ -func (a *SyntheticsApiService) GetBrowserTestLatestResultsExecute(r ApiGetBrowserTestLatestResultsRequest) (SyntheticsGetBrowserTestLatestResultsResponse, *_nethttp.Response, error) { +func (a *SyntheticsApiService) GetGlobalVariableExecute(r ApiGetGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsGetBrowserTestLatestResultsResponse + localVarReturnValue SyntheticsGlobalVariable ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetBrowserTestLatestResults") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetGlobalVariable") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" + localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(parameterToString(r.variableId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if r.fromTs != nil { - localVarQueryParams.Add("from_ts", parameterToString(*r.fromTs, "")) - } - if r.toTs != nil { - localVarQueryParams.Add("to_ts", parameterToString(*r.toTs, "")) - } - if r.probeDc != nil { - t := *r.probeDc - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("probe_dc", parameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("probe_dc", parameterToString(t, "multi")) - } - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1753,7 +2411,7 @@ func (a *SyntheticsApiService) GetBrowserTestLatestResultsExecute(r ApiGetBrowse } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetBrowserTestLatestResults" + localVarHeaderParams["DD-OPERATION-ID"] = "GetGlobalVariable" if r.ctx != nil { // API Key Authentication @@ -1838,56 +2496,52 @@ func (a *SyntheticsApiService) GetBrowserTestLatestResultsExecute(r ApiGetBrowse return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetBrowserTestResultRequest struct { +type ApiGetPrivateLocationRequest struct { ctx _context.Context ApiService *SyntheticsApiService - publicId string - resultId string + locationId string } -func (r ApiGetBrowserTestResultRequest) Execute() (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { - return r.ApiService.GetBrowserTestResultExecute(r) +func (r ApiGetPrivateLocationRequest) Execute() (SyntheticsPrivateLocation, *_nethttp.Response, error) { + return r.ApiService.GetPrivateLocationExecute(r) } /* - * GetBrowserTestResult Get a test result (browser) - * Get a specific full result from a given (browser) Synthetic test. + * GetPrivateLocation Get a private location + * Get a Synthetics private location. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param publicId The public ID of the browser test to which the target result belongs. - * @param resultId The ID of the result to get. - * @return ApiGetBrowserTestResultRequest + * @param locationId The ID of the private location. + * @return ApiGetPrivateLocationRequest */ -func (a *SyntheticsApiService) GetBrowserTestResult(ctx _context.Context, publicId string, resultId string) ApiGetBrowserTestResultRequest { - return ApiGetBrowserTestResultRequest{ +func (a *SyntheticsApiService) GetPrivateLocation(ctx _context.Context, locationId string) ApiGetPrivateLocationRequest { + return ApiGetPrivateLocationRequest{ ApiService: a, ctx: ctx, - publicId: publicId, - resultId: resultId, + locationId: locationId, } } /* * Execute executes the request - * @return SyntheticsBrowserTestResultFull + * @return SyntheticsPrivateLocation */ -func (a *SyntheticsApiService) GetBrowserTestResultExecute(r ApiGetBrowserTestResultRequest) (SyntheticsBrowserTestResultFull, *_nethttp.Response, error) { +func (a *SyntheticsApiService) GetPrivateLocationExecute(r ApiGetPrivateLocationRequest) (SyntheticsPrivateLocation, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsBrowserTestResultFull + localVarReturnValue SyntheticsPrivateLocation ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetBrowserTestResult") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetPrivateLocation") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"result_id"+"}", _neturl.PathEscape(parameterToString(r.resultId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" + localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(parameterToString(r.locationId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1912,7 +2566,7 @@ func (a *SyntheticsApiService) GetBrowserTestResultExecute(r ApiGetBrowserTestRe } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetBrowserTestResult" + localVarHeaderParams["DD-OPERATION-ID"] = "GetPrivateLocation" if r.ctx != nil { // API Key Authentication @@ -1957,21 +2611,11 @@ func (a *SyntheticsApiService) GetBrowserTestResultExecute(r ApiGetBrowserTestRe if err != nil { return localVarReturnValue, localVarHTTPResponse, err } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 403 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 404 { var v APIErrorResponse @@ -1997,52 +2641,52 @@ func (a *SyntheticsApiService) GetBrowserTestResultExecute(r ApiGetBrowserTestRe return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetGlobalVariableRequest struct { +type ApiGetTestRequest struct { ctx _context.Context ApiService *SyntheticsApiService - variableId string + publicId string } -func (r ApiGetGlobalVariableRequest) Execute() (SyntheticsGlobalVariable, *_nethttp.Response, error) { - return r.ApiService.GetGlobalVariableExecute(r) +func (r ApiGetTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) { + return r.ApiService.GetTestExecute(r) } /* - * GetGlobalVariable Get a global variable - * Get the detailed configuration of a global variable. + * GetTest Get a test configuration (API) + * Get the detailed configuration associated with a Synthetics test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param variableId The ID of the global variable. - * @return ApiGetGlobalVariableRequest + * @param publicId The public ID of the test to get details from. + * @return ApiGetTestRequest */ -func (a *SyntheticsApiService) GetGlobalVariable(ctx _context.Context, variableId string) ApiGetGlobalVariableRequest { - return ApiGetGlobalVariableRequest{ +func (a *SyntheticsApiService) GetTest(ctx _context.Context, publicId string) ApiGetTestRequest { + return ApiGetTestRequest{ ApiService: a, ctx: ctx, - variableId: variableId, + publicId: publicId, } } /* * Execute executes the request - * @return SyntheticsGlobalVariable + * @return SyntheticsTestDetails */ -func (a *SyntheticsApiService) GetGlobalVariableExecute(r ApiGetGlobalVariableRequest) (SyntheticsGlobalVariable, *_nethttp.Response, error) { +func (a *SyntheticsApiService) GetTestExecute(r ApiGetTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsGlobalVariable + localVarReturnValue SyntheticsTestDetails ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetGlobalVariable") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetTest") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/variables/{variable_id}" - localVarPath = strings.Replace(localVarPath, "{"+"variable_id"+"}", _neturl.PathEscape(parameterToString(r.variableId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2067,7 +2711,7 @@ func (a *SyntheticsApiService) GetGlobalVariableExecute(r ApiGetGlobalVariableRe } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetGlobalVariable" + localVarHeaderParams["DD-OPERATION-ID"] = "GetTest" if r.ctx != nil { // API Key Authentication @@ -2152,52 +2796,49 @@ func (a *SyntheticsApiService) GetGlobalVariableExecute(r ApiGetGlobalVariableRe return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetPrivateLocationRequest struct { +type ApiListLocationsRequest struct { ctx _context.Context ApiService *SyntheticsApiService - locationId string } -func (r ApiGetPrivateLocationRequest) Execute() (SyntheticsPrivateLocation, *_nethttp.Response, error) { - return r.ApiService.GetPrivateLocationExecute(r) +func (r ApiListLocationsRequest) Execute() (SyntheticsLocations, *_nethttp.Response, error) { + return r.ApiService.ListLocationsExecute(r) } /* - * GetPrivateLocation Get a private location - * Get a Synthetics private location. + * ListLocations Get all locations (public and private) + * Get the list of public and private locations available for Synthetic +tests. No arguments required. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param locationId The ID of the private location. - * @return ApiGetPrivateLocationRequest - */ -func (a *SyntheticsApiService) GetPrivateLocation(ctx _context.Context, locationId string) ApiGetPrivateLocationRequest { - return ApiGetPrivateLocationRequest{ + * @return ApiListLocationsRequest +*/ +func (a *SyntheticsApiService) ListLocations(ctx _context.Context) ApiListLocationsRequest { + return ApiListLocationsRequest{ ApiService: a, ctx: ctx, - locationId: locationId, } } /* * Execute executes the request - * @return SyntheticsPrivateLocation + * @return SyntheticsLocations */ -func (a *SyntheticsApiService) GetPrivateLocationExecute(r ApiGetPrivateLocationRequest) (SyntheticsPrivateLocation, *_nethttp.Response, error) { +func (a *SyntheticsApiService) ListLocationsExecute(r ApiListLocationsRequest) (SyntheticsLocations, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsPrivateLocation + localVarReturnValue SyntheticsLocations ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetPrivateLocation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.ListLocations") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/private-locations/{location_id}" - localVarPath = strings.Replace(localVarPath, "{"+"location_id"+"}", _neturl.PathEscape(parameterToString(r.locationId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/locations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2222,7 +2863,7 @@ func (a *SyntheticsApiService) GetPrivateLocationExecute(r ApiGetPrivateLocation } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetPrivateLocation" + localVarHeaderParams["DD-OPERATION-ID"] = "ListLocations" if r.ctx != nil { // API Key Authentication @@ -2273,15 +2914,6 @@ func (a *SyntheticsApiService) GetPrivateLocationExecute(r ApiGetPrivateLocation body: localVarBody, error: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 404 { - var v APIErrorResponse - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2297,52 +2929,48 @@ func (a *SyntheticsApiService) GetPrivateLocationExecute(r ApiGetPrivateLocation return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetTestRequest struct { +type ApiListTestsRequest struct { ctx _context.Context ApiService *SyntheticsApiService - publicId string } -func (r ApiGetTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) { - return r.ApiService.GetTestExecute(r) +func (r ApiListTestsRequest) Execute() (SyntheticsListTestsResponse, *_nethttp.Response, error) { + return r.ApiService.ListTestsExecute(r) } /* - * GetTest Get a test configuration (API) - * Get the detailed configuration associated with a Synthetics test. + * ListTests Get the list of all tests + * Get the list of all Synthetic tests. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param publicId The public ID of the test to get details from. - * @return ApiGetTestRequest + * @return ApiListTestsRequest */ -func (a *SyntheticsApiService) GetTest(ctx _context.Context, publicId string) ApiGetTestRequest { - return ApiGetTestRequest{ +func (a *SyntheticsApiService) ListTests(ctx _context.Context) ApiListTestsRequest { + return ApiListTestsRequest{ ApiService: a, ctx: ctx, - publicId: publicId, } } /* * Execute executes the request - * @return SyntheticsTestDetails + * @return SyntheticsListTestsResponse */ -func (a *SyntheticsApiService) GetTestExecute(r ApiGetTestRequest) (SyntheticsTestDetails, *_nethttp.Response, error) { +func (a *SyntheticsApiService) ListTestsExecute(r ApiListTestsRequest) (SyntheticsListTestsResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsTestDetails + localVarReturnValue SyntheticsListTestsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.GetTest") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.ListTests") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/{public_id}" - localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) + localVarPath := localBasePath + "/api/v1/synthetics/tests" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2367,7 +2995,7 @@ func (a *SyntheticsApiService) GetTestExecute(r ApiGetTestRequest) (SyntheticsTe } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "GetTest" + localVarHeaderParams["DD-OPERATION-ID"] = "ListTests" if r.ctx != nil { // API Key Authentication @@ -2452,24 +3080,29 @@ func (a *SyntheticsApiService) GetTestExecute(r ApiGetTestRequest) (SyntheticsTe return localVarReturnValue, localVarHTTPResponse, nil } -type ApiListLocationsRequest struct { +type ApiTriggerCITestsRequest struct { ctx _context.Context ApiService *SyntheticsApiService + body *SyntheticsCITestBody } -func (r ApiListLocationsRequest) Execute() (SyntheticsLocations, *_nethttp.Response, error) { - return r.ApiService.ListLocationsExecute(r) +func (r ApiTriggerCITestsRequest) Body(body SyntheticsCITestBody) ApiTriggerCITestsRequest { + r.body = &body + return r +} + +func (r ApiTriggerCITestsRequest) Execute() (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { + return r.ApiService.TriggerCITestsExecute(r) } /* - * ListLocations Get all locations (public and private) - * Get the list of public and private locations available for Synthetic -tests. No arguments required. + * TriggerCITests Trigger some Synthetics tests for CI + * Trigger a set of Synthetics tests for continuous integration. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiListLocationsRequest -*/ -func (a *SyntheticsApiService) ListLocations(ctx _context.Context) ApiListLocationsRequest { - return ApiListLocationsRequest{ + * @return ApiTriggerCITestsRequest + */ +func (a *SyntheticsApiService) TriggerCITests(ctx _context.Context) ApiTriggerCITestsRequest { + return ApiTriggerCITestsRequest{ ApiService: a, ctx: ctx, } @@ -2477,31 +3110,34 @@ func (a *SyntheticsApiService) ListLocations(ctx _context.Context) ApiListLocati /* * Execute executes the request - * @return SyntheticsLocations + * @return SyntheticsTriggerCITestsResponse */ -func (a *SyntheticsApiService) ListLocationsExecute(r ApiListLocationsRequest) (SyntheticsLocations, *_nethttp.Response, error) { +func (a *SyntheticsApiService) TriggerCITestsExecute(r ApiTriggerCITestsRequest) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsLocations + localVarReturnValue SyntheticsTriggerCITestsResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.ListLocations") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.TriggerCITests") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/locations" + localVarPath := localBasePath + "/api/v1/synthetics/tests/trigger/ci" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2519,8 +3155,10 @@ func (a *SyntheticsApiService) ListLocationsExecute(r ApiListLocationsRequest) ( } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "ListLocations" + localVarHeaderParams["DD-OPERATION-ID"] = "TriggerCITests" + // body params + localVarPostBody = r.body if r.ctx != nil { // API Key Authentication if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { @@ -2570,6 +3208,15 @@ func (a *SyntheticsApiService) ListLocationsExecute(r ApiListLocationsRequest) ( body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2585,55 +3232,68 @@ func (a *SyntheticsApiService) ListLocationsExecute(r ApiListLocationsRequest) ( return localVarReturnValue, localVarHTTPResponse, nil } -type ApiListTestsRequest struct { +type ApiUpdateAPITestRequest struct { ctx _context.Context ApiService *SyntheticsApiService + publicId string + body *SyntheticsAPITest } -func (r ApiListTestsRequest) Execute() (SyntheticsListTestsResponse, *_nethttp.Response, error) { - return r.ApiService.ListTestsExecute(r) +func (r ApiUpdateAPITestRequest) Body(body SyntheticsAPITest) ApiUpdateAPITestRequest { + r.body = &body + return r +} + +func (r ApiUpdateAPITestRequest) Execute() (SyntheticsAPITest, *_nethttp.Response, error) { + return r.ApiService.UpdateAPITestExecute(r) } /* - * ListTests Get the list of all tests - * Get the list of all Synthetic tests. + * UpdateAPITest Edit an API test + * Edit the configuration of a Synthetic API test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiListTestsRequest + * @param publicId The public ID of the test to get details from. + * @return ApiUpdateAPITestRequest */ -func (a *SyntheticsApiService) ListTests(ctx _context.Context) ApiListTestsRequest { - return ApiListTestsRequest{ +func (a *SyntheticsApiService) UpdateAPITest(ctx _context.Context, publicId string) ApiUpdateAPITestRequest { + return ApiUpdateAPITestRequest{ ApiService: a, ctx: ctx, + publicId: publicId, } } /* * Execute executes the request - * @return SyntheticsListTestsResponse + * @return SyntheticsAPITest */ -func (a *SyntheticsApiService) ListTestsExecute(r ApiListTestsRequest) (SyntheticsListTestsResponse, *_nethttp.Response, error) { +func (a *SyntheticsApiService) UpdateAPITestExecute(r ApiUpdateAPITestRequest) (SyntheticsAPITest, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsListTestsResponse + localVarReturnValue SyntheticsAPITest ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.ListTests") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.UpdateAPITest") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests" + localVarPath := localBasePath + "/api/v1/synthetics/tests/api/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2651,8 +3311,10 @@ func (a *SyntheticsApiService) ListTestsExecute(r ApiListTestsRequest) (Syntheti } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "ListTests" + localVarHeaderParams["DD-OPERATION-ID"] = "UpdateAPITest" + // body params + localVarPostBody = r.body if r.ctx != nil { // API Key Authentication if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { @@ -2702,6 +3364,16 @@ func (a *SyntheticsApiService) ListTestsExecute(r ApiListTestsRequest) (Syntheti body: localVarBody, error: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } if localVarHTTPResponse.StatusCode == 403 { var v APIErrorResponse err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2736,54 +3408,58 @@ func (a *SyntheticsApiService) ListTestsExecute(r ApiListTestsRequest) (Syntheti return localVarReturnValue, localVarHTTPResponse, nil } -type ApiTriggerCITestsRequest struct { +type ApiUpdateBrowserTestRequest struct { ctx _context.Context ApiService *SyntheticsApiService - body *SyntheticsCITestBody + publicId string + body *SyntheticsBrowserTest } -func (r ApiTriggerCITestsRequest) Body(body SyntheticsCITestBody) ApiTriggerCITestsRequest { +func (r ApiUpdateBrowserTestRequest) Body(body SyntheticsBrowserTest) ApiUpdateBrowserTestRequest { r.body = &body return r } -func (r ApiTriggerCITestsRequest) Execute() (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { - return r.ApiService.TriggerCITestsExecute(r) +func (r ApiUpdateBrowserTestRequest) Execute() (SyntheticsBrowserTest, *_nethttp.Response, error) { + return r.ApiService.UpdateBrowserTestExecute(r) } /* - * TriggerCITests Trigger some Synthetics tests for CI - * Trigger a set of Synthetics tests for continuous integration. + * UpdateBrowserTest Edit a browser test + * Edit the configuration of a Synthetic browser test. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @return ApiTriggerCITestsRequest + * @param publicId The public ID of the test to get details from. + * @return ApiUpdateBrowserTestRequest */ -func (a *SyntheticsApiService) TriggerCITests(ctx _context.Context) ApiTriggerCITestsRequest { - return ApiTriggerCITestsRequest{ +func (a *SyntheticsApiService) UpdateBrowserTest(ctx _context.Context, publicId string) ApiUpdateBrowserTestRequest { + return ApiUpdateBrowserTestRequest{ ApiService: a, ctx: ctx, + publicId: publicId, } } /* * Execute executes the request - * @return SyntheticsTriggerCITestsResponse + * @return SyntheticsBrowserTest */ -func (a *SyntheticsApiService) TriggerCITestsExecute(r ApiTriggerCITestsRequest) (SyntheticsTriggerCITestsResponse, *_nethttp.Response, error) { +func (a *SyntheticsApiService) UpdateBrowserTestExecute(r ApiUpdateBrowserTestRequest) (SyntheticsBrowserTest, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodPost + localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue SyntheticsTriggerCITestsResponse + localVarReturnValue SyntheticsBrowserTest ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.TriggerCITests") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SyntheticsApiService.UpdateBrowserTest") if err != nil { return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/v1/synthetics/tests/trigger/ci" + localVarPath := localBasePath + "/api/v1/synthetics/tests/browser/{public_id}" + localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2811,7 +3487,7 @@ func (a *SyntheticsApiService) TriggerCITestsExecute(r ApiTriggerCITestsRequest) } // Set Operation-ID header for telemetry - localVarHeaderParams["DD-OPERATION-ID"] = "TriggerCITests" + localVarHeaderParams["DD-OPERATION-ID"] = "UpdateBrowserTest" // body params localVarPostBody = r.body @@ -2872,6 +3548,26 @@ func (a *SyntheticsApiService) TriggerCITestsExecute(r ApiTriggerCITestsRequest) return localVarReturnValue, localVarHTTPResponse, newErr } newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/api/v1/datadog/docs/SyntheticsAPITest.md b/api/v1/datadog/docs/SyntheticsAPITest.md new file mode 100644 index 00000000000..6bb8d091f98 --- /dev/null +++ b/api/v1/datadog/docs/SyntheticsAPITest.md @@ -0,0 +1,316 @@ +# SyntheticsAPITest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Config** | Pointer to [**SyntheticsAPITestConfig**](SyntheticsAPITestConfig.md) | | [optional] +**Locations** | Pointer to **[]string** | Array of locations used to run the test. | [optional] +**Message** | Pointer to **string** | Notification message associated with the test. | [optional] +**MonitorId** | Pointer to **int64** | The associated monitor ID. | [optional] +**Name** | Pointer to **string** | Name of the test. | [optional] +**Options** | Pointer to [**SyntheticsTestOptions**](SyntheticsTestOptions.md) | | [optional] +**PublicId** | Pointer to **string** | The public ID for the test. | [optional] +**Status** | Pointer to [**SyntheticsTestPauseStatus**](SyntheticsTestPauseStatus.md) | | [optional] +**Subtype** | Pointer to [**SyntheticsTestDetailsSubType**](SyntheticsTestDetailsSubType.md) | | [optional] +**Tags** | Pointer to **[]string** | Array of tags attached to the test. | [optional] +**Type** | Pointer to [**SyntheticsAPITestType**](SyntheticsAPITestType.md) | | [optional] [default to "api"] + +## Methods + +### NewSyntheticsAPITest + +`func NewSyntheticsAPITest() *SyntheticsAPITest` + +NewSyntheticsAPITest instantiates a new SyntheticsAPITest 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 + +### NewSyntheticsAPITestWithDefaults + +`func NewSyntheticsAPITestWithDefaults() *SyntheticsAPITest` + +NewSyntheticsAPITestWithDefaults instantiates a new SyntheticsAPITest 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 + +### GetConfig + +`func (o *SyntheticsAPITest) GetConfig() SyntheticsAPITestConfig` + +GetConfig returns the Config field if non-nil, zero value otherwise. + +### GetConfigOk + +`func (o *SyntheticsAPITest) GetConfigOk() (*SyntheticsAPITestConfig, bool)` + +GetConfigOk returns a tuple with the Config field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfig + +`func (o *SyntheticsAPITest) SetConfig(v SyntheticsAPITestConfig)` + +SetConfig sets Config field to given value. + +### HasConfig + +`func (o *SyntheticsAPITest) HasConfig() bool` + +HasConfig returns a boolean if a field has been set. + +### GetLocations + +`func (o *SyntheticsAPITest) GetLocations() []string` + +GetLocations returns the Locations field if non-nil, zero value otherwise. + +### GetLocationsOk + +`func (o *SyntheticsAPITest) GetLocationsOk() (*[]string, bool)` + +GetLocationsOk returns a tuple with the Locations field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLocations + +`func (o *SyntheticsAPITest) SetLocations(v []string)` + +SetLocations sets Locations field to given value. + +### HasLocations + +`func (o *SyntheticsAPITest) HasLocations() bool` + +HasLocations returns a boolean if a field has been set. + +### GetMessage + +`func (o *SyntheticsAPITest) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *SyntheticsAPITest) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *SyntheticsAPITest) SetMessage(v string)` + +SetMessage sets Message field to given value. + +### HasMessage + +`func (o *SyntheticsAPITest) HasMessage() bool` + +HasMessage returns a boolean if a field has been set. + +### GetMonitorId + +`func (o *SyntheticsAPITest) GetMonitorId() int64` + +GetMonitorId returns the MonitorId field if non-nil, zero value otherwise. + +### GetMonitorIdOk + +`func (o *SyntheticsAPITest) GetMonitorIdOk() (*int64, bool)` + +GetMonitorIdOk returns a tuple with the MonitorId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMonitorId + +`func (o *SyntheticsAPITest) SetMonitorId(v int64)` + +SetMonitorId sets MonitorId field to given value. + +### HasMonitorId + +`func (o *SyntheticsAPITest) HasMonitorId() bool` + +HasMonitorId returns a boolean if a field has been set. + +### GetName + +`func (o *SyntheticsAPITest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SyntheticsAPITest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SyntheticsAPITest) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *SyntheticsAPITest) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetOptions + +`func (o *SyntheticsAPITest) GetOptions() SyntheticsTestOptions` + +GetOptions returns the Options field if non-nil, zero value otherwise. + +### GetOptionsOk + +`func (o *SyntheticsAPITest) GetOptionsOk() (*SyntheticsTestOptions, bool)` + +GetOptionsOk returns a tuple with the Options field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOptions + +`func (o *SyntheticsAPITest) SetOptions(v SyntheticsTestOptions)` + +SetOptions sets Options field to given value. + +### HasOptions + +`func (o *SyntheticsAPITest) HasOptions() bool` + +HasOptions returns a boolean if a field has been set. + +### GetPublicId + +`func (o *SyntheticsAPITest) GetPublicId() string` + +GetPublicId returns the PublicId field if non-nil, zero value otherwise. + +### GetPublicIdOk + +`func (o *SyntheticsAPITest) GetPublicIdOk() (*string, bool)` + +GetPublicIdOk returns a tuple with the PublicId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicId + +`func (o *SyntheticsAPITest) SetPublicId(v string)` + +SetPublicId sets PublicId field to given value. + +### HasPublicId + +`func (o *SyntheticsAPITest) HasPublicId() bool` + +HasPublicId returns a boolean if a field has been set. + +### GetStatus + +`func (o *SyntheticsAPITest) GetStatus() SyntheticsTestPauseStatus` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *SyntheticsAPITest) GetStatusOk() (*SyntheticsTestPauseStatus, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *SyntheticsAPITest) SetStatus(v SyntheticsTestPauseStatus)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *SyntheticsAPITest) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetSubtype + +`func (o *SyntheticsAPITest) GetSubtype() SyntheticsTestDetailsSubType` + +GetSubtype returns the Subtype field if non-nil, zero value otherwise. + +### GetSubtypeOk + +`func (o *SyntheticsAPITest) GetSubtypeOk() (*SyntheticsTestDetailsSubType, bool)` + +GetSubtypeOk returns a tuple with the Subtype field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubtype + +`func (o *SyntheticsAPITest) SetSubtype(v SyntheticsTestDetailsSubType)` + +SetSubtype sets Subtype field to given value. + +### HasSubtype + +`func (o *SyntheticsAPITest) HasSubtype() bool` + +HasSubtype returns a boolean if a field has been set. + +### GetTags + +`func (o *SyntheticsAPITest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *SyntheticsAPITest) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *SyntheticsAPITest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *SyntheticsAPITest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetType + +`func (o *SyntheticsAPITest) GetType() SyntheticsAPITestType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *SyntheticsAPITest) GetTypeOk() (*SyntheticsAPITestType, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *SyntheticsAPITest) SetType(v SyntheticsAPITestType)` + +SetType sets Type field to given value. + +### HasType + +`func (o *SyntheticsAPITest) HasType() bool` + +HasType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/api/v1/datadog/docs/SyntheticsAPITestConfig.md b/api/v1/datadog/docs/SyntheticsAPITestConfig.md new file mode 100644 index 00000000000..3eba9dbfbc6 --- /dev/null +++ b/api/v1/datadog/docs/SyntheticsAPITestConfig.md @@ -0,0 +1,98 @@ +# SyntheticsAPITestConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Assertions** | [**[]SyntheticsAssertion**](SyntheticsAssertion.md) | Array of assertions used for the test. | [default to []] +**ConfigVariables** | Pointer to [**[]SyntheticsConfigVariable**](SyntheticsConfigVariable.md) | Array of variables used for the test. | [optional] +**Request** | [**SyntheticsTestRequest**](SyntheticsTestRequest.md) | | + +## Methods + +### NewSyntheticsAPITestConfig + +`func NewSyntheticsAPITestConfig(assertions []SyntheticsAssertion, request SyntheticsTestRequest, ) *SyntheticsAPITestConfig` + +NewSyntheticsAPITestConfig instantiates a new SyntheticsAPITestConfig 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 + +### NewSyntheticsAPITestConfigWithDefaults + +`func NewSyntheticsAPITestConfigWithDefaults() *SyntheticsAPITestConfig` + +NewSyntheticsAPITestConfigWithDefaults instantiates a new SyntheticsAPITestConfig 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 + +### GetAssertions + +`func (o *SyntheticsAPITestConfig) GetAssertions() []SyntheticsAssertion` + +GetAssertions returns the Assertions field if non-nil, zero value otherwise. + +### GetAssertionsOk + +`func (o *SyntheticsAPITestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool)` + +GetAssertionsOk returns a tuple with the Assertions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAssertions + +`func (o *SyntheticsAPITestConfig) SetAssertions(v []SyntheticsAssertion)` + +SetAssertions sets Assertions field to given value. + + +### GetConfigVariables + +`func (o *SyntheticsAPITestConfig) GetConfigVariables() []SyntheticsConfigVariable` + +GetConfigVariables returns the ConfigVariables field if non-nil, zero value otherwise. + +### GetConfigVariablesOk + +`func (o *SyntheticsAPITestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool)` + +GetConfigVariablesOk returns a tuple with the ConfigVariables field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfigVariables + +`func (o *SyntheticsAPITestConfig) SetConfigVariables(v []SyntheticsConfigVariable)` + +SetConfigVariables sets ConfigVariables field to given value. + +### HasConfigVariables + +`func (o *SyntheticsAPITestConfig) HasConfigVariables() bool` + +HasConfigVariables returns a boolean if a field has been set. + +### GetRequest + +`func (o *SyntheticsAPITestConfig) GetRequest() SyntheticsTestRequest` + +GetRequest returns the Request field if non-nil, zero value otherwise. + +### GetRequestOk + +`func (o *SyntheticsAPITestConfig) GetRequestOk() (*SyntheticsTestRequest, bool)` + +GetRequestOk returns a tuple with the Request field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequest + +`func (o *SyntheticsAPITestConfig) SetRequest(v SyntheticsTestRequest)` + +SetRequest sets Request field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/api/v1/datadog/docs/SyntheticsAPITestType.md b/api/v1/datadog/docs/SyntheticsAPITestType.md new file mode 100644 index 00000000000..4c060e62cbd --- /dev/null +++ b/api/v1/datadog/docs/SyntheticsAPITestType.md @@ -0,0 +1,11 @@ +# SyntheticsAPITestType + +## Enum + + +* `API` (value: `"api"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/api/v1/datadog/docs/SyntheticsApi.md b/api/v1/datadog/docs/SyntheticsApi.md index 9c2a4c2efcf..c04c60ebfb4 100644 --- a/api/v1/datadog/docs/SyntheticsApi.md +++ b/api/v1/datadog/docs/SyntheticsApi.md @@ -6,6 +6,8 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**CreateGlobalVariable**](SyntheticsApi.md#CreateGlobalVariable) | **Post** /api/v1/synthetics/variables | Create a global variable [**CreatePrivateLocation**](SyntheticsApi.md#CreatePrivateLocation) | **Post** /api/v1/synthetics/private-locations | Create a private location +[**CreateSyntheticsAPITest**](SyntheticsApi.md#CreateSyntheticsAPITest) | **Post** /api/v1/synthetics/tests/api | Create an API test +[**CreateSyntheticsBrowserTest**](SyntheticsApi.md#CreateSyntheticsBrowserTest) | **Post** /api/v1/synthetics/tests/browser | Create a browser test [**CreateTest**](SyntheticsApi.md#CreateTest) | **Post** /api/v1/synthetics/tests | Create a test [**DeleteGlobalVariable**](SyntheticsApi.md#DeleteGlobalVariable) | **Delete** /api/v1/synthetics/variables/{variable_id} | Delete a global variable [**DeletePrivateLocation**](SyntheticsApi.md#DeletePrivateLocation) | **Delete** /api/v1/synthetics/private-locations/{location_id} | Delete a private location @@ -22,6 +24,8 @@ Method | HTTP request | Description [**ListLocations**](SyntheticsApi.md#ListLocations) | **Get** /api/v1/synthetics/locations | Get all locations (public and private) [**ListTests**](SyntheticsApi.md#ListTests) | **Get** /api/v1/synthetics/tests | Get the list of all tests [**TriggerCITests**](SyntheticsApi.md#TriggerCITests) | **Post** /api/v1/synthetics/tests/trigger/ci | Trigger some Synthetics tests for CI +[**UpdateAPITest**](SyntheticsApi.md#UpdateAPITest) | **Put** /api/v1/synthetics/tests/api/{public_id} | Edit an API test +[**UpdateBrowserTest**](SyntheticsApi.md#UpdateBrowserTest) | **Put** /api/v1/synthetics/tests/browser/{public_id} | Edit a browser test [**UpdatePrivateLocation**](SyntheticsApi.md#UpdatePrivateLocation) | **Put** /api/v1/synthetics/private-locations/{location_id} | Edit a private location [**UpdateTest**](SyntheticsApi.md#UpdateTest) | **Put** /api/v1/synthetics/tests/{public_id} | Edit a test [**UpdateTestPauseStatus**](SyntheticsApi.md#UpdateTestPauseStatus) | **Put** /api/v1/synthetics/tests/{public_id}/status | Pause or start a test @@ -208,6 +212,186 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## CreateSyntheticsAPITest + +> SyntheticsAPITest CreateSyntheticsAPITest(ctx).Body(body).Execute() + +Create an API test + + + +### Example + +```go +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" +) + +func main() { + ctx := context.WithValue( + context.Background(), + datadog.ContextAPIKeys, + map[string]datadog.APIKey{ + "apiKeyAuth": { + Key: os.Getenv("DD_CLIENT_API_KEY"), + }, + "appKeyAuth": { + Key: os.Getenv("DD_CLIENT_APP_KEY"), + }, + }, + ) + + if site, ok := os.LookupEnv("DD_SITE"); ok { + ctx = context.WithValue( + ctx, + datadog.ContextServerVariables, + map[string]string{"site": site}, + ) + } + + body := *datadog.NewSyntheticsAPITest() // SyntheticsAPITest | Details of the test to create. + + configuration := datadog.NewConfiguration() + + api_client := datadog.NewAPIClient(configuration) + resp, r, err := api_client.SyntheticsApi.CreateSyntheticsAPITest(ctx).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsAPITest``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateSyntheticsAPITest`: SyntheticsAPITest + response_content, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.CreateSyntheticsAPITest:\n%s\n", response_content) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateSyntheticsAPITestRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**SyntheticsAPITest**](SyntheticsAPITest.md) | Details of the test to create. | + +### Return type + +[**SyntheticsAPITest**](SyntheticsAPITest.md) + +### Authorization + +[apiKeyAuth](../README.md#apiKeyAuth), [appKeyAuth](../README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateSyntheticsBrowserTest + +> SyntheticsBrowserTest CreateSyntheticsBrowserTest(ctx).Body(body).Execute() + +Create a browser test + + + +### Example + +```go +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" +) + +func main() { + ctx := context.WithValue( + context.Background(), + datadog.ContextAPIKeys, + map[string]datadog.APIKey{ + "apiKeyAuth": { + Key: os.Getenv("DD_CLIENT_API_KEY"), + }, + "appKeyAuth": { + Key: os.Getenv("DD_CLIENT_APP_KEY"), + }, + }, + ) + + if site, ok := os.LookupEnv("DD_SITE"); ok { + ctx = context.WithValue( + ctx, + datadog.ContextServerVariables, + map[string]string{"site": site}, + ) + } + + body := *datadog.NewSyntheticsBrowserTest() // SyntheticsBrowserTest | Details of the test to create. + + configuration := datadog.NewConfiguration() + + api_client := datadog.NewAPIClient(configuration) + resp, r, err := api_client.SyntheticsApi.CreateSyntheticsBrowserTest(ctx).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.CreateSyntheticsBrowserTest``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateSyntheticsBrowserTest`: SyntheticsBrowserTest + response_content, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.CreateSyntheticsBrowserTest:\n%s\n", response_content) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateSyntheticsBrowserTestRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**SyntheticsBrowserTest**](SyntheticsBrowserTest.md) | Details of the test to create. | + +### Return type + +[**SyntheticsBrowserTest**](SyntheticsBrowserTest.md) + +### Authorization + +[apiKeyAuth](../README.md#apiKeyAuth), [appKeyAuth](../README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## CreateTest > SyntheticsTestDetails CreateTest(ctx).Body(body).Execute() @@ -1694,6 +1878,198 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## UpdateAPITest + +> SyntheticsAPITest UpdateAPITest(ctx, publicId).Body(body).Execute() + +Edit an API test + + + +### Example + +```go +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" +) + +func main() { + ctx := context.WithValue( + context.Background(), + datadog.ContextAPIKeys, + map[string]datadog.APIKey{ + "apiKeyAuth": { + Key: os.Getenv("DD_CLIENT_API_KEY"), + }, + "appKeyAuth": { + Key: os.Getenv("DD_CLIENT_APP_KEY"), + }, + }, + ) + + if site, ok := os.LookupEnv("DD_SITE"); ok { + ctx = context.WithValue( + ctx, + datadog.ContextServerVariables, + map[string]string{"site": site}, + ) + } + + publicId := "publicId_example" // string | The public ID of the test to get details from. + body := *datadog.NewSyntheticsAPITest() // SyntheticsAPITest | New test details to be saved. + + configuration := datadog.NewConfiguration() + + api_client := datadog.NewAPIClient(configuration) + resp, r, err := api_client.SyntheticsApi.UpdateAPITest(ctx, publicId).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.UpdateAPITest``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateAPITest`: SyntheticsAPITest + response_content, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.UpdateAPITest:\n%s\n", response_content) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**publicId** | **string** | The public ID of the test to get details from. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateAPITestRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | [**SyntheticsAPITest**](SyntheticsAPITest.md) | New test details to be saved. | + +### Return type + +[**SyntheticsAPITest**](SyntheticsAPITest.md) + +### Authorization + +[apiKeyAuth](../README.md#apiKeyAuth), [appKeyAuth](../README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateBrowserTest + +> SyntheticsBrowserTest UpdateBrowserTest(ctx, publicId).Body(body).Execute() + +Edit a browser test + + + +### Example + +```go +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" +) + +func main() { + ctx := context.WithValue( + context.Background(), + datadog.ContextAPIKeys, + map[string]datadog.APIKey{ + "apiKeyAuth": { + Key: os.Getenv("DD_CLIENT_API_KEY"), + }, + "appKeyAuth": { + Key: os.Getenv("DD_CLIENT_APP_KEY"), + }, + }, + ) + + if site, ok := os.LookupEnv("DD_SITE"); ok { + ctx = context.WithValue( + ctx, + datadog.ContextServerVariables, + map[string]string{"site": site}, + ) + } + + publicId := "publicId_example" // string | The public ID of the test to get details from. + body := *datadog.NewSyntheticsBrowserTest() // SyntheticsBrowserTest | New test details to be saved. + + configuration := datadog.NewConfiguration() + + api_client := datadog.NewAPIClient(configuration) + resp, r, err := api_client.SyntheticsApi.UpdateBrowserTest(ctx, publicId).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SyntheticsApi.UpdateBrowserTest``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateBrowserTest`: SyntheticsBrowserTest + response_content, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from SyntheticsApi.UpdateBrowserTest:\n%s\n", response_content) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**publicId** | **string** | The public ID of the test to get details from. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUpdateBrowserTestRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | [**SyntheticsBrowserTest**](SyntheticsBrowserTest.md) | New test details to be saved. | + +### Return type + +[**SyntheticsBrowserTest**](SyntheticsBrowserTest.md) + +### Authorization + +[apiKeyAuth](../README.md#apiKeyAuth), [appKeyAuth](../README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## UpdatePrivateLocation > SyntheticsPrivateLocation UpdatePrivateLocation(ctx, locationId).Body(body).Execute() diff --git a/api/v1/datadog/docs/SyntheticsBrowserTest.md b/api/v1/datadog/docs/SyntheticsBrowserTest.md new file mode 100644 index 00000000000..d0c03b5f106 --- /dev/null +++ b/api/v1/datadog/docs/SyntheticsBrowserTest.md @@ -0,0 +1,316 @@ +# SyntheticsBrowserTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Config** | Pointer to [**SyntheticsBrowserTestConfig**](SyntheticsBrowserTestConfig.md) | | [optional] +**Locations** | Pointer to **[]string** | Array of locations used to run the test. | [optional] +**Message** | Pointer to **string** | Notification message associated with the test. | [optional] +**MonitorId** | Pointer to **int64** | The associated monitor ID. | [optional] +**Name** | Pointer to **string** | Name of the test. | [optional] +**Options** | Pointer to [**SyntheticsTestOptions**](SyntheticsTestOptions.md) | | [optional] +**PublicId** | Pointer to **string** | The public ID of the test. | [optional] +**Status** | Pointer to [**SyntheticsTestPauseStatus**](SyntheticsTestPauseStatus.md) | | [optional] +**Steps** | Pointer to [**[]SyntheticsStep**](SyntheticsStep.md) | The steps of the test. | [optional] +**Tags** | Pointer to **[]string** | Array of tags attached to the test. | [optional] +**Type** | Pointer to [**SyntheticsBrowserTestType**](SyntheticsBrowserTestType.md) | | [optional] [default to "browser"] + +## Methods + +### NewSyntheticsBrowserTest + +`func NewSyntheticsBrowserTest() *SyntheticsBrowserTest` + +NewSyntheticsBrowserTest instantiates a new SyntheticsBrowserTest 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 + +### NewSyntheticsBrowserTestWithDefaults + +`func NewSyntheticsBrowserTestWithDefaults() *SyntheticsBrowserTest` + +NewSyntheticsBrowserTestWithDefaults instantiates a new SyntheticsBrowserTest 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 + +### GetConfig + +`func (o *SyntheticsBrowserTest) GetConfig() SyntheticsBrowserTestConfig` + +GetConfig returns the Config field if non-nil, zero value otherwise. + +### GetConfigOk + +`func (o *SyntheticsBrowserTest) GetConfigOk() (*SyntheticsBrowserTestConfig, bool)` + +GetConfigOk returns a tuple with the Config field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetConfig + +`func (o *SyntheticsBrowserTest) SetConfig(v SyntheticsBrowserTestConfig)` + +SetConfig sets Config field to given value. + +### HasConfig + +`func (o *SyntheticsBrowserTest) HasConfig() bool` + +HasConfig returns a boolean if a field has been set. + +### GetLocations + +`func (o *SyntheticsBrowserTest) GetLocations() []string` + +GetLocations returns the Locations field if non-nil, zero value otherwise. + +### GetLocationsOk + +`func (o *SyntheticsBrowserTest) GetLocationsOk() (*[]string, bool)` + +GetLocationsOk returns a tuple with the Locations field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLocations + +`func (o *SyntheticsBrowserTest) SetLocations(v []string)` + +SetLocations sets Locations field to given value. + +### HasLocations + +`func (o *SyntheticsBrowserTest) HasLocations() bool` + +HasLocations returns a boolean if a field has been set. + +### GetMessage + +`func (o *SyntheticsBrowserTest) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *SyntheticsBrowserTest) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *SyntheticsBrowserTest) SetMessage(v string)` + +SetMessage sets Message field to given value. + +### HasMessage + +`func (o *SyntheticsBrowserTest) HasMessage() bool` + +HasMessage returns a boolean if a field has been set. + +### GetMonitorId + +`func (o *SyntheticsBrowserTest) GetMonitorId() int64` + +GetMonitorId returns the MonitorId field if non-nil, zero value otherwise. + +### GetMonitorIdOk + +`func (o *SyntheticsBrowserTest) GetMonitorIdOk() (*int64, bool)` + +GetMonitorIdOk returns a tuple with the MonitorId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMonitorId + +`func (o *SyntheticsBrowserTest) SetMonitorId(v int64)` + +SetMonitorId sets MonitorId field to given value. + +### HasMonitorId + +`func (o *SyntheticsBrowserTest) HasMonitorId() bool` + +HasMonitorId returns a boolean if a field has been set. + +### GetName + +`func (o *SyntheticsBrowserTest) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SyntheticsBrowserTest) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *SyntheticsBrowserTest) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *SyntheticsBrowserTest) HasName() bool` + +HasName returns a boolean if a field has been set. + +### GetOptions + +`func (o *SyntheticsBrowserTest) GetOptions() SyntheticsTestOptions` + +GetOptions returns the Options field if non-nil, zero value otherwise. + +### GetOptionsOk + +`func (o *SyntheticsBrowserTest) GetOptionsOk() (*SyntheticsTestOptions, bool)` + +GetOptionsOk returns a tuple with the Options field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOptions + +`func (o *SyntheticsBrowserTest) SetOptions(v SyntheticsTestOptions)` + +SetOptions sets Options field to given value. + +### HasOptions + +`func (o *SyntheticsBrowserTest) HasOptions() bool` + +HasOptions returns a boolean if a field has been set. + +### GetPublicId + +`func (o *SyntheticsBrowserTest) GetPublicId() string` + +GetPublicId returns the PublicId field if non-nil, zero value otherwise. + +### GetPublicIdOk + +`func (o *SyntheticsBrowserTest) GetPublicIdOk() (*string, bool)` + +GetPublicIdOk returns a tuple with the PublicId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicId + +`func (o *SyntheticsBrowserTest) SetPublicId(v string)` + +SetPublicId sets PublicId field to given value. + +### HasPublicId + +`func (o *SyntheticsBrowserTest) HasPublicId() bool` + +HasPublicId returns a boolean if a field has been set. + +### GetStatus + +`func (o *SyntheticsBrowserTest) GetStatus() SyntheticsTestPauseStatus` + +GetStatus returns the Status field if non-nil, zero value otherwise. + +### GetStatusOk + +`func (o *SyntheticsBrowserTest) GetStatusOk() (*SyntheticsTestPauseStatus, bool)` + +GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatus + +`func (o *SyntheticsBrowserTest) SetStatus(v SyntheticsTestPauseStatus)` + +SetStatus sets Status field to given value. + +### HasStatus + +`func (o *SyntheticsBrowserTest) HasStatus() bool` + +HasStatus returns a boolean if a field has been set. + +### GetSteps + +`func (o *SyntheticsBrowserTest) GetSteps() []SyntheticsStep` + +GetSteps returns the Steps field if non-nil, zero value otherwise. + +### GetStepsOk + +`func (o *SyntheticsBrowserTest) GetStepsOk() (*[]SyntheticsStep, bool)` + +GetStepsOk returns a tuple with the Steps field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSteps + +`func (o *SyntheticsBrowserTest) SetSteps(v []SyntheticsStep)` + +SetSteps sets Steps field to given value. + +### HasSteps + +`func (o *SyntheticsBrowserTest) HasSteps() bool` + +HasSteps returns a boolean if a field has been set. + +### GetTags + +`func (o *SyntheticsBrowserTest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *SyntheticsBrowserTest) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *SyntheticsBrowserTest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *SyntheticsBrowserTest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + +### GetType + +`func (o *SyntheticsBrowserTest) GetType() SyntheticsBrowserTestType` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *SyntheticsBrowserTest) GetTypeOk() (*SyntheticsBrowserTestType, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *SyntheticsBrowserTest) SetType(v SyntheticsBrowserTestType)` + +SetType sets Type field to given value. + +### HasType + +`func (o *SyntheticsBrowserTest) HasType() bool` + +HasType returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/api/v1/datadog/docs/SyntheticsBrowserTestConfig.md b/api/v1/datadog/docs/SyntheticsBrowserTestConfig.md new file mode 100644 index 00000000000..158d6e797f9 --- /dev/null +++ b/api/v1/datadog/docs/SyntheticsBrowserTestConfig.md @@ -0,0 +1,98 @@ +# SyntheticsBrowserTestConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Assertions** | [**[]SyntheticsAssertion**](SyntheticsAssertion.md) | Array of assertions used for the test. | [default to []] +**Request** | [**SyntheticsTestRequest**](SyntheticsTestRequest.md) | | +**Variables** | Pointer to [**[]SyntheticsBrowserVariable**](SyntheticsBrowserVariable.md) | Array of variables used for the test steps. | [optional] + +## Methods + +### NewSyntheticsBrowserTestConfig + +`func NewSyntheticsBrowserTestConfig(assertions []SyntheticsAssertion, request SyntheticsTestRequest, ) *SyntheticsBrowserTestConfig` + +NewSyntheticsBrowserTestConfig instantiates a new SyntheticsBrowserTestConfig 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 + +### NewSyntheticsBrowserTestConfigWithDefaults + +`func NewSyntheticsBrowserTestConfigWithDefaults() *SyntheticsBrowserTestConfig` + +NewSyntheticsBrowserTestConfigWithDefaults instantiates a new SyntheticsBrowserTestConfig 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 + +### GetAssertions + +`func (o *SyntheticsBrowserTestConfig) GetAssertions() []SyntheticsAssertion` + +GetAssertions returns the Assertions field if non-nil, zero value otherwise. + +### GetAssertionsOk + +`func (o *SyntheticsBrowserTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool)` + +GetAssertionsOk returns a tuple with the Assertions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAssertions + +`func (o *SyntheticsBrowserTestConfig) SetAssertions(v []SyntheticsAssertion)` + +SetAssertions sets Assertions field to given value. + + +### GetRequest + +`func (o *SyntheticsBrowserTestConfig) GetRequest() SyntheticsTestRequest` + +GetRequest returns the Request field if non-nil, zero value otherwise. + +### GetRequestOk + +`func (o *SyntheticsBrowserTestConfig) GetRequestOk() (*SyntheticsTestRequest, bool)` + +GetRequestOk returns a tuple with the Request field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequest + +`func (o *SyntheticsBrowserTestConfig) SetRequest(v SyntheticsTestRequest)` + +SetRequest sets Request field to given value. + + +### GetVariables + +`func (o *SyntheticsBrowserTestConfig) GetVariables() []SyntheticsBrowserVariable` + +GetVariables returns the Variables field if non-nil, zero value otherwise. + +### GetVariablesOk + +`func (o *SyntheticsBrowserTestConfig) GetVariablesOk() (*[]SyntheticsBrowserVariable, bool)` + +GetVariablesOk returns a tuple with the Variables field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVariables + +`func (o *SyntheticsBrowserTestConfig) SetVariables(v []SyntheticsBrowserVariable)` + +SetVariables sets Variables field to given value. + +### HasVariables + +`func (o *SyntheticsBrowserTestConfig) HasVariables() bool` + +HasVariables returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/api/v1/datadog/docs/SyntheticsBrowserTestType.md b/api/v1/datadog/docs/SyntheticsBrowserTestType.md new file mode 100644 index 00000000000..64e37f5f9da --- /dev/null +++ b/api/v1/datadog/docs/SyntheticsBrowserTestType.md @@ -0,0 +1,11 @@ +# SyntheticsBrowserTestType + +## Enum + + +* `BROWSER` (value: `"browser"`) + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/api/v1/datadog/model_synthetics_api_test_.go b/api/v1/datadog/model_synthetics_api_test_.go new file mode 100644 index 00000000000..724165a759d --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_.go @@ -0,0 +1,481 @@ +/* + * 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. + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITest Object containing details about a Synthetic API test. +type SyntheticsAPITest struct { + Config *SyntheticsAPITestConfig `json:"config,omitempty"` + // Array of locations used to run the test. + Locations *[]string `json:"locations,omitempty"` + // Notification message associated with the test. + Message *string `json:"message,omitempty"` + // The associated monitor ID. + MonitorId *int64 `json:"monitor_id,omitempty"` + // Name of the test. + Name *string `json:"name,omitempty"` + Options *SyntheticsTestOptions `json:"options,omitempty"` + // The public ID for the test. + PublicId *string `json:"public_id,omitempty"` + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + Subtype *SyntheticsTestDetailsSubType `json:"subtype,omitempty"` + // Array of tags attached to the test. + Tags *[]string `json:"tags,omitempty"` + Type *SyntheticsAPITestType `json:"type,omitempty"` +} + +// NewSyntheticsAPITest instantiates a new SyntheticsAPITest 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 NewSyntheticsAPITest() *SyntheticsAPITest { + this := SyntheticsAPITest{} + var type_ SyntheticsAPITestType = "api" + this.Type = &type_ + return &this +} + +// NewSyntheticsAPITestWithDefaults instantiates a new SyntheticsAPITest 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 NewSyntheticsAPITestWithDefaults() *SyntheticsAPITest { + this := SyntheticsAPITest{} + var type_ SyntheticsAPITestType = "api" + this.Type = &type_ + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetConfig() SyntheticsAPITestConfig { + if o == nil || o.Config == nil { + var ret SyntheticsAPITestConfig + return ret + } + return *o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetConfigOk() (*SyntheticsAPITestConfig, bool) { + if o == nil || o.Config == nil { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasConfig() bool { + if o != nil && o.Config != nil { + return true + } + + return false +} + +// SetConfig gets a reference to the given SyntheticsAPITestConfig and assigns it to the Config field. +func (o *SyntheticsAPITest) SetConfig(v SyntheticsAPITestConfig) { + o.Config = &v +} + +// GetLocations returns the Locations field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetLocations() []string { + if o == nil || o.Locations == nil { + var ret []string + return ret + } + return *o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetLocationsOk() (*[]string, bool) { + if o == nil || o.Locations == nil { + return nil, false + } + return o.Locations, true +} + +// HasLocations returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasLocations() bool { + if o != nil && o.Locations != nil { + return true + } + + return false +} + +// SetLocations gets a reference to the given []string and assigns it to the Locations field. +func (o *SyntheticsAPITest) SetLocations(v []string) { + o.Locations = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SyntheticsAPITest) SetMessage(v string) { + o.Message = &v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetMonitorId() int64 { + if o == nil || o.MonitorId == nil { + var ret int64 + return ret + } + return *o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetMonitorIdOk() (*int64, bool) { + if o == nil || o.MonitorId == nil { + return nil, false + } + return o.MonitorId, true +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasMonitorId() bool { + if o != nil && o.MonitorId != nil { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. +func (o *SyntheticsAPITest) SetMonitorId(v int64) { + o.MonitorId = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsAPITest) 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 *SyntheticsAPITest) 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 *SyntheticsAPITest) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsAPITest) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetOptions() SyntheticsTestOptions { + if o == nil || o.Options == nil { + var ret SyntheticsTestOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetOptionsOk() (*SyntheticsTestOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given SyntheticsTestOptions and assigns it to the Options field. +func (o *SyntheticsAPITest) SetOptions(v SyntheticsTestOptions) { + o.Options = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsAPITest) SetPublicId(v string) { + o.PublicId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetStatus() SyntheticsTestPauseStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestPauseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. +func (o *SyntheticsAPITest) SetStatus(v SyntheticsTestPauseStatus) { + o.Status = &v +} + +// GetSubtype returns the Subtype field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetSubtype() SyntheticsTestDetailsSubType { + if o == nil || o.Subtype == nil { + var ret SyntheticsTestDetailsSubType + return ret + } + return *o.Subtype +} + +// GetSubtypeOk returns a tuple with the Subtype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetSubtypeOk() (*SyntheticsTestDetailsSubType, bool) { + if o == nil || o.Subtype == nil { + return nil, false + } + return o.Subtype, true +} + +// HasSubtype returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasSubtype() bool { + if o != nil && o.Subtype != nil { + return true + } + + return false +} + +// SetSubtype gets a reference to the given SyntheticsTestDetailsSubType and assigns it to the Subtype field. +func (o *SyntheticsAPITest) SetSubtype(v SyntheticsTestDetailsSubType) { + o.Subtype = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SyntheticsAPITest) SetTags(v []string) { + o.Tags = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsAPITest) GetType() SyntheticsAPITestType { + if o == nil || o.Type == nil { + var ret SyntheticsAPITestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITest) GetTypeOk() (*SyntheticsAPITestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsAPITest) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsAPITestType and assigns it to the Type field. +func (o *SyntheticsAPITest) SetType(v SyntheticsAPITestType) { + o.Type = &v +} + +func (o SyntheticsAPITest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Config != nil { + toSerialize["config"] = o.Config + } + if o.Locations != nil { + toSerialize["locations"] = o.Locations + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.MonitorId != nil { + toSerialize["monitor_id"] = o.MonitorId + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Subtype != nil { + toSerialize["subtype"] = o.Subtype + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + return json.Marshal(toSerialize) +} + +type NullableSyntheticsAPITest struct { + value *SyntheticsAPITest + isSet bool +} + +func (v NullableSyntheticsAPITest) Get() *SyntheticsAPITest { + return v.value +} + +func (v *NullableSyntheticsAPITest) Set(val *SyntheticsAPITest) { + v.value = val + v.isSet = true +} + +func (v NullableSyntheticsAPITest) IsSet() bool { + return v.isSet +} + +func (v *NullableSyntheticsAPITest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSyntheticsAPITest(val *SyntheticsAPITest) *NullableSyntheticsAPITest { + return &NullableSyntheticsAPITest{value: val, isSet: true} +} + +func (v NullableSyntheticsAPITest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSyntheticsAPITest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_api_test_config.go b/api/v1/datadog/model_synthetics_api_test_config.go new file mode 100644 index 00000000000..51de05c4951 --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_config.go @@ -0,0 +1,171 @@ +/* + * 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. + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package datadog + +import ( + "encoding/json" +) + +// SyntheticsAPITestConfig Configuration object for a Synthetic API test. +type SyntheticsAPITestConfig struct { + // Array of assertions used for the test. + Assertions []SyntheticsAssertion `json:"assertions"` + // Array of variables used for the test. + ConfigVariables *[]SyntheticsConfigVariable `json:"configVariables,omitempty"` + Request SyntheticsTestRequest `json:"request"` +} + +// NewSyntheticsAPITestConfig instantiates a new SyntheticsAPITestConfig 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 NewSyntheticsAPITestConfig(assertions []SyntheticsAssertion, request SyntheticsTestRequest) *SyntheticsAPITestConfig { + this := SyntheticsAPITestConfig{} + this.Assertions = assertions + this.Request = request + return &this +} + +// NewSyntheticsAPITestConfigWithDefaults instantiates a new SyntheticsAPITestConfig 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 NewSyntheticsAPITestConfigWithDefaults() *SyntheticsAPITestConfig { + this := SyntheticsAPITestConfig{} + return &this +} + +// GetAssertions returns the Assertions field value +func (o *SyntheticsAPITestConfig) GetAssertions() []SyntheticsAssertion { + if o == nil { + var ret []SyntheticsAssertion + return ret + } + + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { + if o == nil { + return nil, false + } + return &o.Assertions, true +} + +// SetAssertions sets field value +func (o *SyntheticsAPITestConfig) SetAssertions(v []SyntheticsAssertion) { + o.Assertions = v +} + +// GetConfigVariables returns the ConfigVariables field value if set, zero value otherwise. +func (o *SyntheticsAPITestConfig) GetConfigVariables() []SyntheticsConfigVariable { + if o == nil || o.ConfigVariables == nil { + var ret []SyntheticsConfigVariable + return ret + } + return *o.ConfigVariables +} + +// GetConfigVariablesOk returns a tuple with the ConfigVariables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetConfigVariablesOk() (*[]SyntheticsConfigVariable, bool) { + if o == nil || o.ConfigVariables == nil { + return nil, false + } + return o.ConfigVariables, true +} + +// HasConfigVariables returns a boolean if a field has been set. +func (o *SyntheticsAPITestConfig) HasConfigVariables() bool { + if o != nil && o.ConfigVariables != nil { + return true + } + + return false +} + +// SetConfigVariables gets a reference to the given []SyntheticsConfigVariable and assigns it to the ConfigVariables field. +func (o *SyntheticsAPITestConfig) SetConfigVariables(v []SyntheticsConfigVariable) { + o.ConfigVariables = &v +} + +// GetRequest returns the Request field value +func (o *SyntheticsAPITestConfig) GetRequest() SyntheticsTestRequest { + if o == nil { + var ret SyntheticsTestRequest + return ret + } + + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *SyntheticsAPITestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value +func (o *SyntheticsAPITestConfig) SetRequest(v SyntheticsTestRequest) { + o.Request = v +} + +func (o SyntheticsAPITestConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["assertions"] = o.Assertions + } + if o.ConfigVariables != nil { + toSerialize["configVariables"] = o.ConfigVariables + } + if true { + toSerialize["request"] = o.Request + } + return json.Marshal(toSerialize) +} + +type NullableSyntheticsAPITestConfig struct { + value *SyntheticsAPITestConfig + isSet bool +} + +func (v NullableSyntheticsAPITestConfig) Get() *SyntheticsAPITestConfig { + return v.value +} + +func (v *NullableSyntheticsAPITestConfig) Set(val *SyntheticsAPITestConfig) { + v.value = val + v.isSet = true +} + +func (v NullableSyntheticsAPITestConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableSyntheticsAPITestConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSyntheticsAPITestConfig(val *SyntheticsAPITestConfig) *NullableSyntheticsAPITestConfig { + return &NullableSyntheticsAPITestConfig{value: val, isSet: true} +} + +func (v NullableSyntheticsAPITestConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSyntheticsAPITestConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_api_test_type.go b/api/v1/datadog/model_synthetics_api_test_type.go new file mode 100644 index 00000000000..5258d58006e --- /dev/null +++ b/api/v1/datadog/model_synthetics_api_test_type.go @@ -0,0 +1,105 @@ +/* + * 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. + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsAPITestType Type of the Synthetic test, `api`. +type SyntheticsAPITestType string + +// List of SyntheticsAPITestType +const ( + SYNTHETICSAPITESTTYPE_API SyntheticsAPITestType = "api" +) + +var allowedSyntheticsAPITestTypeEnumValues = []SyntheticsAPITestType{ + "api", +} + +func (v *SyntheticsAPITestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SyntheticsAPITestType(value) + for _, existing := range allowedSyntheticsAPITestTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SyntheticsAPITestType", value) +} + +// NewSyntheticsAPITestTypeFromValue returns a pointer to a valid SyntheticsAPITestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSyntheticsAPITestTypeFromValue(v string) (*SyntheticsAPITestType, error) { + ev := SyntheticsAPITestType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SyntheticsAPITestType: valid values are %v", v, allowedSyntheticsAPITestTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SyntheticsAPITestType) IsValid() bool { + for _, existing := range allowedSyntheticsAPITestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsAPITestType value +func (v SyntheticsAPITestType) Ptr() *SyntheticsAPITestType { + return &v +} + +type NullableSyntheticsAPITestType struct { + value *SyntheticsAPITestType + isSet bool +} + +func (v NullableSyntheticsAPITestType) Get() *SyntheticsAPITestType { + return v.value +} + +func (v *NullableSyntheticsAPITestType) Set(val *SyntheticsAPITestType) { + v.value = val + v.isSet = true +} + +func (v NullableSyntheticsAPITestType) IsSet() bool { + return v.isSet +} + +func (v *NullableSyntheticsAPITestType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSyntheticsAPITestType(val *SyntheticsAPITestType) *NullableSyntheticsAPITestType { + return &NullableSyntheticsAPITestType{value: val, isSet: true} +} + +func (v NullableSyntheticsAPITestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSyntheticsAPITestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_browser_test_.go b/api/v1/datadog/model_synthetics_browser_test_.go new file mode 100644 index 00000000000..c4be84687bb --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_.go @@ -0,0 +1,482 @@ +/* + * 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. + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTest Object containing details about a Synthetic browser test. +type SyntheticsBrowserTest struct { + Config *SyntheticsBrowserTestConfig `json:"config,omitempty"` + // Array of locations used to run the test. + Locations *[]string `json:"locations,omitempty"` + // Notification message associated with the test. + Message *string `json:"message,omitempty"` + // The associated monitor ID. + MonitorId *int64 `json:"monitor_id,omitempty"` + // Name of the test. + Name *string `json:"name,omitempty"` + Options *SyntheticsTestOptions `json:"options,omitempty"` + // The public ID of the test. + PublicId *string `json:"public_id,omitempty"` + Status *SyntheticsTestPauseStatus `json:"status,omitempty"` + // The steps of the test. + Steps *[]SyntheticsStep `json:"steps,omitempty"` + // Array of tags attached to the test. + Tags *[]string `json:"tags,omitempty"` + Type *SyntheticsBrowserTestType `json:"type,omitempty"` +} + +// NewSyntheticsBrowserTest instantiates a new SyntheticsBrowserTest 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 NewSyntheticsBrowserTest() *SyntheticsBrowserTest { + this := SyntheticsBrowserTest{} + var type_ SyntheticsBrowserTestType = "browser" + this.Type = &type_ + return &this +} + +// NewSyntheticsBrowserTestWithDefaults instantiates a new SyntheticsBrowserTest 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 NewSyntheticsBrowserTestWithDefaults() *SyntheticsBrowserTest { + this := SyntheticsBrowserTest{} + var type_ SyntheticsBrowserTestType = "browser" + this.Type = &type_ + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetConfig() SyntheticsBrowserTestConfig { + if o == nil || o.Config == nil { + var ret SyntheticsBrowserTestConfig + return ret + } + return *o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetConfigOk() (*SyntheticsBrowserTestConfig, bool) { + if o == nil || o.Config == nil { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasConfig() bool { + if o != nil && o.Config != nil { + return true + } + + return false +} + +// SetConfig gets a reference to the given SyntheticsBrowserTestConfig and assigns it to the Config field. +func (o *SyntheticsBrowserTest) SetConfig(v SyntheticsBrowserTestConfig) { + o.Config = &v +} + +// GetLocations returns the Locations field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetLocations() []string { + if o == nil || o.Locations == nil { + var ret []string + return ret + } + return *o.Locations +} + +// GetLocationsOk returns a tuple with the Locations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetLocationsOk() (*[]string, bool) { + if o == nil || o.Locations == nil { + return nil, false + } + return o.Locations, true +} + +// HasLocations returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasLocations() bool { + if o != nil && o.Locations != nil { + return true + } + + return false +} + +// SetLocations gets a reference to the given []string and assigns it to the Locations field. +func (o *SyntheticsBrowserTest) SetLocations(v []string) { + o.Locations = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetMessage() string { + if o == nil || o.Message == nil { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetMessageOk() (*string, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *SyntheticsBrowserTest) SetMessage(v string) { + o.Message = &v +} + +// GetMonitorId returns the MonitorId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetMonitorId() int64 { + if o == nil || o.MonitorId == nil { + var ret int64 + return ret + } + return *o.MonitorId +} + +// GetMonitorIdOk returns a tuple with the MonitorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetMonitorIdOk() (*int64, bool) { + if o == nil || o.MonitorId == nil { + return nil, false + } + return o.MonitorId, true +} + +// HasMonitorId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasMonitorId() bool { + if o != nil && o.MonitorId != nil { + return true + } + + return false +} + +// SetMonitorId gets a reference to the given int64 and assigns it to the MonitorId field. +func (o *SyntheticsBrowserTest) SetMonitorId(v int64) { + o.MonitorId = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) 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 *SyntheticsBrowserTest) 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 *SyntheticsBrowserTest) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SyntheticsBrowserTest) SetName(v string) { + o.Name = &v +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetOptions() SyntheticsTestOptions { + if o == nil || o.Options == nil { + var ret SyntheticsTestOptions + return ret + } + return *o.Options +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetOptionsOk() (*SyntheticsTestOptions, bool) { + if o == nil || o.Options == nil { + return nil, false + } + return o.Options, true +} + +// HasOptions returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasOptions() bool { + if o != nil && o.Options != nil { + return true + } + + return false +} + +// SetOptions gets a reference to the given SyntheticsTestOptions and assigns it to the Options field. +func (o *SyntheticsBrowserTest) SetOptions(v SyntheticsTestOptions) { + o.Options = &v +} + +// GetPublicId returns the PublicId field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetPublicId() string { + if o == nil || o.PublicId == nil { + var ret string + return ret + } + return *o.PublicId +} + +// GetPublicIdOk returns a tuple with the PublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetPublicIdOk() (*string, bool) { + if o == nil || o.PublicId == nil { + return nil, false + } + return o.PublicId, true +} + +// HasPublicId returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasPublicId() bool { + if o != nil && o.PublicId != nil { + return true + } + + return false +} + +// SetPublicId gets a reference to the given string and assigns it to the PublicId field. +func (o *SyntheticsBrowserTest) SetPublicId(v string) { + o.PublicId = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetStatus() SyntheticsTestPauseStatus { + if o == nil || o.Status == nil { + var ret SyntheticsTestPauseStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetStatusOk() (*SyntheticsTestPauseStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// SetStatus gets a reference to the given SyntheticsTestPauseStatus and assigns it to the Status field. +func (o *SyntheticsBrowserTest) SetStatus(v SyntheticsTestPauseStatus) { + o.Status = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetSteps() []SyntheticsStep { + if o == nil || o.Steps == nil { + var ret []SyntheticsStep + return ret + } + return *o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetStepsOk() (*[]SyntheticsStep, bool) { + if o == nil || o.Steps == nil { + return nil, false + } + return o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasSteps() bool { + if o != nil && o.Steps != nil { + return true + } + + return false +} + +// SetSteps gets a reference to the given []SyntheticsStep and assigns it to the Steps field. +func (o *SyntheticsBrowserTest) SetSteps(v []SyntheticsStep) { + o.Steps = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return *o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasTags() bool { + if o != nil && o.Tags != nil { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *SyntheticsBrowserTest) SetTags(v []string) { + o.Tags = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SyntheticsBrowserTest) GetType() SyntheticsBrowserTestType { + if o == nil || o.Type == nil { + var ret SyntheticsBrowserTestType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTest) GetTypeOk() (*SyntheticsBrowserTestType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SyntheticsBrowserTest) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given SyntheticsBrowserTestType and assigns it to the Type field. +func (o *SyntheticsBrowserTest) SetType(v SyntheticsBrowserTestType) { + o.Type = &v +} + +func (o SyntheticsBrowserTest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Config != nil { + toSerialize["config"] = o.Config + } + if o.Locations != nil { + toSerialize["locations"] = o.Locations + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.MonitorId != nil { + toSerialize["monitor_id"] = o.MonitorId + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Options != nil { + toSerialize["options"] = o.Options + } + if o.PublicId != nil { + toSerialize["public_id"] = o.PublicId + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Steps != nil { + toSerialize["steps"] = o.Steps + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + return json.Marshal(toSerialize) +} + +type NullableSyntheticsBrowserTest struct { + value *SyntheticsBrowserTest + isSet bool +} + +func (v NullableSyntheticsBrowserTest) Get() *SyntheticsBrowserTest { + return v.value +} + +func (v *NullableSyntheticsBrowserTest) Set(val *SyntheticsBrowserTest) { + v.value = val + v.isSet = true +} + +func (v NullableSyntheticsBrowserTest) IsSet() bool { + return v.isSet +} + +func (v *NullableSyntheticsBrowserTest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSyntheticsBrowserTest(val *SyntheticsBrowserTest) *NullableSyntheticsBrowserTest { + return &NullableSyntheticsBrowserTest{value: val, isSet: true} +} + +func (v NullableSyntheticsBrowserTest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSyntheticsBrowserTest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_browser_test_config.go b/api/v1/datadog/model_synthetics_browser_test_config.go new file mode 100644 index 00000000000..122512a3c7f --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_config.go @@ -0,0 +1,171 @@ +/* + * 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. + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package datadog + +import ( + "encoding/json" +) + +// SyntheticsBrowserTestConfig Configuration object for a Synthetic browser test. +type SyntheticsBrowserTestConfig struct { + // Array of assertions used for the test. + Assertions []SyntheticsAssertion `json:"assertions"` + Request SyntheticsTestRequest `json:"request"` + // Array of variables used for the test steps. + Variables *[]SyntheticsBrowserVariable `json:"variables,omitempty"` +} + +// NewSyntheticsBrowserTestConfig instantiates a new SyntheticsBrowserTestConfig 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 NewSyntheticsBrowserTestConfig(assertions []SyntheticsAssertion, request SyntheticsTestRequest) *SyntheticsBrowserTestConfig { + this := SyntheticsBrowserTestConfig{} + this.Assertions = assertions + this.Request = request + return &this +} + +// NewSyntheticsBrowserTestConfigWithDefaults instantiates a new SyntheticsBrowserTestConfig 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 NewSyntheticsBrowserTestConfigWithDefaults() *SyntheticsBrowserTestConfig { + this := SyntheticsBrowserTestConfig{} + return &this +} + +// GetAssertions returns the Assertions field value +func (o *SyntheticsBrowserTestConfig) GetAssertions() []SyntheticsAssertion { + if o == nil { + var ret []SyntheticsAssertion + return ret + } + + return o.Assertions +} + +// GetAssertionsOk returns a tuple with the Assertions field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetAssertionsOk() (*[]SyntheticsAssertion, bool) { + if o == nil { + return nil, false + } + return &o.Assertions, true +} + +// SetAssertions sets field value +func (o *SyntheticsBrowserTestConfig) SetAssertions(v []SyntheticsAssertion) { + o.Assertions = v +} + +// GetRequest returns the Request field value +func (o *SyntheticsBrowserTestConfig) GetRequest() SyntheticsTestRequest { + if o == nil { + var ret SyntheticsTestRequest + return ret + } + + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetRequestOk() (*SyntheticsTestRequest, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value +func (o *SyntheticsBrowserTestConfig) SetRequest(v SyntheticsTestRequest) { + o.Request = v +} + +// GetVariables returns the Variables field value if set, zero value otherwise. +func (o *SyntheticsBrowserTestConfig) GetVariables() []SyntheticsBrowserVariable { + if o == nil || o.Variables == nil { + var ret []SyntheticsBrowserVariable + return ret + } + return *o.Variables +} + +// GetVariablesOk returns a tuple with the Variables field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyntheticsBrowserTestConfig) GetVariablesOk() (*[]SyntheticsBrowserVariable, bool) { + if o == nil || o.Variables == nil { + return nil, false + } + return o.Variables, true +} + +// HasVariables returns a boolean if a field has been set. +func (o *SyntheticsBrowserTestConfig) HasVariables() bool { + if o != nil && o.Variables != nil { + return true + } + + return false +} + +// SetVariables gets a reference to the given []SyntheticsBrowserVariable and assigns it to the Variables field. +func (o *SyntheticsBrowserTestConfig) SetVariables(v []SyntheticsBrowserVariable) { + o.Variables = &v +} + +func (o SyntheticsBrowserTestConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["assertions"] = o.Assertions + } + if true { + toSerialize["request"] = o.Request + } + if o.Variables != nil { + toSerialize["variables"] = o.Variables + } + return json.Marshal(toSerialize) +} + +type NullableSyntheticsBrowserTestConfig struct { + value *SyntheticsBrowserTestConfig + isSet bool +} + +func (v NullableSyntheticsBrowserTestConfig) Get() *SyntheticsBrowserTestConfig { + return v.value +} + +func (v *NullableSyntheticsBrowserTestConfig) Set(val *SyntheticsBrowserTestConfig) { + v.value = val + v.isSet = true +} + +func (v NullableSyntheticsBrowserTestConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableSyntheticsBrowserTestConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSyntheticsBrowserTestConfig(val *SyntheticsBrowserTestConfig) *NullableSyntheticsBrowserTestConfig { + return &NullableSyntheticsBrowserTestConfig{value: val, isSet: true} +} + +func (v NullableSyntheticsBrowserTestConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSyntheticsBrowserTestConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v1/datadog/model_synthetics_browser_test_type.go b/api/v1/datadog/model_synthetics_browser_test_type.go new file mode 100644 index 00000000000..94b6e063036 --- /dev/null +++ b/api/v1/datadog/model_synthetics_browser_test_type.go @@ -0,0 +1,105 @@ +/* + * 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. + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package datadog + +import ( + "encoding/json" + "fmt" +) + +// SyntheticsBrowserTestType Type of the Synthetic test, `browser`. +type SyntheticsBrowserTestType string + +// List of SyntheticsBrowserTestType +const ( + SYNTHETICSBROWSERTESTTYPE_BROWSER SyntheticsBrowserTestType = "browser" +) + +var allowedSyntheticsBrowserTestTypeEnumValues = []SyntheticsBrowserTestType{ + "browser", +} + +func (v *SyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SyntheticsBrowserTestType(value) + for _, existing := range allowedSyntheticsBrowserTestTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SyntheticsBrowserTestType", value) +} + +// NewSyntheticsBrowserTestTypeFromValue returns a pointer to a valid SyntheticsBrowserTestType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSyntheticsBrowserTestTypeFromValue(v string) (*SyntheticsBrowserTestType, error) { + ev := SyntheticsBrowserTestType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SyntheticsBrowserTestType: valid values are %v", v, allowedSyntheticsBrowserTestTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SyntheticsBrowserTestType) IsValid() bool { + for _, existing := range allowedSyntheticsBrowserTestTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SyntheticsBrowserTestType value +func (v SyntheticsBrowserTestType) Ptr() *SyntheticsBrowserTestType { + return &v +} + +type NullableSyntheticsBrowserTestType struct { + value *SyntheticsBrowserTestType + isSet bool +} + +func (v NullableSyntheticsBrowserTestType) Get() *SyntheticsBrowserTestType { + return v.value +} + +func (v *NullableSyntheticsBrowserTestType) Set(val *SyntheticsBrowserTestType) { + v.value = val + v.isSet = true +} + +func (v NullableSyntheticsBrowserTestType) IsSet() bool { + return v.isSet +} + +func (v *NullableSyntheticsBrowserTestType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSyntheticsBrowserTestType(val *SyntheticsBrowserTestType) *NullableSyntheticsBrowserTestType { + return &NullableSyntheticsBrowserTestType{value: val, isSet: true} +} + +func (v NullableSyntheticsBrowserTestType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSyntheticsBrowserTestType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/tests/api/v1/datadog/features/synthetics.feature b/tests/api/v1/datadog/features/synthetics.feature index e4a1ccef2af..d0c065c4b7f 100644 --- a/tests/api/v1/datadog/features/synthetics.feature +++ b/tests/api/v1/datadog/features/synthetics.feature @@ -15,6 +15,27 @@ Feature: Synthetics And a valid "appKeyAuth" key in the system And an instance of "Synthetics" API + @generated @skip + Scenario: Create a browser test returns "- JSON format is wrong" response + Given new "CreateSyntheticsBrowserTest" request + And body {} + When the request is sent + Then the response status is 400 - JSON format is wrong + + @generated @skip + Scenario: Create a browser test returns "OK - Returns the created test details." response + Given new "CreateSyntheticsBrowserTest" request + And body {} + When the request is sent + Then the response status is 200 OK - Returns the created test details. + + @generated @skip + Scenario: Create a browser test returns "Test quota is reached" response + Given new "CreateSyntheticsBrowserTest" request + And body {} + When the request is sent + Then the response status is 402 Test quota is reached + @generated @skip Scenario: Create a global variable returns "Invalid request" response Given new "CreateGlobalVariable" request @@ -71,6 +92,27 @@ Feature: Synthetics When the request is sent Then the response status is 402 Test quota is reached + @generated @skip + Scenario: Create an API test returns "- JSON format is wrong" response + Given new "CreateSyntheticsAPITest" request + And body {} + When the request is sent + Then the response status is 400 - JSON format is wrong + + @generated @skip + Scenario: Create an API test returns "OK - Returns the created test details." response + Given new "CreateSyntheticsAPITest" request + And body {} + When the request is sent + Then the response status is 200 OK - Returns the created test details. + + @generated @skip + Scenario: Create an API test returns "Test quota is reached" response + Given new "CreateSyntheticsAPITest" request + And body {} + When the request is sent + Then the response status is 402 Test quota is reached + @generated @skip Scenario: Delete a global variable returns "JSON format is wrong" response Given new "DeleteGlobalVariable" request @@ -127,6 +169,30 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK. + @generated @skip + Scenario: Edit a browser test returns "- JSON format is wrong" response + Given new "UpdateBrowserTest" request + And request contains "public_id" parameter from "" + And body {} + When the request is sent + Then the response status is 400 - JSON format is wrong + + @generated @skip + Scenario: Edit a browser test returns "- Synthetic Monitoring is not activated for the user" response + Given new "UpdateBrowserTest" request + And request contains "public_id" parameter from "" + And body {} + When the request is sent + Then the response status is 404 - Synthetic Monitoring is not activated for the user + + @generated @skip + Scenario: Edit a browser test returns "OK" response + Given new "UpdateBrowserTest" request + And request contains "public_id" parameter from "" + And body {} + When the request is sent + Then the response status is 200 OK + @generated @skip Scenario: Edit a global variable returns "Invalid request" response Given new "EditGlobalVariable" request @@ -183,6 +249,30 @@ Feature: Synthetics When the request is sent Then the response status is 200 OK + @generated @skip + Scenario: Edit an API test returns "- JSON format is wrong" response + Given new "UpdateAPITest" request + And request contains "public_id" parameter from "" + And body {} + When the request is sent + Then the response status is 400 - JSON format is wrong + + @generated @skip + Scenario: Edit an API test returns "- Synthetic Monitoring is not activated for the user" response + Given new "UpdateAPITest" request + And request contains "public_id" parameter from "" + And body {} + When the request is sent + Then the response status is 404 - Synthetic Monitoring is not activated for the user + + @generated @skip + Scenario: Edit an API test returns "OK" response + Given new "UpdateAPITest" request + And request contains "public_id" parameter from "" + And body {} + When the request is sent + Then the response status is 200 OK + @generated @skip Scenario: Get a global variable returns "Not found" response Given new "GetGlobalVariable" request diff --git a/tests/api/v1/datadog/features/undo.json b/tests/api/v1/datadog/features/undo.json index 95d2232f2fb..3999bc525e4 100644 --- a/tests/api/v1/datadog/features/undo.json +++ b/tests/api/v1/datadog/features/undo.json @@ -826,12 +826,30 @@ "type": "unsafe" } }, + "CreateSyntheticsAPITest": { + "tag": "Synthetics" + }, + "UpdateAPITest": { + "tag": "Synthetics", + "undo": { + "type": "idempotent" + } + }, + "CreateSyntheticsBrowserTest": { + "tag": "Synthetics" + }, "GetBrowserTest": { "tag": "Synthetics", "undo": { "type": "safe" } }, + "UpdateBrowserTest": { + "tag": "Synthetics", + "undo": { + "type": "idempotent" + } + }, "GetBrowserTestLatestResults": { "tag": "Synthetics", "undo": {