Skip to content
Open
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
509 changes: 509 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Create an OAuth2 client credentials auth method returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WebhooksIntegrationApi;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateAttributes;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateData;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsCreateRequest;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsType;

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

WebhooksOAuth2ClientCredentialsCreateRequest body =
new WebhooksOAuth2ClientCredentialsCreateRequest()
.data(
new WebhooksOAuth2ClientCredentialsCreateData()
.attributes(
new WebhooksOAuth2ClientCredentialsCreateAttributes()
.accessTokenUrl("https://example.com/oauth/token")
.audience("https://api.example.com")
.clientId("my-client-id")
.clientSecret("my-client-secret")
.name("my-oauth2-auth")
.scope("read:webhooks write:webhooks"))
.type(
WebhooksOAuth2ClientCredentialsType
.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS));

try {
WebhooksOAuth2ClientCredentialsResponse result =
apiInstance.createOAuth2ClientCredentials(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling WebhooksIntegrationApi#createOAuth2ClientCredentials");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Delete an OAuth2 client credentials auth method returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WebhooksIntegrationApi;

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

try {
apiInstance.deleteOAuth2ClientCredentials("auth_method_id");
} catch (ApiException e) {
System.err.println(
"Exception when calling WebhooksIntegrationApi#deleteOAuth2ClientCredentials");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
24 changes: 24 additions & 0 deletions examples/v2/webhooks-integration/GetAllAuthMethods.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Get all auth methods returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WebhooksIntegrationApi;
import com.datadog.api.client.v2.model.WebhooksAuthMethodsResponse;

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

try {
WebhooksAuthMethodsResponse result = apiInstance.getAllAuthMethods();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WebhooksIntegrationApi#getAllAuthMethods");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Get an OAuth2 client credentials auth method returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WebhooksIntegrationApi;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse;

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

try {
WebhooksOAuth2ClientCredentialsResponse result =
apiInstance.getOAuth2ClientCredentials("auth_method_id");
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling WebhooksIntegrationApi#getOAuth2ClientCredentials");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Update an OAuth2 client credentials auth method returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WebhooksIntegrationApi;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsResponse;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsType;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateAttributes;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateData;
import com.datadog.api.client.v2.model.WebhooksOAuth2ClientCredentialsUpdateRequest;

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

WebhooksOAuth2ClientCredentialsUpdateRequest body =
new WebhooksOAuth2ClientCredentialsUpdateRequest()
.data(
new WebhooksOAuth2ClientCredentialsUpdateData()
.attributes(
new WebhooksOAuth2ClientCredentialsUpdateAttributes()
.accessTokenUrl("https://example.com/oauth/token")
.audience("https://api.example.com")
.clientId("my-client-id")
.clientSecret("my-client-secret")
.name("my-oauth2-auth")
.scope("read:webhooks write:webhooks"))
.type(
WebhooksOAuth2ClientCredentialsType
.WEBHOOKS_AUTH_METHOD_OAUTH2_CLIENT_CREDENTIALS));

try {
WebhooksOAuth2ClientCredentialsResponse result =
apiInstance.updateOAuth2ClientCredentials("auth_method_id", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling WebhooksIntegrationApi#updateOAuth2ClientCredentials");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading
Loading