|
| 1 | +// Update App Protection Level returns "OK" response |
| 2 | + |
| 3 | +import com.datadog.api.client.ApiClient; |
| 4 | +import com.datadog.api.client.ApiException; |
| 5 | +import com.datadog.api.client.v2.api.AppBuilderApi; |
| 6 | +import com.datadog.api.client.v2.model.AppProtectionLevel; |
| 7 | +import com.datadog.api.client.v2.model.AppProtectionLevelType; |
| 8 | +import com.datadog.api.client.v2.model.UpdateAppProtectionLevelRequest; |
| 9 | +import com.datadog.api.client.v2.model.UpdateAppProtectionLevelRequestData; |
| 10 | +import com.datadog.api.client.v2.model.UpdateAppProtectionLevelRequestDataAttributes; |
| 11 | +import com.datadog.api.client.v2.model.UpdateAppResponse; |
| 12 | +import java.util.UUID; |
| 13 | + |
| 14 | +public class Example { |
| 15 | + public static void main(String[] args) { |
| 16 | + ApiClient defaultClient = ApiClient.getDefaultApiClient(); |
| 17 | + AppBuilderApi apiInstance = new AppBuilderApi(defaultClient); |
| 18 | + |
| 19 | + UpdateAppProtectionLevelRequest body = |
| 20 | + new UpdateAppProtectionLevelRequest() |
| 21 | + .data( |
| 22 | + new UpdateAppProtectionLevelRequestData() |
| 23 | + .attributes( |
| 24 | + new UpdateAppProtectionLevelRequestDataAttributes() |
| 25 | + .protectionLevel(AppProtectionLevel.APPROVAL_REQUIRED)) |
| 26 | + .type(AppProtectionLevelType.PROTECTIONLEVEL)); |
| 27 | + |
| 28 | + try { |
| 29 | + UpdateAppResponse result = |
| 30 | + apiInstance.updateProtectionLevel( |
| 31 | + UUID.fromString("65bb1f25-52e1-4510-9f8d-22d1516ed693"), body); |
| 32 | + System.out.println(result); |
| 33 | + } catch (ApiException e) { |
| 34 | + System.err.println("Exception when calling AppBuilderApi#updateProtectionLevel"); |
| 35 | + System.err.println("Status code: " + e.getCode()); |
| 36 | + System.err.println("Reason: " + e.getResponseBody()); |
| 37 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 38 | + e.printStackTrace(); |
| 39 | + } |
| 40 | + } |
| 41 | +} |
0 commit comments