Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to list Synthetics global variables #846

Merged
merged 1 commit into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.4.1.dev8",
"regenerated": "2021-05-27 15:02:20.898155",
"spec_repo_commit": "5311d4c"
"regenerated": "2021-05-28 09:09:22.558428",
"spec_repo_commit": "2a54e42"
},
"v2": {
"apigentools_version": "1.4.1.dev8",
"regenerated": "2021-05-27 15:03:05.467253",
"spec_repo_commit": "5311d4c"
"regenerated": "2021-05-28 09:10:03.554780",
"spec_repo_commit": "2a54e42"
}
}
}
2 changes: 2 additions & 0 deletions api_docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Class | Method | HTTP request | Description
*SyntheticsApi* | [**getGlobalVariable**](SyntheticsApi.md#getGlobalVariable) | **GET** /api/v1/synthetics/variables/{variable_id} | Get a global variable
*SyntheticsApi* | [**getPrivateLocation**](SyntheticsApi.md#getPrivateLocation) | **GET** /api/v1/synthetics/private-locations/{location_id} | Get a private location
*SyntheticsApi* | [**getTest**](SyntheticsApi.md#getTest) | **GET** /api/v1/synthetics/tests/{public_id} | Get a test configuration
*SyntheticsApi* | [**listGlobalVariables**](SyntheticsApi.md#listGlobalVariables) | **GET** /api/v1/synthetics/variables | Get all global variables
*SyntheticsApi* | [**listLocations**](SyntheticsApi.md#listLocations) | **GET** /api/v1/synthetics/locations | Get all locations (public and private)
*SyntheticsApi* | [**listTests**](SyntheticsApi.md#listTests) | **GET** /api/v1/synthetics/tests | Get the list of all tests
*SyntheticsApi* | [**triggerCITests**](SyntheticsApi.md#triggerCITests) | **POST** /api/v1/synthetics/tests/trigger/ci | Trigger tests from CI/CD pipelines
Expand Down Expand Up @@ -592,6 +593,7 @@ Class | Method | HTTP request | Description
- [SyntheticsGlobalVariableParseTestOptionsType](SyntheticsGlobalVariableParseTestOptionsType.md)
- [SyntheticsGlobalVariableParserType](SyntheticsGlobalVariableParserType.md)
- [SyntheticsGlobalVariableValue](SyntheticsGlobalVariableValue.md)
- [SyntheticsListGlobalVariablesResponse](SyntheticsListGlobalVariablesResponse.md)
- [SyntheticsListTestsResponse](SyntheticsListTestsResponse.md)
- [SyntheticsLocation](SyntheticsLocation.md)
- [SyntheticsLocations](SyntheticsLocations.md)
Expand Down
60 changes: 60 additions & 0 deletions api_docs/v1/SyntheticsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Method | HTTP request | Description
[**getGlobalVariable**](SyntheticsApi.md#getGlobalVariable) | **GET** /api/v1/synthetics/variables/{variable_id} | Get a global variable
[**getPrivateLocation**](SyntheticsApi.md#getPrivateLocation) | **GET** /api/v1/synthetics/private-locations/{location_id} | Get a private location
[**getTest**](SyntheticsApi.md#getTest) | **GET** /api/v1/synthetics/tests/{public_id} | Get a test configuration
[**listGlobalVariables**](SyntheticsApi.md#listGlobalVariables) | **GET** /api/v1/synthetics/variables | Get all global variables
[**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 tests from CI/CD pipelines
Expand Down Expand Up @@ -1145,6 +1146,65 @@ Name | Type | Description | Notes
| **404** | - Synthetic is not activated for the user - Test is not owned by the user | - |


## listGlobalVariables

> SyntheticsListGlobalVariablesResponse listGlobalVariables();

Get the list of all Synthetics global variables.

### Example

```java
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.SyntheticsApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();

SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);
try {
SyntheticsListGlobalVariablesResponse result = apiInstance.listGlobalVariables();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#listGlobalVariables");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

This endpoint does not need any parameter.

### Return type

[**SyntheticsListGlobalVariablesResponse**](SyntheticsListGlobalVariablesResponse.md)

### Authorization

[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | OK | - |
| **403** | Forbidden | - |


## listLocations

> SyntheticsLocations listLocations();
Expand Down
14 changes: 14 additions & 0 deletions api_docs/v1/SyntheticsListGlobalVariablesResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# SyntheticsListGlobalVariablesResponse

Object containing an array of Synthetic global variables.

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**variables** | [**List<SyntheticsGlobalVariable>**](SyntheticsGlobalVariable.md) | Array of Synthetic global variables. | [optional]



72 changes: 72 additions & 0 deletions src/main/java/com/datadog/api/v1/client/api/SyntheticsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.datadog.api.v1.client.model.SyntheticsGetAPITestLatestResultsResponse;
import com.datadog.api.v1.client.model.SyntheticsGetBrowserTestLatestResultsResponse;
import com.datadog.api.v1.client.model.SyntheticsGlobalVariable;
import com.datadog.api.v1.client.model.SyntheticsListGlobalVariablesResponse;
import com.datadog.api.v1.client.model.SyntheticsListTestsResponse;
import com.datadog.api.v1.client.model.SyntheticsLocations;
import com.datadog.api.v1.client.model.SyntheticsPrivateLocation;
Expand Down Expand Up @@ -1638,6 +1639,77 @@ public ApiResponse<SyntheticsTestDetails> getTestWithHttpInfo(String publicId)
false);
}

/**
* Get all global variables Get the list of all Synthetics global variables.
*
* @return SyntheticsListGlobalVariablesResponse
* @throws ApiException if fails to make API call
* @http.response.details
* <table summary="Response Details" border="1">
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
* </table>
*/
public SyntheticsListGlobalVariablesResponse listGlobalVariables() throws ApiException {
return listGlobalVariablesWithHttpInfo().getData();
}

/**
* Get all global variables Get the list of all Synthetics global variables.
*
* @return ApiResponse&lt;SyntheticsListGlobalVariablesResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table summary="Response Details" border="1">
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
* </table>
*/
public ApiResponse<SyntheticsListGlobalVariablesResponse> listGlobalVariablesWithHttpInfo()
throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/api/v1/synthetics/variables";

// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

// Set Operation-ID header for telemetry
localVarHeaderParams.put("DD-OPERATION-ID", "listGlobalVariables");

final String[] localVarAccepts = {"application/json"};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

final String[] localVarContentTypes = {};

final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] {"apiKeyAuth", "appKeyAuth"};

GenericType<SyntheticsListGlobalVariablesResponse> localVarReturnType =
new GenericType<SyntheticsListGlobalVariablesResponse>() {};

return apiClient.invokeAPI(
"SyntheticsApi.listGlobalVariables",
localVarPath,
"GET",
localVarQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType,
false);
}

/**
* Get all locations (public and private) Get the list of public and private locations available
* for Synthetic tests. No arguments required.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* 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.
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package com.datadog.api.v1.client.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/** Object containing an array of Synthetic global variables. */
@ApiModel(description = "Object containing an array of Synthetic global variables.")
@JsonPropertyOrder({SyntheticsListGlobalVariablesResponse.JSON_PROPERTY_VARIABLES})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SyntheticsListGlobalVariablesResponse {
public static final String JSON_PROPERTY_VARIABLES = "variables";
private List<SyntheticsGlobalVariable> variables = null;

public SyntheticsListGlobalVariablesResponse variables(List<SyntheticsGlobalVariable> variables) {
this.variables = variables;
return this;
}

public SyntheticsListGlobalVariablesResponse addVariablesItem(
SyntheticsGlobalVariable variablesItem) {
if (this.variables == null) {
this.variables = new ArrayList<>();
}
this.variables.add(variablesItem);
return this;
}

/**
* Array of Synthetic global variables.
*
* @return variables
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "Array of Synthetic global variables.")
@JsonProperty(JSON_PROPERTY_VARIABLES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<SyntheticsGlobalVariable> getVariables() {
return variables;
}

public void setVariables(List<SyntheticsGlobalVariable> variables) {
this.variables = variables;
}

/** Return true if this SyntheticsListGlobalVariablesResponse object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SyntheticsListGlobalVariablesResponse syntheticsListGlobalVariablesResponse =
(SyntheticsListGlobalVariablesResponse) o;
return Objects.equals(this.variables, syntheticsListGlobalVariablesResponse.variables);
}

@Override
public int hashCode() {
return Objects.hash(variables);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SyntheticsListGlobalVariablesResponse {\n");
sb.append(" variables: ").append(toIndentedString(variables)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Loading