From e326b2cd552c5f581512e775c0b78038e1bf2f01 Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Mon, 21 Nov 2016 15:50:27 -0800 Subject: [PATCH 1/2] AutoRest generated code. --- .../cdn/CheckNameAvailabilityInput.java | 76 + .../cdn/CustomDomainParameters.java | 45 + .../cdn/CustomDomainResourceState.java | 62 + .../management/cdn/DeepCreatedOrigin.java | 124 ++ .../management/cdn/EndpointResourceState.java | 71 + .../azure/management/cdn/ErrorResponse.java | 67 + .../cdn/ErrorResponseException.java | 87 + .../azure/management/cdn/GeoFilter.java | 97 + .../management/cdn/GeoFilterActions.java | 53 + .../azure/management/cdn/LoadParameters.java | 44 + .../management/cdn/OperationDisplay.java | 91 + .../management/cdn/OriginResourceState.java | 62 + .../management/cdn/ProfileResourceState.java | 65 + .../cdn/ProfileUpdateParameters.java | 44 + .../azure/management/cdn/PurgeParameters.java | 45 + .../cdn/QueryStringCachingBehavior.java | 59 + .../azure/management/cdn/ResourceType.java | 50 + .../microsoft/azure/management/cdn/Sku.java | 43 + .../azure/management/cdn/SkuName.java | 68 + .../cdn/ValidateCustomDomainInput.java | 43 + .../CdnManagementClientImpl.java | 565 ++++++ .../CheckNameAvailabilityOutputInner.java | 95 + .../cdn/implementation/CustomDomainInner.java | 108 ++ .../implementation/CustomDomainsInner.java | 779 ++++++++ .../cdn/implementation/EndpointInner.java | 346 ++++ .../EndpointUpdateParametersInner.java | 292 +++ .../cdn/implementation/EndpointsInner.java | 1714 +++++++++++++++++ .../cdn/implementation/OperationInner.java | 67 + .../cdn/implementation/OriginInner.java | 134 ++ .../OriginUpdateParametersInner.java | 98 + .../cdn/implementation/OriginsInner.java | 594 ++++++ .../cdn/implementation/PageImpl.java | 75 + .../cdn/implementation/ProfileInner.java | 82 + .../cdn/implementation/ProfilesInner.java | 1159 +++++++++++ .../cdn/implementation/SsoUriInner.java | 41 + .../ValidateCustomDomainOutputInner.java | 91 + 36 files changed, 7536 insertions(+) create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityInput.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainParameters.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainResourceState.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/DeepCreatedOrigin.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/EndpointResourceState.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponse.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponseException.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilter.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilterActions.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/LoadParameters.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OperationDisplay.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OriginResourceState.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileResourceState.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileUpdateParameters.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/PurgeParameters.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/QueryStringCachingBehavior.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ResourceType.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Sku.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/SkuName.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ValidateCustomDomainInput.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManagementClientImpl.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CheckNameAvailabilityOutputInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainsInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointUpdateParametersInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointsInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OperationInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginUpdateParametersInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginsInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/PageImpl.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfileInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfilesInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/SsoUriInner.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ValidateCustomDomainOutputInner.java diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityInput.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityInput.java new file mode 100644 index 000000000000..57f522562fb6 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityInput.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input of CheckNameAvailability API. + */ +public class CheckNameAvailabilityInput { + /** + * The resource name to validate. + */ + @JsonProperty(required = true) + private String name; + + /** + * The type of the resource whose name is to be validated. + */ + @JsonProperty(required = true) + private String type; + + /** + * Creates an instance of CheckNameAvailabilityInput class. + */ + public CheckNameAvailabilityInput() { + type = "Microsoft.Cdn/Profiles/Endpoints"; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the CheckNameAvailabilityInput object itself. + */ + public CheckNameAvailabilityInput withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the CheckNameAvailabilityInput object itself. + */ + public CheckNameAvailabilityInput withType(String type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainParameters.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainParameters.java new file mode 100644 index 000000000000..76c4ad6691b4 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainParameters.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The customDomain JSON object required for custom domain creation or update. + */ +@JsonFlatten +public class CustomDomainParameters { + /** + * The host name of the custom domain. Must be a domain name. + */ + @JsonProperty(value = "properties.hostName", required = true) + private String hostName; + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set the hostName value. + * + * @param hostName the hostName value to set + * @return the CustomDomainParameters object itself. + */ + public CustomDomainParameters withHostName(String hostName) { + this.hostName = hostName; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainResourceState.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainResourceState.java new file mode 100644 index 000000000000..9049d8c75cae --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainResourceState.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CustomDomainResourceState. + */ +public final class CustomDomainResourceState { + /** Static value Creating for CustomDomainResourceState. */ + public static final CustomDomainResourceState CREATING = new CustomDomainResourceState("Creating"); + + /** Static value Active for CustomDomainResourceState. */ + public static final CustomDomainResourceState ACTIVE = new CustomDomainResourceState("Active"); + + /** Static value Deleting for CustomDomainResourceState. */ + public static final CustomDomainResourceState DELETING = new CustomDomainResourceState("Deleting"); + + private String value; + + /** + * Creates a custom value for CustomDomainResourceState. + * @param value the custom value + */ + public CustomDomainResourceState(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof CustomDomainResourceState)) { + return false; + } + if (obj == this) { + return true; + } + CustomDomainResourceState rhs = (CustomDomainResourceState) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/DeepCreatedOrigin.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/DeepCreatedOrigin.java new file mode 100644 index 000000000000..5a0adb4fe872 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/DeepCreatedOrigin.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Origins to be added when creating a CDN endpoint. + */ +@JsonFlatten +public class DeepCreatedOrigin { + /** + * Origin name. + */ + @JsonProperty(required = true) + private String name; + + /** + * The address of the origin. Domain names, IPv4 addresses, and IPv6 + * addresses are supported. + */ + @JsonProperty(value = "properties.hostName", required = true) + private String hostName; + + /** + * The value of the HTTP port. Must be between 1 and 65535. + */ + @JsonProperty(value = "properties.httpPort") + private Integer httpPort; + + /** + * The value of the HTTPS port. Must be between 1 and 65535. + */ + @JsonProperty(value = "properties.httpsPort") + private Integer httpsPort; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the DeepCreatedOrigin object itself. + */ + public DeepCreatedOrigin withName(String name) { + this.name = name; + return this; + } + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set the hostName value. + * + * @param hostName the hostName value to set + * @return the DeepCreatedOrigin object itself. + */ + public DeepCreatedOrigin withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get the httpPort value. + * + * @return the httpPort value + */ + public Integer httpPort() { + return this.httpPort; + } + + /** + * Set the httpPort value. + * + * @param httpPort the httpPort value to set + * @return the DeepCreatedOrigin object itself. + */ + public DeepCreatedOrigin withHttpPort(Integer httpPort) { + this.httpPort = httpPort; + return this; + } + + /** + * Get the httpsPort value. + * + * @return the httpsPort value + */ + public Integer httpsPort() { + return this.httpsPort; + } + + /** + * Set the httpsPort value. + * + * @param httpsPort the httpsPort value to set + * @return the DeepCreatedOrigin object itself. + */ + public DeepCreatedOrigin withHttpsPort(Integer httpsPort) { + this.httpsPort = httpsPort; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/EndpointResourceState.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/EndpointResourceState.java new file mode 100644 index 000000000000..ba1e65615192 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/EndpointResourceState.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EndpointResourceState. + */ +public final class EndpointResourceState { + /** Static value Creating for EndpointResourceState. */ + public static final EndpointResourceState CREATING = new EndpointResourceState("Creating"); + + /** Static value Deleting for EndpointResourceState. */ + public static final EndpointResourceState DELETING = new EndpointResourceState("Deleting"); + + /** Static value Running for EndpointResourceState. */ + public static final EndpointResourceState RUNNING = new EndpointResourceState("Running"); + + /** Static value Starting for EndpointResourceState. */ + public static final EndpointResourceState STARTING = new EndpointResourceState("Starting"); + + /** Static value Stopped for EndpointResourceState. */ + public static final EndpointResourceState STOPPED = new EndpointResourceState("Stopped"); + + /** Static value Stopping for EndpointResourceState. */ + public static final EndpointResourceState STOPPING = new EndpointResourceState("Stopping"); + + private String value; + + /** + * Creates a custom value for EndpointResourceState. + * @param value the custom value + */ + public EndpointResourceState(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof EndpointResourceState)) { + return false; + } + if (obj == this) { + return true; + } + EndpointResourceState rhs = (EndpointResourceState) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponse.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponse.java new file mode 100644 index 000000000000..6ce3ad2d2fa3 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponse.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + + +/** + * Error reponse indicates CDN service is not able to process the incoming + * request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * Error code. + */ + private String code; + + /** + * Error message indicating why the operation failed. + */ + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponseException.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponseException.java new file mode 100644 index 000000000000..e81e624a3ae3 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ErrorResponseException.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.microsoft.rest.RestException; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Information about the associated HTTP response. + */ + private Response response; + /** + * The actual response body. + */ + private ErrorResponse body; + /** + * Initializes a new instance of the ErrorResponseException class. + */ + public ErrorResponseException() { } + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message The exception message. + */ + public ErrorResponseException(final String message) { + super(message); + } + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message + * @param cause exception that caused this exception to occur + */ + public ErrorResponseException(final String message, final Throwable cause) { + super(message, cause); + } + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param cause exception that caused this exception to occur + */ + public ErrorResponseException(final Throwable cause) { + super(cause); + } + /** + * Gets information about the associated HTTP response. + * + * @return the HTTP response + */ + public Response getResponse() { + return response; + } + /** + * Gets the HTTP response body. + * + * @return the response body + */ + public ErrorResponse getBody() { + return body; + } + /** + * Sets the HTTP response. + * + * @param response the HTTP response + */ + public void setResponse(Response response) { + this.response = response; + } + /** + * Sets the HTTP response body. + * + * @param body the response body + */ + public void setBody(ErrorResponse body) { + this.body = body; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilter.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilter.java new file mode 100644 index 000000000000..6f43755b4169 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilter.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Geo filter of a CDN endpoint. + */ +public class GeoFilter { + /** + * Relative path applicable to geo filter. (e.g. '/mypictures', + * '/mypicture/kitty.jpg', and etc.). + */ + @JsonProperty(required = true) + private String relativePath; + + /** + * Action of the geo filter. Possible values include: 'Block', 'Allow'. + */ + @JsonProperty(required = true) + private GeoFilterActions action; + + /** + * Two letter country codes of the geo filter. (e.g. AU, MX, and etc.). + */ + @JsonProperty(required = true) + private List countryCodes; + + /** + * Get the relativePath value. + * + * @return the relativePath value + */ + public String relativePath() { + return this.relativePath; + } + + /** + * Set the relativePath value. + * + * @param relativePath the relativePath value to set + * @return the GeoFilter object itself. + */ + public GeoFilter withRelativePath(String relativePath) { + this.relativePath = relativePath; + return this; + } + + /** + * Get the action value. + * + * @return the action value + */ + public GeoFilterActions action() { + return this.action; + } + + /** + * Set the action value. + * + * @param action the action value to set + * @return the GeoFilter object itself. + */ + public GeoFilter withAction(GeoFilterActions action) { + this.action = action; + return this; + } + + /** + * Get the countryCodes value. + * + * @return the countryCodes value + */ + public List countryCodes() { + return this.countryCodes; + } + + /** + * Set the countryCodes value. + * + * @param countryCodes the countryCodes value to set + * @return the GeoFilter object itself. + */ + public GeoFilter withCountryCodes(List countryCodes) { + this.countryCodes = countryCodes; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilterActions.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilterActions.java new file mode 100644 index 000000000000..5377dc681235 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/GeoFilterActions.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for GeoFilterActions. + */ +public enum GeoFilterActions { + /** Enum value Block. */ + BLOCK("Block"), + + /** Enum value Allow. */ + ALLOW("Allow"); + + /** The actual serialized value for a GeoFilterActions instance. */ + private String value; + + GeoFilterActions(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GeoFilterActions instance. + * + * @param value the serialized value to parse. + * @return the parsed GeoFilterActions object, or null if unable to parse. + */ + @JsonCreator + public static GeoFilterActions fromString(String value) { + GeoFilterActions[] items = GeoFilterActions.values(); + for (GeoFilterActions item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/LoadParameters.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/LoadParameters.java new file mode 100644 index 000000000000..535de63a3318 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/LoadParameters.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters required for endpoint load. + */ +public class LoadParameters { + /** + * The path to the content to be loaded. Should describe a file path. + */ + @JsonProperty(required = true) + private List contentPaths; + + /** + * Get the contentPaths value. + * + * @return the contentPaths value + */ + public List contentPaths() { + return this.contentPaths; + } + + /** + * Set the contentPaths value. + * + * @param contentPaths the contentPaths value to set + * @return the LoadParameters object itself. + */ + public LoadParameters withContentPaths(List contentPaths) { + this.contentPaths = contentPaths; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OperationDisplay.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OperationDisplay.java new file mode 100644 index 000000000000..9e5ff82202cd --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OperationDisplay.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Cdn. + */ + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + private String operation; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation value. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OriginResourceState.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OriginResourceState.java new file mode 100644 index 000000000000..97b077d46f52 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/OriginResourceState.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OriginResourceState. + */ +public final class OriginResourceState { + /** Static value Creating for OriginResourceState. */ + public static final OriginResourceState CREATING = new OriginResourceState("Creating"); + + /** Static value Active for OriginResourceState. */ + public static final OriginResourceState ACTIVE = new OriginResourceState("Active"); + + /** Static value Deleting for OriginResourceState. */ + public static final OriginResourceState DELETING = new OriginResourceState("Deleting"); + + private String value; + + /** + * Creates a custom value for OriginResourceState. + * @param value the custom value + */ + public OriginResourceState(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof OriginResourceState)) { + return false; + } + if (obj == this) { + return true; + } + OriginResourceState rhs = (OriginResourceState) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileResourceState.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileResourceState.java new file mode 100644 index 000000000000..8c8bb0298a5f --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileResourceState.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProfileResourceState. + */ +public final class ProfileResourceState { + /** Static value Creating for ProfileResourceState. */ + public static final ProfileResourceState CREATING = new ProfileResourceState("Creating"); + + /** Static value Active for ProfileResourceState. */ + public static final ProfileResourceState ACTIVE = new ProfileResourceState("Active"); + + /** Static value Deleting for ProfileResourceState. */ + public static final ProfileResourceState DELETING = new ProfileResourceState("Deleting"); + + /** Static value Disabled for ProfileResourceState. */ + public static final ProfileResourceState DISABLED = new ProfileResourceState("Disabled"); + + private String value; + + /** + * Creates a custom value for ProfileResourceState. + * @param value the custom value + */ + public ProfileResourceState(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ProfileResourceState)) { + return false; + } + if (obj == this) { + return true; + } + ProfileResourceState rhs = (ProfileResourceState) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileUpdateParameters.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileUpdateParameters.java new file mode 100644 index 000000000000..b1560037484c --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ProfileUpdateParameters.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile properties required for profile update. + */ +public class ProfileUpdateParameters { + /** + * Profile tags. + */ + @JsonProperty(required = true) + private Map tags; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ProfileUpdateParameters object itself. + */ + public ProfileUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/PurgeParameters.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/PurgeParameters.java new file mode 100644 index 000000000000..dd0b4bc77b06 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/PurgeParameters.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters required for endpoint purge. + */ +public class PurgeParameters { + /** + * The path to the content to be purged. Can describe a file path or a + * wild card directory. + */ + @JsonProperty(required = true) + private List contentPaths; + + /** + * Get the contentPaths value. + * + * @return the contentPaths value + */ + public List contentPaths() { + return this.contentPaths; + } + + /** + * Set the contentPaths value. + * + * @param contentPaths the contentPaths value to set + * @return the PurgeParameters object itself. + */ + public PurgeParameters withContentPaths(List contentPaths) { + this.contentPaths = contentPaths; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/QueryStringCachingBehavior.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/QueryStringCachingBehavior.java new file mode 100644 index 000000000000..0f54358c64ff --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/QueryStringCachingBehavior.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for QueryStringCachingBehavior. + */ +public enum QueryStringCachingBehavior { + /** Enum value IgnoreQueryString. */ + IGNORE_QUERY_STRING("IgnoreQueryString"), + + /** Enum value BypassCaching. */ + BYPASS_CACHING("BypassCaching"), + + /** Enum value UseQueryString. */ + USE_QUERY_STRING("UseQueryString"), + + /** Enum value NotSet. */ + NOT_SET("NotSet"); + + /** The actual serialized value for a QueryStringCachingBehavior instance. */ + private String value; + + QueryStringCachingBehavior(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a QueryStringCachingBehavior instance. + * + * @param value the serialized value to parse. + * @return the parsed QueryStringCachingBehavior object, or null if unable to parse. + */ + @JsonCreator + public static QueryStringCachingBehavior fromString(String value) { + QueryStringCachingBehavior[] items = QueryStringCachingBehavior.values(); + for (QueryStringCachingBehavior item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ResourceType.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ResourceType.java new file mode 100644 index 000000000000..69780c33acd7 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ResourceType.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceType. + */ +public enum ResourceType { + /** Enum value Microsoft.Cdn/Profiles/Endpoints. */ + MICROSOFT_CDN_PROFILES_ENDPOINTS("Microsoft.Cdn/Profiles/Endpoints"); + + /** The actual serialized value for a ResourceType instance. */ + private String value; + + ResourceType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceType fromString(String value) { + ResourceType[] items = ResourceType.values(); + for (ResourceType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Sku.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Sku.java new file mode 100644 index 000000000000..cd3c0110b0e2 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Sku.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + + +/** + * The SKU (pricing tier) of the CDN profile. + */ +public class Sku { + /** + * Name of the pricing tier. Possible values include: 'Standard_Verizon', + * 'Premium_Verizon', 'Custom_Verizon', 'Standard_Akamai', + * 'Standard_ChinaCdn'. + */ + private SkuName name; + + /** + * Get the name value. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/SkuName.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/SkuName.java new file mode 100644 index 000000000000..d4203e2ee446 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/SkuName.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuName. + */ +public final class SkuName { + /** Static value Standard_Verizon for SkuName. */ + public static final SkuName STANDARD_VERIZON = new SkuName("Standard_Verizon"); + + /** Static value Premium_Verizon for SkuName. */ + public static final SkuName PREMIUM_VERIZON = new SkuName("Premium_Verizon"); + + /** Static value Custom_Verizon for SkuName. */ + public static final SkuName CUSTOM_VERIZON = new SkuName("Custom_Verizon"); + + /** Static value Standard_Akamai for SkuName. */ + public static final SkuName STANDARD_AKAMAI = new SkuName("Standard_Akamai"); + + /** Static value Standard_ChinaCdn for SkuName. */ + public static final SkuName STANDARD_CHINA_CDN = new SkuName("Standard_ChinaCdn"); + + private String value; + + /** + * Creates a custom value for SkuName. + * @param value the custom value + */ + public SkuName(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof SkuName)) { + return false; + } + if (obj == this) { + return true; + } + SkuName rhs = (SkuName) obj; + if (value == null) { + return rhs.value == null; + } else { + return value.equals(rhs.value); + } + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ValidateCustomDomainInput.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ValidateCustomDomainInput.java new file mode 100644 index 000000000000..fc6bbdb7e612 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/ValidateCustomDomainInput.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input of the custom domain to be validated. + */ +public class ValidateCustomDomainInput { + /** + * The host name of the custom domain. Must be a domain name. + */ + @JsonProperty(required = true) + private String hostName; + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set the hostName value. + * + * @param hostName the hostName value to set + * @return the ValidateCustomDomainInput object itself. + */ + public ValidateCustomDomainInput withHostName(String hostName) { + this.hostName = hostName; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManagementClientImpl.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManagementClientImpl.java new file mode 100644 index 000000000000..39e7444ef9b7 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManagementClientImpl.java @@ -0,0 +1,565 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceCall; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.cdn.CheckNameAvailabilityInput; +import com.microsoft.azure.management.cdn.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the CdnManagementClientImpl class. + */ +public final class CdnManagementClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private CdnManagementClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public CdnManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of the API to be used with the client request. Current version is 2016-10-02. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. Current version is 2016-10-02. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public CdnManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public CdnManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public CdnManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ProfilesInner object to access its operations. + */ + private ProfilesInner profiles; + + /** + * Gets the ProfilesInner object to access its operations. + * @return the ProfilesInner object. + */ + public ProfilesInner profiles() { + return this.profiles; + } + + /** + * The EndpointsInner object to access its operations. + */ + private EndpointsInner endpoints; + + /** + * Gets the EndpointsInner object to access its operations. + * @return the EndpointsInner object. + */ + public EndpointsInner endpoints() { + return this.endpoints; + } + + /** + * The OriginsInner object to access its operations. + */ + private OriginsInner origins; + + /** + * Gets the OriginsInner object to access its operations. + * @return the OriginsInner object. + */ + public OriginsInner origins() { + return this.origins; + } + + /** + * The CustomDomainsInner object to access its operations. + */ + private CustomDomainsInner customDomains; + + /** + * Gets the CustomDomainsInner object to access its operations. + * @return the CustomDomainsInner object. + */ + public CustomDomainsInner customDomains() { + return this.customDomains; + } + + /** + * Initializes an instance of CdnManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public CdnManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of CdnManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public CdnManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + this(new RestClient.Builder() + .withBaseUrl(baseUrl) + .withCredentials(credentials) + .build()); + } + + /** + * Initializes an instance of CdnManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public CdnManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2016-10-02"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.profiles = new ProfilesInner(restClient().retrofit(), this); + this.endpoints = new EndpointsInner(restClient().retrofit(), this); + this.origins = new OriginsInner(restClient().retrofit(), this); + this.customDomains = new CustomDomainsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("Azure-SDK-For-Java/%s (%s)", + getClass().getPackage().getImplementationVersion(), + "CdnManagementClient, 2016-10-02"); + } + + private void initializeService() { + service = restClient().retrofit().create(CdnManagementClientService.class); + } + + /** + * The interface defining all the services for CdnManagementClient to be + * used by Retrofit to perform actually REST calls. + */ + interface CdnManagementClientService { + @Headers("Content-Type: application/json; charset=utf-8") + @POST("providers/Microsoft.Cdn/checkNameAvailability") + Observable> checkNameAvailability(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckNameAvailabilityInput checkNameAvailabilityInput, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("providers/Microsoft.Cdn/operations") + Observable> listOperations(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("{nextLink}") + Observable> listOperationsNext(@Path(value = "nextLink", encoded = true) String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Check the availability of a resource name without creating the resource. This is needed for resources where name is globally unique, such as a CDN endpoint. + * + * @param name The resource name to validate. + * @return the CheckNameAvailabilityOutputInner object if successful. + */ + public CheckNameAvailabilityOutputInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().getBody(); + } + + /** + * Check the availability of a resource name without creating the resource. This is needed for resources where name is globally unique, such as a CDN endpoint. + * + * @param name The resource name to validate. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceCall.create(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Check the availability of a resource name without creating the resource. This is needed for resources where name is globally unique, such as a CDN endpoint. + * + * @param name The resource name to validate. + * @return the observable to the CheckNameAvailabilityOutputInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityOutputInner>() { + @Override + public CheckNameAvailabilityOutputInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Check the availability of a resource name without creating the resource. This is needed for resources where name is globally unique, such as a CDN endpoint. + * + * @param name The resource name to validate. + * @return the observable to the CheckNameAvailabilityOutputInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + CheckNameAvailabilityInput checkNameAvailabilityInput = new CheckNameAvailabilityInput(); + checkNameAvailabilityInput.withName(name); + return service.checkNameAvailability(this.apiVersion(), this.acceptLanguage(), checkNameAvailabilityInput, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listOperations() { + ServiceResponse> response = listOperationsSinglePageAsync().toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists all of the available CDN REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listOperationsAsync(final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listOperationsSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listOperationsAsync() { + return listOperationsWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listOperationsWithServiceResponseAsync() { + return listOperationsSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOperationsSinglePageAsync() { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + return service.listOperations(this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOperationsDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOperationsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listOperationsNext(final String nextPageLink) { + ServiceResponse> response = listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists all of the available CDN REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listOperationsNextAsync(final String nextPageLink, final ServiceCall> serviceCall, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listOperationsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listOperationsNextAsync(final String nextPageLink) { + return listOperationsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists all of the available CDN REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listOperationsNextWithServiceResponseAsync(final String nextPageLink) { + return listOperationsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available CDN REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOperationsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + return service.listOperationsNext(nextPageLink, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOperationsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOperationsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CheckNameAvailabilityOutputInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CheckNameAvailabilityOutputInner.java new file mode 100644 index 000000000000..a19691899ecd --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CheckNameAvailabilityOutputInner.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Output of check name availability API. + */ +public class CheckNameAvailabilityOutputInner { + /** + * Indicates whether the name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * The reason why the name is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * The detailed error message describing why the name is not available. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable value. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable value. + * + * @param nameAvailable the nameAvailable value to set + * @return the CheckNameAvailabilityOutputInner object itself. + */ + public CheckNameAvailabilityOutputInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason value. + * + * @param reason the reason value to set + * @return the CheckNameAvailabilityOutputInner object itself. + */ + public CheckNameAvailabilityOutputInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the CheckNameAvailabilityOutputInner object itself. + */ + public CheckNameAvailabilityOutputInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainInner.java new file mode 100644 index 000000000000..45b44bfe2396 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainInner.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.management.cdn.CustomDomainResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * CDN CustomDomain represents a mapping between a user-specified domain name + * and a CDN endpoint. This is to use custom domain names to represent the + * URLs for branding purposes. + */ +@JsonFlatten +public class CustomDomainInner extends Resource { + /** + * The host name of the custom domain. Must be a domain name. + */ + @JsonProperty(value = "properties.hostName", required = true) + private String hostName; + + /** + * Resource status of the custom domain. Possible values include: + * 'Creating', 'Active', 'Deleting'. + */ + @JsonProperty(value = "properties.resourceState", access = JsonProperty.Access.WRITE_ONLY) + private CustomDomainResourceState resourceState; + + /** + * Special validation or data may be required when delivering CDN to some + * regions due to local compliance reasons. (e.g. ICP license number of a + * custom domain is required to deliver content in China.). + */ + @JsonProperty(value = "properties.validationData") + private String validationData; + + /** + * Provisioning status of the custom domain. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set the hostName value. + * + * @param hostName the hostName value to set + * @return the CustomDomainInner object itself. + */ + public CustomDomainInner withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get the resourceState value. + * + * @return the resourceState value + */ + public CustomDomainResourceState resourceState() { + return this.resourceState; + } + + /** + * Get the validationData value. + * + * @return the validationData value + */ + public String validationData() { + return this.validationData; + } + + /** + * Set the validationData value. + * + * @param validationData the validationData value to set + * @return the CustomDomainInner object itself. + */ + public CustomDomainInner withValidationData(String validationData) { + this.validationData = validationData; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainsInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainsInner.java new file mode 100644 index 000000000000..e3b14a8df429 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CustomDomainsInner.java @@ -0,0 +1,779 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceCall; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.cdn.CustomDomainParameters; +import com.microsoft.azure.management.cdn.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CustomDomains. + */ +public final class CustomDomainsInner { + /** The Retrofit service to perform REST calls. */ + private CustomDomainsService service; + /** The service client containing this operation class. */ + private CdnManagementClientImpl client; + + /** + * Initializes an instance of CustomDomainsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomDomainsInner(Retrofit retrofit, CdnManagementClientImpl client) { + this.service = retrofit.create(CustomDomainsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CustomDomains to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomDomainsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains") + Observable> listByEndpoint(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("customDomainName") String customDomainName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("customDomainName") String customDomainName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CustomDomainParameters customDomainProperties, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("customDomainName") String customDomainName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CustomDomainParameters customDomainProperties, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("customDomainName") String customDomainName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("customDomainName") String customDomainName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("{nextLink}") + Observable> listByEndpointNext(@Path(value = "nextLink", encoded = true) String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the PagedList<CustomDomainInner> object if successful. + */ + public PagedList listByEndpoint(final String resourceGroupName, final String profileName, final String endpointName) { + ServiceResponse> response = listByEndpointSinglePageAsync(resourceGroupName, profileName, endpointName).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByEndpointAsync(final String resourceGroupName, final String profileName, final String endpointName, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByEndpointSinglePageAsync(resourceGroupName, profileName, endpointName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the PagedList<CustomDomainInner> object + */ + public Observable> listByEndpointAsync(final String resourceGroupName, final String profileName, final String endpointName) { + return listByEndpointWithServiceResponseAsync(resourceGroupName, profileName, endpointName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the PagedList<CustomDomainInner> object + */ + public Observable>> listByEndpointWithServiceResponseAsync(final String resourceGroupName, final String profileName, final String endpointName) { + return listByEndpointSinglePageAsync(resourceGroupName, profileName, endpointName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEndpointNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param profileName Name of the CDN profile which is unique within the resource group. + ServiceResponse> * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the PagedList<CustomDomainInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEndpointSinglePageAsync(final String resourceGroupName, final String profileName, final String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByEndpoint(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEndpointDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEndpointDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the CustomDomainInner object if successful. + */ + public CustomDomainInner get(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + return getWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName).toBlocking().single().getBody(); + } + + /** + * Gets an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall getAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName), serviceCallback); + } + + /** + * Gets an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the observable to the CustomDomainInner object + */ + public Observable getAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + return getWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName).map(new Func1, CustomDomainInner>() { + @Override + public CustomDomainInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Gets an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the observable to the CustomDomainInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (customDomainName == null) { + throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the CustomDomainInner object if successful. + */ + public CustomDomainInner create(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) { + return createWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName, hostName).toBlocking().last().getBody(); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall createAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName, final ServiceCallback serviceCallback) { + return ServiceCall.create(createWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName, hostName), serviceCallback); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) { + return createWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName, hostName).map(new Func1, CustomDomainInner>() { + @Override + public CustomDomainInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (customDomainName == null) { + throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (hostName == null) { + throw new IllegalArgumentException("Parameter hostName is required and cannot be null."); + } + CustomDomainParameters customDomainProperties = new CustomDomainParameters(); + customDomainProperties.withHostName(hostName); + Observable> observable = service.create(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), customDomainProperties, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the CustomDomainInner object if successful. + */ + public CustomDomainInner beginCreate(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName, hostName).toBlocking().single().getBody(); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginCreateAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginCreateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName, hostName), serviceCallback); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the observable to the CustomDomainInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName, hostName).map(new Func1, CustomDomainInner>() { + @Override + public CustomDomainInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Creates a new CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the observable to the CustomDomainInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (customDomainName == null) { + throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (hostName == null) { + throw new IllegalArgumentException("Parameter hostName is required and cannot be null."); + } + CustomDomainParameters customDomainProperties = new CustomDomainParameters(); + customDomainProperties.withHostName(hostName); + return service.beginCreate(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), customDomainProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the CustomDomainInner object if successful. + */ + public CustomDomainInner delete(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + return deleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName).toBlocking().last().getBody(); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, final ServiceCallback serviceCallback) { + return ServiceCall.create(deleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName), serviceCallback); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + return deleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName).map(new Func1, CustomDomainInner>() { + @Override + public CustomDomainInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (customDomainName == null) { + throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the CustomDomainInner object if successful. + */ + public CustomDomainInner beginDelete(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName).toBlocking().single().getBody(); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginDeleteAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginDeleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName), serviceCallback); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the observable to the CustomDomainInner object + */ + public Observable beginDeleteAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName, customDomainName).map(new Func1, CustomDomainInner>() { + @Override + public CustomDomainInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes an existing CDN custom domain within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param customDomainName Name of the custom domain within an endpoint. + * @return the observable to the CustomDomainInner object + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (customDomainName == null) { + throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<CustomDomainInner> object if successful. + */ + public PagedList listByEndpointNext(final String nextPageLink) { + ServiceResponse> response = listByEndpointNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByEndpointNextAsync(final String nextPageLink, final ServiceCall> serviceCall, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByEndpointNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<CustomDomainInner> object + */ + public Observable> listByEndpointNextAsync(final String nextPageLink) { + return listByEndpointNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<CustomDomainInner> object + */ + public Observable>> listByEndpointNextWithServiceResponseAsync(final String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEndpointNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the existing CDN custom domains within an endpoint. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<CustomDomainInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEndpointNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + return service.listByEndpointNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEndpointNextDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEndpointNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointInner.java new file mode 100644 index 000000000000..eecee261d074 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointInner.java @@ -0,0 +1,346 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import java.util.List; +import com.microsoft.azure.management.cdn.QueryStringCachingBehavior; +import com.microsoft.azure.management.cdn.GeoFilter; +import com.microsoft.azure.management.cdn.DeepCreatedOrigin; +import com.microsoft.azure.management.cdn.EndpointResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * CDN endpoint is the entity within a CDN profile containing configuration + * information regarding caching behaviors and origins. The CDN endpoint is + * exposed using the URL format <endpointname>.azureedge.net by + * default, but custom domains can also be created. + */ +@JsonFlatten +public class EndpointInner extends Resource { + /** + * The host header the CDN provider will send along with content requests + * to origins. The default value is the host name of the origin. + */ + @JsonProperty(value = "properties.originHostHeader") + private String originHostHeader; + + /** + * The path used for origin requests. + */ + @JsonProperty(value = "properties.originPath") + private String originPath; + + /** + * List of content types on which compression will be applied. The value + * for the elements should be a valid MIME type. + */ + @JsonProperty(value = "properties.contentTypesToCompress") + private List contentTypesToCompress; + + /** + * Indicates whether content compression is enabled. The default value is + * false. If compression is enabled, the content transferred from the CDN + * endpoint to the end user will be compressed. The requested content + * must be larger than 1 byte and smaller than 1 MB. + */ + @JsonProperty(value = "properties.isCompressionEnabled") + private Boolean isCompressionEnabled; + + /** + * Indicates whether HTTP traffic is allowed on the endpoint. Default + * value is true. At least one protocol (HTTP or HTTPS) must be allowed. + */ + @JsonProperty(value = "properties.isHttpAllowed") + private Boolean isHttpAllowed; + + /** + * Indicates whether HTTPS traffic is allowed on the endpoint. Default + * value is true. At least one protocol (HTTP or HTTPS) must be allowed. + */ + @JsonProperty(value = "properties.isHttpsAllowed") + private Boolean isHttpsAllowed; + + /** + * Defines the query string caching behavior. Possible values include: + * 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'. + */ + @JsonProperty(value = "properties.queryStringCachingBehavior") + private QueryStringCachingBehavior queryStringCachingBehavior; + + /** + * Customer can specify what scenario they want this CDN endpoint to + * optimize. (e.g. Download, Media services, and etc.) With this + * information we can apply scenario driven optimization. + */ + @JsonProperty(value = "properties.optimizationType") + private String optimizationType; + + /** + * The list of geo filters for the CDN endpoint. + */ + @JsonProperty(value = "properties.geoFilters") + private List geoFilters; + + /** + * The host name of the endpoint {endpointName}.{DNSZone}. + */ + @JsonProperty(value = "properties.hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostName; + + /** + * The set of origins for the CDN endpoint. When multiple origins exist, + * the first origin will be used as primary and rest will be used as + * failover options. + */ + @JsonProperty(value = "properties.origins", required = true) + private List origins; + + /** + * Resource status of the endpoint. Possible values include: 'Creating', + * 'Deleting', 'Running', 'Starting', 'Stopped', 'Stopping'. + */ + @JsonProperty(value = "properties.resourceState", access = JsonProperty.Access.WRITE_ONLY) + private EndpointResourceState resourceState; + + /** + * Provisioning status of the endpoint. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the originHostHeader value. + * + * @return the originHostHeader value + */ + public String originHostHeader() { + return this.originHostHeader; + } + + /** + * Set the originHostHeader value. + * + * @param originHostHeader the originHostHeader value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withOriginHostHeader(String originHostHeader) { + this.originHostHeader = originHostHeader; + return this; + } + + /** + * Get the originPath value. + * + * @return the originPath value + */ + public String originPath() { + return this.originPath; + } + + /** + * Set the originPath value. + * + * @param originPath the originPath value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withOriginPath(String originPath) { + this.originPath = originPath; + return this; + } + + /** + * Get the contentTypesToCompress value. + * + * @return the contentTypesToCompress value + */ + public List contentTypesToCompress() { + return this.contentTypesToCompress; + } + + /** + * Set the contentTypesToCompress value. + * + * @param contentTypesToCompress the contentTypesToCompress value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withContentTypesToCompress(List contentTypesToCompress) { + this.contentTypesToCompress = contentTypesToCompress; + return this; + } + + /** + * Get the isCompressionEnabled value. + * + * @return the isCompressionEnabled value + */ + public Boolean isCompressionEnabled() { + return this.isCompressionEnabled; + } + + /** + * Set the isCompressionEnabled value. + * + * @param isCompressionEnabled the isCompressionEnabled value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withIsCompressionEnabled(Boolean isCompressionEnabled) { + this.isCompressionEnabled = isCompressionEnabled; + return this; + } + + /** + * Get the isHttpAllowed value. + * + * @return the isHttpAllowed value + */ + public Boolean isHttpAllowed() { + return this.isHttpAllowed; + } + + /** + * Set the isHttpAllowed value. + * + * @param isHttpAllowed the isHttpAllowed value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withIsHttpAllowed(Boolean isHttpAllowed) { + this.isHttpAllowed = isHttpAllowed; + return this; + } + + /** + * Get the isHttpsAllowed value. + * + * @return the isHttpsAllowed value + */ + public Boolean isHttpsAllowed() { + return this.isHttpsAllowed; + } + + /** + * Set the isHttpsAllowed value. + * + * @param isHttpsAllowed the isHttpsAllowed value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withIsHttpsAllowed(Boolean isHttpsAllowed) { + this.isHttpsAllowed = isHttpsAllowed; + return this; + } + + /** + * Get the queryStringCachingBehavior value. + * + * @return the queryStringCachingBehavior value + */ + public QueryStringCachingBehavior queryStringCachingBehavior() { + return this.queryStringCachingBehavior; + } + + /** + * Set the queryStringCachingBehavior value. + * + * @param queryStringCachingBehavior the queryStringCachingBehavior value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withQueryStringCachingBehavior(QueryStringCachingBehavior queryStringCachingBehavior) { + this.queryStringCachingBehavior = queryStringCachingBehavior; + return this; + } + + /** + * Get the optimizationType value. + * + * @return the optimizationType value + */ + public String optimizationType() { + return this.optimizationType; + } + + /** + * Set the optimizationType value. + * + * @param optimizationType the optimizationType value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withOptimizationType(String optimizationType) { + this.optimizationType = optimizationType; + return this; + } + + /** + * Get the geoFilters value. + * + * @return the geoFilters value + */ + public List geoFilters() { + return this.geoFilters; + } + + /** + * Set the geoFilters value. + * + * @param geoFilters the geoFilters value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withGeoFilters(List geoFilters) { + this.geoFilters = geoFilters; + return this; + } + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Get the origins value. + * + * @return the origins value + */ + public List origins() { + return this.origins; + } + + /** + * Set the origins value. + * + * @param origins the origins value to set + * @return the EndpointInner object itself. + */ + public EndpointInner withOrigins(List origins) { + this.origins = origins; + return this; + } + + /** + * Get the resourceState value. + * + * @return the resourceState value + */ + public EndpointResourceState resourceState() { + return this.resourceState; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointUpdateParametersInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointUpdateParametersInner.java new file mode 100644 index 000000000000..46780a2ff283 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointUpdateParametersInner.java @@ -0,0 +1,292 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.cdn.QueryStringCachingBehavior; +import com.microsoft.azure.management.cdn.GeoFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Endpoint properties required for new endpoint creation. + */ +@JsonFlatten +public class EndpointUpdateParametersInner { + /** + * Endpoint tags. + */ + private Map tags; + + /** + * The host header the CDN provider will send along with content requests + * to origins. The default value is the host name of the origin. + */ + @JsonProperty(value = "properties.originHostHeader") + private String originHostHeader; + + /** + * The path used for origin requests. + */ + @JsonProperty(value = "properties.originPath") + private String originPath; + + /** + * List of content types on which compression will be applied. The value + * for the elements should be a valid MIME type. + */ + @JsonProperty(value = "properties.contentTypesToCompress") + private List contentTypesToCompress; + + /** + * Indicates whether content compression is enabled. The default value is + * false. If compression is enabled, the content transferred from the CDN + * endpoint to the end user will be compressed. The requested content + * must be larger than 1 byte and smaller than 1 MB. + */ + @JsonProperty(value = "properties.isCompressionEnabled") + private Boolean isCompressionEnabled; + + /** + * Indicates whether HTTP traffic is allowed on the endpoint. Default + * value is true. At least one protocol (HTTP or HTTPS) must be allowed. + */ + @JsonProperty(value = "properties.isHttpAllowed") + private Boolean isHttpAllowed; + + /** + * Indicates whether HTTPS traffic is allowed on the endpoint. Default + * value is true. At least one protocol (HTTP or HTTPS) must be allowed. + */ + @JsonProperty(value = "properties.isHttpsAllowed") + private Boolean isHttpsAllowed; + + /** + * Defines the query string caching behavior. Possible values include: + * 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'. + */ + @JsonProperty(value = "properties.queryStringCachingBehavior") + private QueryStringCachingBehavior queryStringCachingBehavior; + + /** + * Customer can specify what scenario they want this CDN endpoint to + * optimize. (e.g. Download, Media services, and etc.) With this + * information we can apply scenario driven optimization. + */ + @JsonProperty(value = "properties.optimizationType") + private String optimizationType; + + /** + * The list of geo filters for the CDN endpoint. + */ + @JsonProperty(value = "properties.geoFilters") + private List geoFilters; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the originHostHeader value. + * + * @return the originHostHeader value + */ + public String originHostHeader() { + return this.originHostHeader; + } + + /** + * Set the originHostHeader value. + * + * @param originHostHeader the originHostHeader value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withOriginHostHeader(String originHostHeader) { + this.originHostHeader = originHostHeader; + return this; + } + + /** + * Get the originPath value. + * + * @return the originPath value + */ + public String originPath() { + return this.originPath; + } + + /** + * Set the originPath value. + * + * @param originPath the originPath value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withOriginPath(String originPath) { + this.originPath = originPath; + return this; + } + + /** + * Get the contentTypesToCompress value. + * + * @return the contentTypesToCompress value + */ + public List contentTypesToCompress() { + return this.contentTypesToCompress; + } + + /** + * Set the contentTypesToCompress value. + * + * @param contentTypesToCompress the contentTypesToCompress value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withContentTypesToCompress(List contentTypesToCompress) { + this.contentTypesToCompress = contentTypesToCompress; + return this; + } + + /** + * Get the isCompressionEnabled value. + * + * @return the isCompressionEnabled value + */ + public Boolean isCompressionEnabled() { + return this.isCompressionEnabled; + } + + /** + * Set the isCompressionEnabled value. + * + * @param isCompressionEnabled the isCompressionEnabled value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withIsCompressionEnabled(Boolean isCompressionEnabled) { + this.isCompressionEnabled = isCompressionEnabled; + return this; + } + + /** + * Get the isHttpAllowed value. + * + * @return the isHttpAllowed value + */ + public Boolean isHttpAllowed() { + return this.isHttpAllowed; + } + + /** + * Set the isHttpAllowed value. + * + * @param isHttpAllowed the isHttpAllowed value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withIsHttpAllowed(Boolean isHttpAllowed) { + this.isHttpAllowed = isHttpAllowed; + return this; + } + + /** + * Get the isHttpsAllowed value. + * + * @return the isHttpsAllowed value + */ + public Boolean isHttpsAllowed() { + return this.isHttpsAllowed; + } + + /** + * Set the isHttpsAllowed value. + * + * @param isHttpsAllowed the isHttpsAllowed value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withIsHttpsAllowed(Boolean isHttpsAllowed) { + this.isHttpsAllowed = isHttpsAllowed; + return this; + } + + /** + * Get the queryStringCachingBehavior value. + * + * @return the queryStringCachingBehavior value + */ + public QueryStringCachingBehavior queryStringCachingBehavior() { + return this.queryStringCachingBehavior; + } + + /** + * Set the queryStringCachingBehavior value. + * + * @param queryStringCachingBehavior the queryStringCachingBehavior value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withQueryStringCachingBehavior(QueryStringCachingBehavior queryStringCachingBehavior) { + this.queryStringCachingBehavior = queryStringCachingBehavior; + return this; + } + + /** + * Get the optimizationType value. + * + * @return the optimizationType value + */ + public String optimizationType() { + return this.optimizationType; + } + + /** + * Set the optimizationType value. + * + * @param optimizationType the optimizationType value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withOptimizationType(String optimizationType) { + this.optimizationType = optimizationType; + return this; + } + + /** + * Get the geoFilters value. + * + * @return the geoFilters value + */ + public List geoFilters() { + return this.geoFilters; + } + + /** + * Set the geoFilters value. + * + * @param geoFilters the geoFilters value to set + * @return the EndpointUpdateParametersInner object itself. + */ + public EndpointUpdateParametersInner withGeoFilters(List geoFilters) { + this.geoFilters = geoFilters; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointsInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointsInner.java new file mode 100644 index 000000000000..f26d5776d90e --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/EndpointsInner.java @@ -0,0 +1,1714 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceCall; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.cdn.ErrorResponseException; +import com.microsoft.azure.management.cdn.LoadParameters; +import com.microsoft.azure.management.cdn.PurgeParameters; +import com.microsoft.azure.management.cdn.ValidateCustomDomainInput; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Endpoints. + */ +public final class EndpointsInner { + /** The Retrofit service to perform REST calls. */ + private EndpointsService service; + /** The service client containing this operation class. */ + private CdnManagementClientImpl client; + + /** + * Initializes an instance of EndpointsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EndpointsInner(Retrofit retrofit, CdnManagementClientImpl client) { + this.service = retrofit.create(EndpointsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Endpoints to be + * used by Retrofit to perform actually REST calls. + */ + interface EndpointsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints") + Observable> listByProfile(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Body EndpointInner endpoint, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Body EndpointInner endpoint, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Body EndpointUpdateParametersInner endpointUpdateProperties, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Body EndpointUpdateParametersInner endpointUpdateProperties, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start") + Observable> start(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/start") + Observable> beginStart(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop") + Observable> stop(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/stop") + Observable> beginStop(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge") + Observable> purgeContent(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PurgeParameters contentFilePaths, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge") + Observable> beginPurgeContent(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body PurgeParameters contentFilePaths, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load") + Observable> loadContent(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body LoadParameters contentFilePaths, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load") + Observable> beginLoadContent(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body LoadParameters contentFilePaths, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain") + Observable> validateCustomDomain(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ValidateCustomDomainInput customDomainProperties, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("{nextLink}") + Observable> listByProfileNext(@Path(value = "nextLink", encoded = true) String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists existing CDN endpoints. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the PagedList<EndpointInner> object if successful. + */ + public PagedList listByProfile(final String resourceGroupName, final String profileName) { + ServiceResponse> response = listByProfileSinglePageAsync(resourceGroupName, profileName).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProfileNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists existing CDN endpoints. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByProfileAsync(final String resourceGroupName, final String profileName, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByProfileSinglePageAsync(resourceGroupName, profileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists existing CDN endpoints. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable to the PagedList<EndpointInner> object + */ + public Observable> listByProfileAsync(final String resourceGroupName, final String profileName) { + return listByProfileWithServiceResponseAsync(resourceGroupName, profileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists existing CDN endpoints. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable to the PagedList<EndpointInner> object + */ + public Observable>> listByProfileWithServiceResponseAsync(final String resourceGroupName, final String profileName) { + return listByProfileSinglePageAsync(resourceGroupName, profileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists existing CDN endpoints. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the PagedList<EndpointInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProfileSinglePageAsync(final String resourceGroupName, final String profileName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByProfile(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the EndpointInner object if successful. + */ + public EndpointInner get(String resourceGroupName, String profileName, String endpointName) { + return getWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().single().getBody(); + } + + /** + * Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall getAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the EndpointInner object + */ + public Observable getAsync(String resourceGroupName, String profileName, String endpointName) { + return getWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Gets an existing CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the EndpointInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @return the EndpointInner object if successful. + */ + public EndpointInner create(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint) { + return createWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpoint).toBlocking().last().getBody(); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall createAsync(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint, final ServiceCallback serviceCallback) { + return ServiceCall.create(createWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpoint), serviceCallback); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint) { + return createWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpoint).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (endpoint == null) { + throw new IllegalArgumentException("Parameter endpoint is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(endpoint); + Observable> observable = service.create(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), endpoint, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @return the EndpointInner object if successful. + */ + public EndpointInner beginCreate(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint) { + return beginCreateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpoint).toBlocking().single().getBody(); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginCreateAsync(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginCreateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpoint), serviceCallback); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @return the observable to the EndpointInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint) { + return beginCreateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpoint).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Creates a new CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpoint Endpoint properties + * @return the observable to the EndpointInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, EndpointInner endpoint) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (endpoint == null) { + throw new IllegalArgumentException("Parameter endpoint is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(endpoint); + return service.beginCreate(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), endpoint, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @return the EndpointInner object if successful. + */ + public EndpointInner update(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties) { + return updateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpointUpdateProperties).toBlocking().last().getBody(); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall updateAsync(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties, final ServiceCallback serviceCallback) { + return ServiceCall.create(updateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpointUpdateProperties), serviceCallback); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties) { + return updateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpointUpdateProperties).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (endpointUpdateProperties == null) { + throw new IllegalArgumentException("Parameter endpointUpdateProperties is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(endpointUpdateProperties); + Observable> observable = service.update(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), endpointUpdateProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @return the EndpointInner object if successful. + */ + public EndpointInner beginUpdate(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpointUpdateProperties).toBlocking().single().getBody(); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginUpdateAsync(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpointUpdateProperties), serviceCallback); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @return the observable to the EndpointInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, endpointUpdateProperties).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param endpointUpdateProperties Endpoint update properties + * @return the observable to the EndpointInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, EndpointUpdateParametersInner endpointUpdateProperties) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (endpointUpdateProperties == null) { + throw new IllegalArgumentException("Parameter endpointUpdateProperties is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(endpointUpdateProperties); + return service.beginUpdate(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), endpointUpdateProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + */ + public void delete(String resourceGroupName, String profileName, String endpointName) { + deleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().last().getBody(); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(deleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String profileName, String endpointName) { + return deleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + */ + public void beginDelete(String resourceGroupName, String profileName, String endpointName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().single().getBody(); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginDeleteAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginDeleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String profileName, String endpointName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes an existing CDN endpoint with the specified parameters. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the EndpointInner object if successful. + */ + public EndpointInner start(String resourceGroupName, String profileName, String endpointName) { + return startWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().last().getBody(); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall startAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(startWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable for the request + */ + public Observable startAsync(String resourceGroupName, String profileName, String endpointName) { + return startWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable for the request + */ + public Observable> startWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.start(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the EndpointInner object if successful. + */ + public EndpointInner beginStart(String resourceGroupName, String profileName, String endpointName) { + return beginStartWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().single().getBody(); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginStartAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginStartWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the EndpointInner object + */ + public Observable beginStartAsync(String resourceGroupName, String profileName, String endpointName) { + return beginStartWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the EndpointInner object + */ + public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStart(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the EndpointInner object if successful. + */ + public EndpointInner stop(String resourceGroupName, String profileName, String endpointName) { + return stopWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().last().getBody(); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall stopAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(stopWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable for the request + */ + public Observable stopAsync(String resourceGroupName, String profileName, String endpointName) { + return stopWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable for the request + */ + public Observable> stopWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.stop(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the EndpointInner object if successful. + */ + public EndpointInner beginStop(String resourceGroupName, String profileName, String endpointName) { + return beginStopWithServiceResponseAsync(resourceGroupName, profileName, endpointName).toBlocking().single().getBody(); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginStopAsync(String resourceGroupName, String profileName, String endpointName, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginStopWithServiceResponseAsync(resourceGroupName, profileName, endpointName), serviceCallback); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the EndpointInner object + */ + public Observable beginStopAsync(String resourceGroupName, String profileName, String endpointName) { + return beginStopWithServiceResponseAsync(resourceGroupName, profileName, endpointName).map(new Func1, EndpointInner>() { + @Override + public EndpointInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the EndpointInner object + */ + public Observable> beginStopWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStop(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStopDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + */ + public void purgeContent(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + purgeContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).toBlocking().last().getBody(); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall purgeContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths, final ServiceCallback serviceCallback) { + return ServiceCall.create(purgeContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths), serviceCallback); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + * @return the observable for the request + */ + public Observable purgeContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + return purgeContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + * @return the observable for the request + */ + public Observable> purgeContentWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (contentPaths == null) { + throw new IllegalArgumentException("Parameter contentPaths is required and cannot be null."); + } + Validator.validate(contentPaths); + PurgeParameters contentFilePaths = new PurgeParameters(); + contentFilePaths.withContentPaths(contentPaths); + Observable> observable = service.purgeContent(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), contentFilePaths, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + */ + public void beginPurgeContent(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + beginPurgeContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).toBlocking().single().getBody(); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginPurgeContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginPurgeContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths), serviceCallback); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginPurgeContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + return beginPurgeContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be purged. Can describe a file path or a wild card directory. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginPurgeContentWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (contentPaths == null) { + throw new IllegalArgumentException("Parameter contentPaths is required and cannot be null."); + } + Validator.validate(contentPaths); + PurgeParameters contentFilePaths = new PurgeParameters(); + contentFilePaths.withContentPaths(contentPaths); + return service.beginPurgeContent(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), contentFilePaths, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginPurgeContentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPurgeContentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + */ + public void loadContent(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + loadContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).toBlocking().last().getBody(); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall loadContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths, final ServiceCallback serviceCallback) { + return ServiceCall.create(loadContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths), serviceCallback); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + * @return the observable for the request + */ + public Observable loadContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + return loadContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + * @return the observable for the request + */ + public Observable> loadContentWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (contentPaths == null) { + throw new IllegalArgumentException("Parameter contentPaths is required and cannot be null."); + } + Validator.validate(contentPaths); + LoadParameters contentFilePaths = new LoadParameters(); + contentFilePaths.withContentPaths(contentPaths); + Observable> observable = service.loadContent(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), contentFilePaths, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + */ + public void beginLoadContent(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + beginLoadContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).toBlocking().single().getBody(); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginLoadContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginLoadContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths), serviceCallback); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginLoadContentAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + return beginLoadContentWithServiceResponseAsync(resourceGroupName, profileName, endpointName, contentPaths).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon Profiles. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param contentPaths The path to the content to be loaded. Should describe a file path. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginLoadContentWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (contentPaths == null) { + throw new IllegalArgumentException("Parameter contentPaths is required and cannot be null."); + } + Validator.validate(contentPaths); + LoadParameters contentFilePaths = new LoadParameters(); + contentFilePaths.withContentPaths(contentPaths); + return service.beginLoadContent(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), contentFilePaths, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginLoadContentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginLoadContentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Validates a custom domain mapping to ensure it maps to the correct CNAME in DNS. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the ValidateCustomDomainOutputInner object if successful. + */ + public ValidateCustomDomainOutputInner validateCustomDomain(String resourceGroupName, String profileName, String endpointName, String hostName) { + return validateCustomDomainWithServiceResponseAsync(resourceGroupName, profileName, endpointName, hostName).toBlocking().single().getBody(); + } + + /** + * Validates a custom domain mapping to ensure it maps to the correct CNAME in DNS. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param hostName The host name of the custom domain. Must be a domain name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall validateCustomDomainAsync(String resourceGroupName, String profileName, String endpointName, String hostName, final ServiceCallback serviceCallback) { + return ServiceCall.create(validateCustomDomainWithServiceResponseAsync(resourceGroupName, profileName, endpointName, hostName), serviceCallback); + } + + /** + * Validates a custom domain mapping to ensure it maps to the correct CNAME in DNS. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the observable to the ValidateCustomDomainOutputInner object + */ + public Observable validateCustomDomainAsync(String resourceGroupName, String profileName, String endpointName, String hostName) { + return validateCustomDomainWithServiceResponseAsync(resourceGroupName, profileName, endpointName, hostName).map(new Func1, ValidateCustomDomainOutputInner>() { + @Override + public ValidateCustomDomainOutputInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Validates a custom domain mapping to ensure it maps to the correct CNAME in DNS. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param hostName The host name of the custom domain. Must be a domain name. + * @return the observable to the ValidateCustomDomainOutputInner object + */ + public Observable> validateCustomDomainWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String hostName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (hostName == null) { + throw new IllegalArgumentException("Parameter hostName is required and cannot be null."); + } + ValidateCustomDomainInput customDomainProperties = new ValidateCustomDomainInput(); + customDomainProperties.withHostName(hostName); + return service.validateCustomDomain(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), customDomainProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateCustomDomainDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateCustomDomainDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists existing CDN endpoints. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<EndpointInner> object if successful. + */ + public PagedList listByProfileNext(final String nextPageLink) { + ServiceResponse> response = listByProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByProfileNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists existing CDN endpoints. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByProfileNextAsync(final String nextPageLink, final ServiceCall> serviceCall, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists existing CDN endpoints. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<EndpointInner> object + */ + public Observable> listByProfileNextAsync(final String nextPageLink) { + return listByProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists existing CDN endpoints. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<EndpointInner> object + */ + public Observable>> listByProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists existing CDN endpoints. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<EndpointInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + return service.listByProfileNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OperationInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OperationInner.java new file mode 100644 index 000000000000..7a99c7844ff4 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OperationInner.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.management.cdn.OperationDisplay; + +/** + * CDN REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + private String name; + + /** + * The object that represents the operation. + */ + private OperationDisplay display; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginInner.java new file mode 100644 index 000000000000..56c18a2ea851 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginInner.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.management.cdn.OriginResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * CDN origin is the source of the content being delivered via CDN. When the + * edge nodes represented by an endpoint do not have the requested content + * cached, they attempt to fetch it from one or more of the configured + * origins. + */ +@JsonFlatten +public class OriginInner extends Resource { + /** + * The address of the origin. Domain names, IPv4 addresses, and IPv6 + * addresses are supported. + */ + @JsonProperty(value = "properties.hostName", required = true) + private String hostName; + + /** + * The value of the HTTP port. Must be between 1 and 65535. + */ + @JsonProperty(value = "properties.httpPort") + private Integer httpPort; + + /** + * The value of the https port. Must be between 1 and 65535. + */ + @JsonProperty(value = "properties.httpsPort") + private Integer httpsPort; + + /** + * Resource status of the origin. Possible values include: 'Creating', + * 'Active', 'Deleting'. + */ + @JsonProperty(value = "properties.resourceState", access = JsonProperty.Access.WRITE_ONLY) + private OriginResourceState resourceState; + + /** + * Provisioning status of the origin. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set the hostName value. + * + * @param hostName the hostName value to set + * @return the OriginInner object itself. + */ + public OriginInner withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get the httpPort value. + * + * @return the httpPort value + */ + public Integer httpPort() { + return this.httpPort; + } + + /** + * Set the httpPort value. + * + * @param httpPort the httpPort value to set + * @return the OriginInner object itself. + */ + public OriginInner withHttpPort(Integer httpPort) { + this.httpPort = httpPort; + return this; + } + + /** + * Get the httpsPort value. + * + * @return the httpsPort value + */ + public Integer httpsPort() { + return this.httpsPort; + } + + /** + * Set the httpsPort value. + * + * @param httpsPort the httpsPort value to set + * @return the OriginInner object itself. + */ + public OriginInner withHttpsPort(Integer httpsPort) { + this.httpsPort = httpsPort; + return this; + } + + /** + * Get the resourceState value. + * + * @return the resourceState value + */ + public OriginResourceState resourceState() { + return this.resourceState; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginUpdateParametersInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginUpdateParametersInner.java new file mode 100644 index 000000000000..249e6b0cb3c0 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginUpdateParametersInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Origin properties needed for origin creation or update. + */ +@JsonFlatten +public class OriginUpdateParametersInner { + /** + * The address of the origin. Domain names, IPv4 addresses, and IPv6 + * addresses are supported. + */ + @JsonProperty(value = "properties.hostName") + private String hostName; + + /** + * The value of the HTTP port. Must be between 1 and 65535. + */ + @JsonProperty(value = "properties.httpPort") + private Integer httpPort; + + /** + * The value of the HTTPS port. Must be between 1 and 65535. + */ + @JsonProperty(value = "properties.httpsPort") + private Integer httpsPort; + + /** + * Get the hostName value. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set the hostName value. + * + * @param hostName the hostName value to set + * @return the OriginUpdateParametersInner object itself. + */ + public OriginUpdateParametersInner withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get the httpPort value. + * + * @return the httpPort value + */ + public Integer httpPort() { + return this.httpPort; + } + + /** + * Set the httpPort value. + * + * @param httpPort the httpPort value to set + * @return the OriginUpdateParametersInner object itself. + */ + public OriginUpdateParametersInner withHttpPort(Integer httpPort) { + this.httpPort = httpPort; + return this; + } + + /** + * Get the httpsPort value. + * + * @return the httpsPort value + */ + public Integer httpsPort() { + return this.httpsPort; + } + + /** + * Set the httpsPort value. + * + * @param httpsPort the httpsPort value to set + * @return the OriginUpdateParametersInner object itself. + */ + public OriginUpdateParametersInner withHttpsPort(Integer httpsPort) { + this.httpsPort = httpsPort; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginsInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginsInner.java new file mode 100644 index 000000000000..ca907b095e1b --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginsInner.java @@ -0,0 +1,594 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceCall; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.cdn.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Origins. + */ +public final class OriginsInner { + /** The Retrofit service to perform REST calls. */ + private OriginsService service; + /** The service client containing this operation class. */ + private CdnManagementClientImpl client; + + /** + * Initializes an instance of OriginsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OriginsInner(Retrofit retrofit, CdnManagementClientImpl client) { + this.service = retrofit.create(OriginsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Origins to be + * used by Retrofit to perform actually REST calls. + */ + interface OriginsService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins") + Observable> listByEndpoint(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("originName") String originName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("originName") String originName, @Path("subscriptionId") String subscriptionId, @Body OriginUpdateParametersInner originUpdateProperties, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/origins/{originName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("endpointName") String endpointName, @Path("originName") String originName, @Path("subscriptionId") String subscriptionId, @Body OriginUpdateParametersInner originUpdateProperties, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("{nextLink}") + Observable> listByEndpointNext(@Path(value = "nextLink", encoded = true) String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the PagedList<OriginInner> object if successful. + */ + public PagedList listByEndpoint(final String resourceGroupName, final String profileName, final String endpointName) { + ServiceResponse> response = listByEndpointSinglePageAsync(resourceGroupName, profileName, endpointName).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByEndpointAsync(final String resourceGroupName, final String profileName, final String endpointName, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByEndpointSinglePageAsync(resourceGroupName, profileName, endpointName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the PagedList<OriginInner> object + */ + public Observable> listByEndpointAsync(final String resourceGroupName, final String profileName, final String endpointName) { + return listByEndpointWithServiceResponseAsync(resourceGroupName, profileName, endpointName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the observable to the PagedList<OriginInner> object + */ + public Observable>> listByEndpointWithServiceResponseAsync(final String resourceGroupName, final String profileName, final String endpointName) { + return listByEndpointSinglePageAsync(resourceGroupName, profileName, endpointName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEndpointNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + ServiceResponse> * @param profileName Name of the CDN profile which is unique within the resource group. + ServiceResponse> * @param endpointName Name of the endpoint under the profile which is unique globally. + * @return the PagedList<OriginInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEndpointSinglePageAsync(final String resourceGroupName, final String profileName, final String endpointName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByEndpoint(resourceGroupName, profileName, endpointName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEndpointDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEndpointDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @return the OriginInner object if successful. + */ + public OriginInner get(String resourceGroupName, String profileName, String endpointName, String originName) { + return getWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName).toBlocking().single().getBody(); + } + + /** + * Gets an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall getAsync(String resourceGroupName, String profileName, String endpointName, String originName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName), serviceCallback); + } + + /** + * Gets an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @return the observable to the OriginInner object + */ + public Observable getAsync(String resourceGroupName, String profileName, String endpointName, String originName) { + return getWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName).map(new Func1, OriginInner>() { + @Override + public OriginInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Gets an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @return the observable to the OriginInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String originName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (originName == null) { + throw new IllegalArgumentException("Parameter originName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, profileName, endpointName, originName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @return the OriginInner object if successful. + */ + public OriginInner update(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { + return updateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName, originUpdateProperties).toBlocking().last().getBody(); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall updateAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties, final ServiceCallback serviceCallback) { + return ServiceCall.create(updateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName, originUpdateProperties), serviceCallback); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { + return updateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName, originUpdateProperties).map(new Func1, OriginInner>() { + @Override + public OriginInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (originName == null) { + throw new IllegalArgumentException("Parameter originName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (originUpdateProperties == null) { + throw new IllegalArgumentException("Parameter originUpdateProperties is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(originUpdateProperties); + Observable> observable = service.update(resourceGroupName, profileName, endpointName, originName, this.client.subscriptionId(), originUpdateProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @return the OriginInner object if successful. + */ + public OriginInner beginUpdate(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName, originUpdateProperties).toBlocking().single().getBody(); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginUpdateAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName, originUpdateProperties), serviceCallback); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @return the observable to the OriginInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, endpointName, originName, originUpdateProperties).map(new Func1, OriginInner>() { + @Override + public OriginInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Updates an existing CDN origin within an endpoint. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param endpointName Name of the endpoint under the profile which is unique globally. + * @param originName Name of the origin which is unique within the endpoint. + * @param originUpdateProperties Origin properties + * @return the observable to the OriginInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (endpointName == null) { + throw new IllegalArgumentException("Parameter endpointName is required and cannot be null."); + } + if (originName == null) { + throw new IllegalArgumentException("Parameter originName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (originUpdateProperties == null) { + throw new IllegalArgumentException("Parameter originUpdateProperties is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(originUpdateProperties); + return service.beginUpdate(resourceGroupName, profileName, endpointName, originName, this.client.subscriptionId(), originUpdateProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<OriginInner> object if successful. + */ + public PagedList listByEndpointNext(final String nextPageLink) { + ServiceResponse> response = listByEndpointNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByEndpointNextAsync(final String nextPageLink, final ServiceCall> serviceCall, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByEndpointNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<OriginInner> object + */ + public Observable> listByEndpointNextAsync(final String nextPageLink) { + return listByEndpointNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<OriginInner> object + */ + public Observable>> listByEndpointNextWithServiceResponseAsync(final String nextPageLink) { + return listByEndpointNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEndpointNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the existing CDN origins within an endpoint. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<OriginInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEndpointNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + return service.listByEndpointNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEndpointNextDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEndpointNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/PageImpl.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/PageImpl.java new file mode 100644 index 000000000000..80834695bbb0 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String getNextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfileInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfileInner.java new file mode 100644 index 000000000000..eae527bc6d85 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfileInner.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.management.cdn.Sku; +import com.microsoft.azure.management.cdn.ProfileResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * CDN profile represents the top level resource and the entry point into the + * CDN API. This allows users to set up a logical grouping of endpoints in + * addition to creating shared configuration settings and selecting pricing + * tiers and providers. + */ +@JsonFlatten +public class ProfileInner extends Resource { + /** + * The SKU (pricing tier) of the CDN profile. + */ + @JsonProperty(required = true) + private Sku sku; + + /** + * Resource status of the profile. Possible values include: 'Creating', + * 'Active', 'Deleting', 'Disabled'. + */ + @JsonProperty(value = "properties.resourceState", access = JsonProperty.Access.WRITE_ONLY) + private ProfileResourceState resourceState; + + /** + * Provisioning status of the profile. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ProfileInner object itself. + */ + public ProfileInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the resourceState value. + * + * @return the resourceState value + */ + public ProfileResourceState resourceState() { + return this.resourceState; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfilesInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfilesInner.java new file mode 100644 index 000000000000..b7ef476e7889 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfilesInner.java @@ -0,0 +1,1159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceCall; +import com.microsoft.azure.AzureServiceResponseBuilder; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.cdn.ErrorResponseException; +import com.microsoft.azure.management.cdn.ProfileUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCall; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Profiles. + */ +public final class ProfilesInner { + /** The Retrofit service to perform REST calls. */ + private ProfilesService service; + /** The service client containing this operation class. */ + private CdnManagementClientImpl client; + + /** + * Initializes an instance of ProfilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProfilesInner(Retrofit retrofit, CdnManagementClientImpl client) { + this.service = retrofit.create(ProfilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Profiles to be + * used by Retrofit to perform actually REST calls. + */ + interface ProfilesService { + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Cdn/profiles") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Body ProfileInner profile, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Body ProfileInner profile, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ProfileUpdateParameters profileUpdateParameters, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ProfileUpdateParameters profileUpdateParameters, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri") + Observable> generateSsoUri(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("{nextLink}") + Observable> listNext(@Path(value = "nextLink", encoded = true) String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers("Content-Type: application/json; charset=utf-8") + @GET("{nextLink}") + Observable> listByResourceGroupNext(@Path(value = "nextLink", encoded = true) String nextPageLink, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @return the PagedList<ProfileInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @return the PagedList<ProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @return the PagedList<ProfileInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the CDN profiles within a resource group. + * + ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @return the PagedList<ProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the ProfileInner object if successful. + */ + public ProfileInner get(String resourceGroupName, String profileName) { + return getWithServiceResponseAsync(resourceGroupName, profileName).toBlocking().single().getBody(); + } + + /** + * Gets a CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall getAsync(String resourceGroupName, String profileName, final ServiceCallback serviceCallback) { + return ServiceCall.create(getWithServiceResponseAsync(resourceGroupName, profileName), serviceCallback); + } + + /** + * Gets a CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable to the ProfileInner object + */ + public Observable getAsync(String resourceGroupName, String profileName) { + return getWithServiceResponseAsync(resourceGroupName, profileName).map(new Func1, ProfileInner>() { + @Override + public ProfileInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Gets a CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable to the ProfileInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String profileName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @return the ProfileInner object if successful. + */ + public ProfileInner create(String resourceGroupName, String profileName, ProfileInner profile) { + return createWithServiceResponseAsync(resourceGroupName, profileName, profile).toBlocking().last().getBody(); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall createAsync(String resourceGroupName, String profileName, ProfileInner profile, final ServiceCallback serviceCallback) { + return ServiceCall.create(createWithServiceResponseAsync(resourceGroupName, profileName, profile), serviceCallback); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String profileName, ProfileInner profile) { + return createWithServiceResponseAsync(resourceGroupName, profileName, profile).map(new Func1, ProfileInner>() { + @Override + public ProfileInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String profileName, ProfileInner profile) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (profile == null) { + throw new IllegalArgumentException("Parameter profile is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(profile); + Observable> observable = service.create(resourceGroupName, profileName, this.client.subscriptionId(), profile, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @return the ProfileInner object if successful. + */ + public ProfileInner beginCreate(String resourceGroupName, String profileName, ProfileInner profile) { + return beginCreateWithServiceResponseAsync(resourceGroupName, profileName, profile).toBlocking().single().getBody(); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginCreateAsync(String resourceGroupName, String profileName, ProfileInner profile, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginCreateWithServiceResponseAsync(resourceGroupName, profileName, profile), serviceCallback); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @return the observable to the ProfileInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String profileName, ProfileInner profile) { + return beginCreateWithServiceResponseAsync(resourceGroupName, profileName, profile).map(new Func1, ProfileInner>() { + @Override + public ProfileInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Creates a new CDN profile with a profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param profile Profile properties needed to create a new profile. + * @return the observable to the ProfileInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String profileName, ProfileInner profile) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (profile == null) { + throw new IllegalArgumentException("Parameter profile is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(profile); + return service.beginCreate(resourceGroupName, profileName, this.client.subscriptionId(), profile, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @return the ProfileInner object if successful. + */ + public ProfileInner update(String resourceGroupName, String profileName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, profileName, tags).toBlocking().last().getBody(); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall updateAsync(String resourceGroupName, String profileName, Map tags, final ServiceCallback serviceCallback) { + return ServiceCall.create(updateWithServiceResponseAsync(resourceGroupName, profileName, tags), serviceCallback); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String profileName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, profileName, tags).map(new Func1, ProfileInner>() { + @Override + public ProfileInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String profileName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (tags == null) { + throw new IllegalArgumentException("Parameter tags is required and cannot be null."); + } + Validator.validate(tags); + ProfileUpdateParameters profileUpdateParameters = new ProfileUpdateParameters(); + profileUpdateParameters.withTags(tags); + Observable> observable = service.update(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), profileUpdateParameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @return the ProfileInner object if successful. + */ + public ProfileInner beginUpdate(String resourceGroupName, String profileName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, tags).toBlocking().single().getBody(); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginUpdateAsync(String resourceGroupName, String profileName, Map tags, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, tags), serviceCallback); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @return the observable to the ProfileInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String profileName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, profileName, tags).map(new Func1, ProfileInner>() { + @Override + public ProfileInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Updates an existing CDN profile with the specified profile name under the specified subscription and resource group. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param tags Profile tags + * @return the observable to the ProfileInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String profileName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (tags == null) { + throw new IllegalArgumentException("Parameter tags is required and cannot be null."); + } + Validator.validate(tags); + ProfileUpdateParameters profileUpdateParameters = new ProfileUpdateParameters(); + profileUpdateParameters.withTags(tags); + return service.beginUpdate(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), profileUpdateParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + */ + public void delete(String resourceGroupName, String profileName) { + deleteWithServiceResponseAsync(resourceGroupName, profileName).toBlocking().last().getBody(); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall deleteAsync(String resourceGroupName, String profileName, final ServiceCallback serviceCallback) { + return ServiceCall.create(deleteWithServiceResponseAsync(resourceGroupName, profileName), serviceCallback); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String profileName) { + return deleteWithServiceResponseAsync(resourceGroupName, profileName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String profileName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + */ + public void beginDelete(String resourceGroupName, String profileName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, profileName).toBlocking().single().getBody(); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall beginDeleteAsync(String resourceGroupName, String profileName, final ServiceCallback serviceCallback) { + return ServiceCall.create(beginDeleteWithServiceResponseAsync(resourceGroupName, profileName), serviceCallback); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String profileName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, profileName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String profileName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the SsoUriInner object if successful. + */ + public SsoUriInner generateSsoUri(String resourceGroupName, String profileName) { + return generateSsoUriWithServiceResponseAsync(resourceGroupName, profileName).toBlocking().single().getBody(); + } + + /** + * Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall generateSsoUriAsync(String resourceGroupName, String profileName, final ServiceCallback serviceCallback) { + return ServiceCall.create(generateSsoUriWithServiceResponseAsync(resourceGroupName, profileName), serviceCallback); + } + + /** + * Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable to the SsoUriInner object + */ + public Observable generateSsoUriAsync(String resourceGroupName, String profileName) { + return generateSsoUriWithServiceResponseAsync(resourceGroupName, profileName).map(new Func1, SsoUriInner>() { + @Override + public SsoUriInner call(ServiceResponse response) { + return response.getBody(); + } + }); + } + + /** + * Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes. + * + * @param resourceGroupName Name of the Resource group within the Azure subscription. + * @param profileName Name of the CDN profile which is unique within the resource group. + * @return the observable to the SsoUriInner object + */ + public Observable> generateSsoUriWithServiceResponseAsync(String resourceGroupName, String profileName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (profileName == null) { + throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.generateSsoUri(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateSsoUriDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateSsoUriDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder(this.client.mapperAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<ProfileInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listNextAsync(final String nextPageLink, final ServiceCall> serviceCall, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the CDN profiles within an Azure subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<ProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + return service.listNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<ProfileInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.getBody()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().getBody(); + } + }; + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceCall the ServiceCall object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceCall} object + */ + public ServiceCall> listByResourceGroupNextAsync(final String nextPageLink, final ServiceCall> serviceCall, final ListOperationCallback serviceCallback) { + return AzureServiceCall.create( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.getBody(); + } + }); + } + + /** + * Lists all the CDN profiles within a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the observable to the PagedList<ProfileInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.getBody().getNextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the CDN profiles within a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @return the PagedList<ProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + return service.listByResourceGroupNext(nextPageLink, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.getBody(), result.getResponse())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return new AzureServiceResponseBuilder, ErrorResponseException>(this.client.mapperAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/SsoUriInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/SsoUriInner.java new file mode 100644 index 000000000000..6037564b9e33 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/SsoUriInner.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + + +/** + * SSO URI required to login to third party web portal. + */ +public class SsoUriInner { + /** + * The URI used to login to third party web portal. + */ + private String ssoUriValue; + + /** + * Get the ssoUriValue value. + * + * @return the ssoUriValue value + */ + public String ssoUriValue() { + return this.ssoUriValue; + } + + /** + * Set the ssoUriValue value. + * + * @param ssoUriValue the ssoUriValue value to set + * @return the SsoUriInner object itself. + */ + public SsoUriInner withSsoUriValue(String ssoUriValue) { + this.ssoUriValue = ssoUriValue; + return this; + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ValidateCustomDomainOutputInner.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ValidateCustomDomainOutputInner.java new file mode 100644 index 000000000000..dff115d85b86 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ValidateCustomDomainOutputInner.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cdn.implementation; + + +/** + * Output of custom domain validation. + */ +public class ValidateCustomDomainOutputInner { + /** + * Indicates whether the custom domain is validated or not. + */ + private Boolean customDomainValidated; + + /** + * The reason why the custom domain is not valid. + */ + private String reason; + + /** + * The message describing why the custom domain is not valid. + */ + private String message; + + /** + * Get the customDomainValidated value. + * + * @return the customDomainValidated value + */ + public Boolean customDomainValidated() { + return this.customDomainValidated; + } + + /** + * Set the customDomainValidated value. + * + * @param customDomainValidated the customDomainValidated value to set + * @return the ValidateCustomDomainOutputInner object itself. + */ + public ValidateCustomDomainOutputInner withCustomDomainValidated(Boolean customDomainValidated) { + this.customDomainValidated = customDomainValidated; + return this; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason value. + * + * @param reason the reason value to set + * @return the ValidateCustomDomainOutputInner object itself. + */ + public ValidateCustomDomainOutputInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ValidateCustomDomainOutputInner object itself. + */ + public ValidateCustomDomainOutputInner withMessage(String message) { + this.message = message; + return this; + } + +} From 962de50b2d3bf8fae9aec81df579cb359efc6ba8 Mon Sep 17 00:00:00 2001 From: Hovsep Mkrtchyan Date: Mon, 21 Nov 2016 15:52:58 -0800 Subject: [PATCH 2/2] Hand crafted code --- azure-mgmt-cdn/pom.xml | 2 +- .../azure/management/cdn/CdnEndpoint.java | 905 ++++++++++++++++++ .../azure/management/cdn/CdnProfile.java | 362 +++++++ .../azure/management/cdn/CdnProfiles.java | 101 ++ .../cdn/CheckNameAvailabilityResult.java | 55 ++ .../cdn/CustomDomainValidationResult.java | 55 ++ .../azure/management/cdn/Operation.java | 73 ++ .../cdn/implementation/CdnEndpointImpl.java | 543 +++++++++++ .../cdn/implementation/CdnEndpointsImpl.java | 156 +++ .../cdn/implementation/CdnManager.java | 100 ++ .../cdn/implementation/CdnProfileImpl.java | 274 ++++++ .../cdn/implementation/CdnProfilesImpl.java | 138 +++ .../cdn/implementation/package-info.java | 11 + .../azure/management/cdn/package-info.java | 11 + .../management/cdn/samples/ManageCdn.java | 173 ++++ .../management/cdn/samples/package-info.java | 8 + azure/pom.xml | 5 + .../com/microsoft/azure/management/Azure.java | 11 + .../azure/management/AzureTests.java | 12 + .../microsoft/azure/management/TestCdn.java | 153 +++ 20 files changed, 3147 insertions(+), 1 deletion(-) create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnEndpoint.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfile.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfiles.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityResult.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainValidationResult.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Operation.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointImpl.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointsImpl.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManager.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfileImpl.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfilesImpl.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/package-info.java create mode 100644 azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/package-info.java create mode 100644 azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/ManageCdn.java create mode 100644 azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/package-info.java create mode 100644 azure/src/test/java/com/microsoft/azure/management/TestCdn.java diff --git a/azure-mgmt-cdn/pom.xml b/azure-mgmt-cdn/pom.xml index 3a3117a6c669..1911b1d99ccb 100644 --- a/azure-mgmt-cdn/pom.xml +++ b/azure-mgmt-cdn/pom.xml @@ -12,7 +12,7 @@ azure-mgmt-cdn jar - 1.0.0-SNAPSHOT + 1.0.0-beta4-SNAPSHOT Microsoft Azure SDK for CDN Management This package contains Microsoft Azure CDN SDK. diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnEndpoint.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnEndpoint.java new file mode 100644 index 000000000000..6c78dc9daad7 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnEndpoint.java @@ -0,0 +1,905 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn; + +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.cdn.implementation.EndpointInner; +import com.microsoft.azure.management.resources.fluentcore.arm.CountryISOCode; +import com.microsoft.azure.management.resources.fluentcore.arm.models.ExternalChildResource; +import com.microsoft.azure.management.resources.fluentcore.model.Settable; +import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; + +import java.util.List; + +/** + * An immutable client-side representation of an Azure CDN endpoint. + */ +@Fluent +public interface CdnEndpoint extends + ExternalChildResource, + Wrapper { + + /** + * @return origin host header + */ + String originHostHeader(); + + /** + * @return origin path + */ + String originPath(); + + /** + * @return list of content types to be compressed + */ + List contentTypesToCompress(); + + /** + * @return true if content compression is enabled, otherwise false + */ + boolean isCompressionEnabled(); + + /** + * @return true if Http traffic is allowed, otherwise false. + */ + boolean isHttpAllowed(); + + /** + * @return true if Https traffic is allowed, otherwise false + */ + boolean isHttpsAllowed(); + + /** + * @return query string caching behavior + */ + QueryStringCachingBehavior queryStringCachingBehavior(); + + /** + * @return optimization type value + */ + String optimizationType(); + + /** + * @return list of Geo filters + */ + List geoFilters(); + + /** + * @return endpoint host name + */ + String hostName(); + + /** + * @return endpoint state + */ + EndpointResourceState resourceState(); + + /** + * @return endpoint provisioning state + */ + String provisioningState(); + + /** + * @return origin host name + */ + String originHostName(); + + /** + * @return http port value + */ + int httpPort(); + + /** + * @return https port value + */ + int httpsPort(); + + /** + * @return list of custom domains associated with current endpoint. + */ + List customDomains(); + + /** + * Starts current stopped CDN endpoint. + */ + void start(); + + /** + * Stops current running CDN endpoint. + */ + void stop(); + + /** + * Forcibly purges current CDN endpoint content. + * + * @param contentPaths the path to the content to be purged. Can describe a file path or a wild card directory. + */ + void purgeContent(List contentPaths); + + /** + * Forcibly pre-loads current CDN endpoint content. Available for Verizon Profiles. + * + * @param contentPaths the path to the content to be loaded. Should describe a file path. + */ + void loadContent(List contentPaths); + + /** + * Validates a custom domain mapping to ensure it maps to the correct CNAME in DNS for current endpoint. + * + * @param hostName the host name of the custom domain. Must be a domain name. + * @return the CustomDomainValidationResult object if successful. + */ + CustomDomainValidationResult validateCustomDomain(String hostName); + + /** + * Grouping of CDN profile endpoint definition stages as a part of parent CDN profile definition. + */ + interface DefinitionStages { + /** + * The first stage of a CDN profile endpoint definition. + */ + interface Blank { + /** + * The stage of the CDN profile endpoint definition allowing to specify the origin. + * + * @param the return type of {@link AttachableStandard#attach()} + */ + interface StandardEndpoint { + /** + * Specifies the origin of the CDN endpoint. + * + * @param originName name of the origin. + * @param originHostName origin hostname. + * @return the next stage of the definition + */ + DefinitionStages.WithStandardAttach withOrigin(String originName, String originHostName); + + /** + * Specifies the origin of the CDN endpoint. + * + * @param originHostName origin hostname. + * @return the next stage of the definition + */ + DefinitionStages.WithStandardAttach withOrigin(String originHostName); + } + + /** + * The stage of the CDN profile endpoint definition allowing to specify the origin + * for CDN Profile with Premium Verizon sku. + * + * @param the return type of {@link AttachablePremium#attach()} + */ + interface PremiumEndpoint { + /** + * Specifies the origin of the CDN endpoint. + * + * @param originName name of the origin. + * @param originHostName origin hostname. + * @return the next stage of the definition + */ + DefinitionStages.WithPremiumAttach withPremiumOrigin(String originName, String originHostName); + + /** + * Specifies the origin of the CDN endpoint. + * + * @param originHostName origin hostname. + * @return the next stage of the definition + */ + DefinitionStages.WithPremiumAttach withPremiumOrigin(String originHostName); + } + } + + /** The final stage of the CDN profile Standard Akamai or Standard Verizon endpoint definition. + *

+ * At this stage, any remaining optional settings can be specified, or the CDN profile endpoint + * definition can be attached to the parent CDN profile definition using {@link CdnEndpoint.DefinitionStages.AttachableStandard#attach()}. + * @param the return type of {@link CdnEndpoint.DefinitionStages.AttachableStandard#attach()} + */ + interface WithStandardAttach + extends AttachableStandard { + /** + * Specifies origin path. + * + * @param originPath origin path. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withOriginPath(String originPath); + + /** + * Specifies host header. + * + * @param hostHeader host header. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHostHeader(String hostHeader); + + /** + * Specifies if http traffic is allowed. + * + * @param httpAllowed if set to true Http traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpAllowed(boolean httpAllowed); + + /** + * Specifies if https traffic is allowed. + * + * @param httpsAllowed if set to true Https traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpsAllowed(boolean httpsAllowed); + + /** + * Specifies http port for http traffic. + * + * @param httpPort http port number. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpPort(int httpPort); + + /** + * Specifies https port for http traffic. + * + * @param httpsPort https port number. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpsPort(int httpsPort); + + /** + * Specifies the content types to compress. + * + * @param contentTypesToCompress the list of content types to compress to set + * @return the next stage of the endpoint definition + */ + WithStandardAttach withContentTypesToCompress(List contentTypesToCompress); + + /** + * Specifies a single content type to compress. + * + * @param contentTypeToCompress a singe content type to compress to add to the list + * @return the next stage of the endpoint definition + */ + WithStandardAttach withContentTypeToCompress(String contentTypeToCompress); + + /** + * Sets the compression state. + * + * @param compressionEnabled if set to true compression will be enabled. If set to false compression will be disabled + * @return the next stage of the endpoint definition + */ + WithStandardAttach withCompressionEnabled(boolean compressionEnabled); + + /** + * Sets the query string caching behavior. + * + * @param cachingBehavior the query string caching behavior value to set + * @return the next stage of the endpoint definition + */ + WithStandardAttach withQueryStringCachingBehavior(QueryStringCachingBehavior cachingBehavior); + + /** + * Sets the geo filters list. + * + * @param geoFilters the Geo filters list to set + * @return the next stage of the endpoint definition + */ + WithStandardAttach withGeoFilters(List geoFilters); + + /** + * Adds a single entry to the Geo filters list. + * + * @param relativePath the relative path. + * @param action the action value. + * @param countryCode the ISO 2 letter country codes. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withGeoFilter(String relativePath, GeoFilterActions action, CountryISOCode countryCode); + + /** + * Sets the geo filters list for the specified countries list. + * + * @param relativePath the relative path. + * @param action the action value. + * @param countryCodes a list of the ISO 2 letter country codes. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withGeoFilter(String relativePath, GeoFilterActions action, List countryCodes); + + /** + * Adds a new CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withCustomDomain(String hostName); + } + + /** The final stage of the CDN profile Premium Verizon endpoint definition. + *

+ * At this stage, any remaining optional settings can be specified, or the CDN profile endpoint + * definition can be attached to the parent CDN profile definition using {@link CdnEndpoint.DefinitionStages.AttachablePremium#attach()}. + * @param the return type of {@link CdnEndpoint.DefinitionStages.AttachablePremium#attach()} + */ + interface WithPremiumAttach + extends AttachablePremium { + /** + * Specifies origin path. + * + * @param originPath origin path. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withOriginPath(String originPath); + + /** + * Specifies host header. + * + * @param hostHeader host header. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHostHeader(String hostHeader); + + /** + * Specifies if http traffic is allowed. + * + * @param httpAllowed if set to true Http traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpAllowed(boolean httpAllowed); + + /** + * Specifies if https traffic is allowed. + * + * @param httpsAllowed if set to true Https traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpsAllowed(boolean httpsAllowed); + + /** + * Specifies http port for http traffic. + * + * @param httpPort http port number. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpPort(int httpPort); + + /** + * Specifies https port for http traffic. + * + * @param httpsPort https port number. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpsPort(int httpsPort); + + /** + * Adds a new CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withCustomDomain(String hostName); + } + + /** + * The final stage of the Standard endpoint object definition, at which it can be attached to the parent, using {@link AttachableStandard#attach()}. + * + * @param the parent definition {@link AttachableStandard#attach()} returns to + */ + interface AttachableStandard { + ParentT attach(); + } + + /** + * The final stage of the Premium Verizon endpoint object definition, at which it can be attached to the parent, using {@link AttachableStandard#attach()}. + * + * @param the parent definition {@link AttachableStandard#attach()} returns to + */ + interface AttachablePremium { + ParentT attach(); + } + } + + /** + * The entirety of a CDN profile endpoint definition as a part of parent update. + */ + interface UpdateDefinitionStages { + /** + * The first stage of a CDN profile endpoint definition. + */ + interface Blank { + /** + * The stage of the CDN profile endpoint definition allowing to specify the origin. + * + * @param the return type of {@link AttachableStandard#attach()} + */ + interface StandardEndpoint { + /** + * Specifies the origin of the CDN endpoint. + * + * @param originName name of the origin. + * @param originHostName origin host name. + * @return the next stage of the definition + */ + UpdateDefinitionStages.WithStandardAttach withOrigin(String originName, String originHostName); + + /** + * Specifies the origin of the CDN endpoint. + * + * @param originHostName origin host name. + * @return the next stage of the definition + */ + UpdateDefinitionStages.WithStandardAttach withOrigin(String originHostName); + } + + /** + * The stage of the CDN profile endpoint definition allowing to specify the origin + * for CDN Profile with Premium Verizon sku. + * + * @param the return type of {@link AttachablePremium#attach()} + */ + interface PremiumEndpoint { + /** + * Specifies the origin of the CDN endpoint. + * + * @param originName name of the origin. + * @param originHostName origin host name. + * @return the next stage of the definition + */ + UpdateDefinitionStages.WithPremiumAttach withPremiumOrigin(String originName, String originHostName); + + /** + * Specifies the origin of the CDN endpoint. + * + * @param originHostName origin host name. + * @return the next stage of the definition + */ + UpdateDefinitionStages.WithPremiumAttach withPremiumOrigin(String originHostName); + } + } + + /** The final stage of the CDN profile Standard Akamai or Standard Verizon endpoint definition. + *

+ * At this stage, any remaining optional settings can be specified, or the CDN profile endpoint + * definition can be attached to the parent CDN profile definition using {@link CdnEndpoint.DefinitionStages.AttachableStandard#attach()}. + * @param the return type of {@link CdnEndpoint.DefinitionStages.AttachableStandard#attach()} + */ + interface WithStandardAttach + extends AttachableStandard { + /** + * Specifies origin path. + * + * @param originPath origin path. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withOriginPath(String originPath); + + /** + * Specifies host header. + * + * @param hostHeader host header. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHostHeader(String hostHeader); + + /** + * Specifies if http traffic is allowed. + * + * @param httpAllowed if set to true Http traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpAllowed(boolean httpAllowed); + + /** + * Specifies if https traffic is allowed. + * + * @param httpsAllowed if set to true Https traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpsAllowed(boolean httpsAllowed); + + /** + * Specifies http port for http traffic. + * + * @param httpPort http port number. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpPort(int httpPort); + + /** + * Specifies https port for http traffic. + * + * @param httpsPort https port number. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withHttpsPort(int httpsPort); + + /** + * Specifies the content types to compress. + * + * @param contentTypesToCompress the list of content types to compress to set + * @return the next stage of the endpoint definition + */ + WithStandardAttach withContentTypesToCompress(List contentTypesToCompress); + + /** + * Specifies a single content type to compress. + * + * @param contentTypeToCompress a singe content type to compress to add to the list + * @return the next stage of the endpoint definition + */ + WithStandardAttach withContentTypeToCompress(String contentTypeToCompress); + + /** + * Sets the compression state. + * + * @param compressionEnabled if set to true compression will be enabled. If set to false compression will be disabled + * @return the next stage of the endpoint definition + */ + WithStandardAttach withCompressionEnabled(boolean compressionEnabled); + + /** + * Sets the query string caching behavior. + * + * @param cachingBehavior the query string caching behavior value to set + * @return the next stage of the endpoint definition + */ + WithStandardAttach withQueryStringCachingBehavior(QueryStringCachingBehavior cachingBehavior); + + /** + * Sets the geo filters list. + * + * @param geoFilters the Geo filters list to set + * @return the next stage of the endpoint definition + */ + WithStandardAttach withGeoFilters(List geoFilters); + + /** + * Adds a single entry to the Geo filters list. + * + * @param relativePath the relative path. + * @param action the action value. + * @param countryCode the ISO 2 letter country codes. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withGeoFilter(String relativePath, GeoFilterActions action, CountryISOCode countryCode); + + /** + * Sets the geo filters list for the specified countries list. + * + * @param relativePath the relative path. + * @param action the action value. + * @param countryCodes a list of the ISO 2 letter country codes. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withGeoFilter(String relativePath, GeoFilterActions action, List countryCodes); + + /** + * Adds a new CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint definition + */ + WithStandardAttach withCustomDomain(String hostName); + } + + /** The final stage of the CDN profile Premium Verizon endpoint definition. + *

+ * At this stage, any remaining optional settings can be specified, or the CDN profile endpoint + * definition can be attached to the parent CDN profile definition using {@link CdnEndpoint.DefinitionStages.AttachablePremium#attach()}. + * @param the return type of {@link CdnEndpoint.DefinitionStages.AttachablePremium#attach()} + */ + interface WithPremiumAttach + extends AttachablePremium { + /** + * Specifies origin path. + * + * @param originPath origin path. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withOriginPath(String originPath); + + /** + * Specifies host header. + * + * @param hostHeader host header. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHostHeader(String hostHeader); + + /** + * Specifies if http traffic is allowed. + * + * @param httpAllowed if set to true Http traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpAllowed(boolean httpAllowed); + + /** + * Specifies if https traffic is allowed. + * + * @param httpsAllowed if set to true Https traffic will be allowed. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpsAllowed(boolean httpsAllowed); + + /** + * Specifies http port for http traffic. + * + * @param httpPort http port number. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpPort(int httpPort); + + /** + * Specifies https port for http traffic. + * + * @param httpsPort https port number. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withHttpsPort(int httpsPort); + + /** + * Adds a new CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint definition + */ + WithPremiumAttach withCustomDomain(String hostName); + } + + /** + * The final stage of the Standard endpoint object definition, at which it can be attached to the parent, using {@link AttachableStandard#attach()}. + * + * @param the parent definition {@link AttachableStandard#attach()} returns to + */ + interface AttachableStandard { + ParentT attach(); + } + + /** + * The final stage of the Premium Verizon endpoint object definition, at which it can be attached to the parent, using {@link AttachableStandard#attach()}. + * + * @param the parent definition {@link AttachableStandard#attach()} returns to + */ + interface AttachablePremium { + ParentT attach(); + } + } + + /** + * The stage of an CDN profile endpoint update allowing to specify endpoint properties. + */ + interface UpdateStandardEndpoint extends Update { + /** + * Specifies origin path. + * + * @param originPath origin path. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withOriginPath(String originPath); + + /** + * Specifies host header. + * + * @param hostHeader host header. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withHostHeader(String hostHeader); + /** + * Specifies if http traffic is allowed. + * + * @param httpAllowed if set to true Http traffic will be allowed. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withHttpAllowed(boolean httpAllowed); + + /** + * Specifies if https traffic is allowed. + * + * @param httpsAllowed if set to true Https traffic will be allowed. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withHttpsAllowed(boolean httpsAllowed); + + /** + * Specifies http port for http traffic. + * + * @param httpPort http port number. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withHttpPort(int httpPort); + + /** + * Specifies https port for http traffic. + * + * @param httpsPort https port number. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withHttpsPort(int httpsPort); + + /** + * Specifies the content types to compress. + * + * @param contentTypesToCompress the list of content types to compress to set + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withContentTypesToCompress(List contentTypesToCompress); + + /** + * Clears entire list of content types to compress . + * + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withoutContentTypesToCompress(); + + /** + * Specifies a single content type to compress. + * + * @param contentTypeToCompress a singe content type to compress to add to the list + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withContentTypeToCompress(String contentTypeToCompress); + + /** + * Removes the content type to compress value from the list. + * + * @param contentTypeToCompress a singe content type to remove from the list + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withoutContentTypeToCompress(String contentTypeToCompress); + + /** + * Sets the compression state. + * + * @param compressionEnabled if set to true compression will be enabled. If set to false compression will be disabled + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withCompressionEnabled(boolean compressionEnabled); + + /** + * Sets the query string caching behavior. + * + * @param cachingBehavior the query string caching behavior value to set + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withQueryStringCachingBehavior(QueryStringCachingBehavior cachingBehavior); + + /** + * Sets the geo filters list. + * + * @param geoFilters the Geo filters list to set + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withGeoFilters(List geoFilters); + + /** + * Clears entire geo filters list. + * + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withoutGeoFilters(); + + /** + * Adds a single entry to the Geo filters list. + * + * @param relativePath the relative path. + * @param action the action value. + * @param countryCode the ISO 2 letter country codes. + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withGeoFilter(String relativePath, GeoFilterActions action, CountryISOCode countryCode); + + /** + * Sets the geo filters list for the specified countries list. + * + * @param relativePath the relative path. + * @param action the action value. + * @param countryCodes a list of the ISO 2 letter country codes. + * @return the next stage of the endpoint definition + */ + UpdateStandardEndpoint withGeoFilter(String relativePath, GeoFilterActions action, List countryCodes); + + /** + * Removes an entry from the geo filters list. + * + * @param relativePath the relative path value. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withoutGeoFilter(String relativePath); + + /** + * Adds a new CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withCustomDomain(String hostName); + + /** + * Removes CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint update + */ + UpdateStandardEndpoint withoutCustomDomain(String hostName); + } + + /** + * The stage of an CDN profile endpoint update allowing to specify endpoint properties. + */ + interface UpdatePremiumEndpoint extends Update { + /** + * Specifies origin path. + * + * @param originPath origin path. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withOriginPath(String originPath); + + /** + * Specifies host header. + * + * @param hostHeader host header. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withHostHeader(String hostHeader); + + /** + * Specifies if http traffic is allowed. + * + * @param httpAllowed if set to true Http traffic will be allowed. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withHttpAllowed(boolean httpAllowed); + + /** + * Specifies if https traffic is allowed. + * + * @param httpsAllowed if set to true Https traffic will be allowed. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withHttpsAllowed(boolean httpsAllowed); + + /** + * Specifies http port for http traffic. + * + * @param httpPort http port number. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withHttpPort(int httpPort); + + /** + * Specifies https port for http traffic. + * + * @param httpsPort https port number. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withHttpsPort(int httpsPort); + + /** + * Adds a new CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withCustomDomain(String hostName); + + /** + * Removes CDN custom domain within an endpoint. + * + * @param hostName custom domain host name. + * @return the next stage of the endpoint update + */ + UpdatePremiumEndpoint withoutCustomDomain(String hostName); + } + + /** + * The set of configurations that can be updated for all endpoint irrespective of their type. + */ + interface Update extends + Settable { + } +} \ No newline at end of file diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfile.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfile.java new file mode 100644 index 000000000000..455fa372aeb5 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfile.java @@ -0,0 +1,362 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn; + +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.cdn.implementation.ProfileInner; +import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; +import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; +import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; +import com.microsoft.azure.management.resources.fluentcore.model.Updatable; +import com.microsoft.azure.management.resources.fluentcore.model.Wrapper; + +import java.util.List; +import java.util.Map; + +/** + * An immutable client-side representation of an Azure CDN profile. + */ +@Fluent +public interface CdnProfile extends + GroupableResource, + Refreshable, + Wrapper, + Updatable { + + /** + * @return Sku. + */ + Sku sku(); + + /** + * @return CDN profile state. + */ + String resourceState(); + + /** + * @return endpoints in the CDN manager profile, indexed by the name + */ + Map endpoints(); + + /** + * Generates a dynamic SSO URI used to sign in to the CDN supplemental portal used for advanced management tasks. + * + * @return URI used to login to third party web portal. + */ + String generateSsoUri(); + + /** + * Starts stopped CDN endpoint in current profile. + * + * @param endpointName name of the endpoint under the profile which is unique globally. + */ + void startEndpoint(String endpointName); + + /** + * Stops running CDN endpoint in the current profile. + * + * @param endpointName name of the endpoint under the profile which is unique globally. + */ + void stopEndpoint(String endpointName); + + /** + * Forcibly purges CDN endpoint content in current profile. + * + * @param endpointName name of the endpoint under the profile which is unique globally. + * @param contentPaths the path to the content to be purged. Can describe a file path or a wild card directory. + */ + void purgeEndpointContent(String endpointName, List contentPaths); + + /** + * Forcibly pre-loads CDN endpoint content in current profile. Available for Verizon Profiles. + * + * @param endpointName name of the endpoint under the profile which is unique globally. + * @param contentPaths the path to the content to be loaded. Should describe a file path. + */ + void loadEndpointContent(String endpointName, List contentPaths); + + /** + * Validates a custom domain mapping to ensure it maps to the correct CNAME in DNS in current profile. + * + * @param endpointName name of the endpoint under the profile which is unique globally. + * @param hostName the host name of the custom domain. Must be a domain name. + * @return CustomDomainValidationResult object if successful. + */ + CustomDomainValidationResult validateEndpointCustomDomain(String endpointName, String hostName); + + /** + * Checks the availability of a endpoint name without creating the CDN endpoint. + * + * @param name the endpoint resource name to validate. + * @return the CheckNameAvailabilityResult object if successful. + */ + CheckNameAvailabilityResult checkEndpointNameAvailability(String name); + + /** + * Checks if current instance of CDN profile Sku is Premium Verizon. + * + * @return true if current instance of CDN Profile Sku is of Premium Verizon, false otherwise. + */ + boolean isPremiumVerizon(); + + /************************************************************** + * Fluent interfaces to provision a CDN. + **************************************************************/ + /** + * The entirety of the CDN profile. + */ + interface Definition extends + DefinitionStages.Blank, + DefinitionStages.WithGroup, + DefinitionStages.WithSku, + DefinitionStages.WithStandardCreate, + DefinitionStages.WithPremiumVerizonCreate, + DefinitionStages.WithCreate { + } + + /** + * Grouping of CDN profile definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CDN profile definition. + */ + interface Blank extends DefinitionWithRegion { + } + + /** + * A Redis Cache definition allowing resource group to be set. + */ + interface WithGroup extends GroupableResource.DefinitionStages.WithGroup { + } + + /** + * A CDN profile definition allowing the sku to be set. + */ + interface WithSku { + /** + * Specifies the Standard Akamai sku of the CDN profile. + * + * @return the next stage of CDN profile definition. + */ + WithStandardCreate withStandardAkamaiSku(); + + /** + * Specifies the Standard Verizon sku of the CDN profile. + * + * @return the next stage of CDN profile definition. + */ + WithStandardCreate withStandardVerizonSku(); + + /** + * Specifies the Premium Verizon sku of the CDN profile. + * + * @return the next stage of CDN profile definition. + */ + WithPremiumVerizonCreate withPremiumVerizonSku(); + } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created + * (via {@link WithCreate#create()}), but also allows for any other optional settings to be specified. + */ + interface WithStandardCreate extends WithCreate { + /** + * Adds new endpoint to current CDN profile. + * + * @param endpointOriginHostname the endpoint origin hostname. + * @return the next stage of CDN profile definition. + */ + WithStandardCreate withNewEndpoint(String endpointOriginHostname); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.DefinitionStages.Blank.StandardEndpoint defineNewEndpoint(); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @param name the name for the endpoint + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.DefinitionStages.Blank.StandardEndpoint defineNewEndpoint(String name); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @param name the name for the endpoint + * @param endpointOriginHostname the endpoint origin hostname. + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.DefinitionStages.WithStandardAttach defineNewEndpoint(String name, String endpointOriginHostname); + } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created + * (via {@link WithCreate#create()}), but also allows for any other optional settings to be specified. + */ + interface WithPremiumVerizonCreate extends WithCreate { + /** + * Adds new endpoint to current CDN profile. + * + * @param endpointOriginHostname the endpoint origin hostname. + * @return the next stage of CDN profile definition. + */ + WithPremiumVerizonCreate withNewPremiumEndpoint(String endpointOriginHostname); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint defineNewPremiumEndpoint(); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @param name the name for the endpoint + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint defineNewPremiumEndpoint(String name); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @param name the name for the endpoint + * @param endpointOriginHostname the endpoint origin hostname. + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.DefinitionStages.WithPremiumAttach defineNewPremiumEndpoint(String name, String endpointOriginHostname); + } + + /** + * The stage of the definition which contains all the minimum required inputs for the resource to be created + * (via {@link WithCreate#create()}), but also allows for any other optional settings to be specified. + */ + interface WithCreate extends + Creatable, + Resource.DefinitionWithTags { + } + } + + /** + * Grouping of CDN manager update stages. + */ + interface UpdateStages { + /** + * The stage of the CDN profile update allowing to specify the endpoints + * for the profile. + */ + interface WithEndpoint { + /** + * Adds new endpoint to current CDN profile. + * + * @param endpointOriginHostname the endpoint origin hostname. + * @return the next stage of CDN profile update. + */ + Update withNewEndpoint(String endpointOriginHostname); + + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.UpdateDefinitionStages.Blank.StandardEndpoint defineNewEndpoint(); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @param name the name for the endpoint + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.UpdateDefinitionStages.Blank.StandardEndpoint defineNewEndpoint(String name); + + /** + * Specifies definition of an endpoint to be attached to the CDN profile. + * + * @param name the name for the endpoint + * @param endpointOriginHostname the endpoint origin hostname. + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.UpdateDefinitionStages.WithStandardAttach defineNewEndpoint(String name, String endpointOriginHostname); + + /** + * Adds new endpoint to current Premium Verizon CDN profile. + * + * @param endpointOriginHostname the endpoint origin hostname. + * @return the next stage of CDN profile update. + */ + Update withNewPremiumEndpoint(String endpointOriginHostname); + + /** + * Specifies definition of an endpoint to be attached to the current Premium Verizon CDN profile. + * + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.UpdateDefinitionStages.Blank.PremiumEndpoint defineNewPremiumEndpoint(); + + /** + * Specifies definition of an endpoint to be attached to the current Premium Verizon CDN profile. + * + * @param name the name for the endpoint + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.UpdateDefinitionStages.Blank.PremiumEndpoint defineNewPremiumEndpoint(String name); + + /** + * Specifies definition of an endpoint to be attached to the current Premium Verizon CDN profile. + * + * @param name the name for the endpoint + * @param endpointOriginHostname the endpoint origin hostname. + * @return the stage representing configuration for the endpoint + */ + CdnEndpoint.UpdateDefinitionStages.WithPremiumAttach defineNewPremiumEndpoint(String name, String endpointOriginHostname); + + /** + * Begins the description of an update of an existing endpoint in current profile. + * + * @param name the name of the endpoint + * @return the stage representing updating configuration for the endpoint + */ + CdnEndpoint.UpdateStandardEndpoint updateEndpoint(String name); + + /** + * Begins the description of an update of an existing endpoint in current Premium Verizon profile. + * + * @param name the name of the endpoint + * @return the stage representing updating configuration for the endpoint + */ + CdnEndpoint.UpdatePremiumEndpoint updatePremiumEndpoint(String name); + + /** + * Removes an endpoint in the profile. + * + * @param name the name of the endpoint + * @return the next stage of the CDN profile update + */ + Update withoutEndpoint(String name); + } + } + + /** + * The template for an update operation, containing all the settings that + * can be modified. + *

+ * Call {@link Update#apply()} to apply the changes to the resource in Azure. + */ + interface Update extends + Appliable, + UpdateStages.WithEndpoint, + Resource.UpdateWithTags { + } +} \ No newline at end of file diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfiles.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfiles.java new file mode 100644 index 000000000000..028b76a46eba --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnProfiles.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.apigeneration.Fluent; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByGroup; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByGroup; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingById; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsListingByGroup; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsBatchCreation; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; + +import java.util.List; + +/** + * Entry point for CDN profile management API. + */ +@Fluent +public interface CdnProfiles extends + SupportsCreating, + SupportsListing, + SupportsListingByGroup, + SupportsGettingByGroup, + SupportsGettingById, + SupportsDeletingById, + SupportsDeletingByGroup, + SupportsBatchCreation { + + /** + * Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. + * Supplemental portal is used to configure advanced feature capabilities that are not + * yet available in the Azure portal, such as core reports in a standard profile; + * rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. + * The SSO URI changes approximately every 10 minutes. + * + * @param resourceGroupName name of the resource group within the Azure subscription. + * @param profileName name of the CDN profile which is unique within the resource group. + * @return the Sso Uri string if successful. + */ + String generateSsoUri(String resourceGroupName, String profileName); + + /** + * Checks the availability of a endpoint name without creating the CDN endpoint. + * + * @param name The endpoint resource name to validate. + * @return the CheckNameAvailabilityResult object if successful. + */ + CheckNameAvailabilityResult checkEndpointNameAvailability(String name); + + /** + * Lists all of the available CDN REST API operations. + * + * @return list of available CDN REST operations. + */ + PagedList listOperations(); + + /** + * Starts an existing stopped CDN endpoint. + * + * @param resourceGroupName name of the resource group within the Azure subscription. + * @param profileName name of the CDN profile which is unique within the resource group. + * @param endpointName name of the endpoint under the profile which is unique globally. + */ + void startEndpoint(String resourceGroupName, String profileName, String endpointName); + + /** + * Stops an existing running CDN endpoint. + * + * @param resourceGroupName name of the resource group within the Azure subscription. + * @param profileName name of the CDN profile which is unique within the resource group. + * @param endpointName name of the endpoint under the profile which is unique globally. + */ + void stopEndpoint(String resourceGroupName, String profileName, String endpointName); + + /** + * Forcibly purges CDN endpoint content. + * + * @param resourceGroupName name of the resource group within the Azure subscription. + * @param profileName name of the CDN profile which is unique within the resource group. + * @param endpointName name of the endpoint under the profile which is unique globally. + * @param contentPaths the path to the content to be purged. Can describe a file path or a wild card directory. + */ + void purgeEndpointContent(String resourceGroupName, String profileName, String endpointName, List contentPaths); + + /** + * Forcibly pre-loads CDN endpoint content. Available for Verizon profiles. + * + * @param resourceGroupName name of the resource group within the Azure subscription. + * @param profileName name of the CDN profile which is unique within the resource group. + * @param endpointName name of the endpoint under the profile which is unique globally. + * @param contentPaths the path to the content to be loaded. Should describe a file path. + */ + void loadEndpointContent(String resourceGroupName, String profileName, String endpointName, List contentPaths); +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityResult.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..f0a3211ffce2 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CheckNameAvailabilityResult.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn; + +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.implementation.CheckNameAvailabilityOutputInner; + +/** + * Result of the custom domain validation. + */ +@LangDefinition +public class CheckNameAvailabilityResult { + private CheckNameAvailabilityOutputInner inner; + + /** + * Construct CheckNameAvailabilityResult object from server response object. + * + * @param inner server response for CheckNameAvailability request. + */ + public CheckNameAvailabilityResult(CheckNameAvailabilityOutputInner inner) { + this.inner = inner; + } + + /** + * Indicates whether the name is available. + * + * @return the nameAvailable value + */ + public boolean nameAvailable() { + return this.inner.nameAvailable(); + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public String reason() { + return this.inner.reason(); + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.inner.message(); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainValidationResult.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainValidationResult.java new file mode 100644 index 000000000000..1cf83b2abc03 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CustomDomainValidationResult.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn; + + +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.implementation.ValidateCustomDomainOutputInner; + +/** + * The {@link com.microsoft.azure.management.cdn.CdnProfile#validateEndpointCustomDomain(String, String)} action result. + */ +@LangDefinition +public class CustomDomainValidationResult { + private ValidateCustomDomainOutputInner inner; + + /** + * Construct CustomDomainValidationResult object from server response object. + * + * @param inner server response for CustomDomainValidation request. + */ + public CustomDomainValidationResult(ValidateCustomDomainOutputInner inner) { + this.inner = inner; + } + + /** + * Get the customDomainValidated value. + * + * @return the customDomainValidated value + */ + public boolean customDomainValidated() { + return this.inner.customDomainValidated(); + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public String reason() { + return this.inner.reason(); + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.inner.message(); + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Operation.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Operation.java new file mode 100644 index 000000000000..5113f84c745d --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Operation.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn; + +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.implementation.OperationInner; + +/** + * Operation that CDN service supports. + */ +@LangDefinition +public class Operation { + private OperationInner inner; + + /** + * Construct Operation object from server response object. + * + * @param inner server response object containing supported operation description. + */ + public Operation(OperationInner inner) { + this.inner = inner; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.inner.name(); + } + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + if (this.inner.display() == null) { + return null; + } + return this.inner.display().provider(); + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + if (this.inner.display() == null) { + return null; + } + return this.inner.display().resource(); + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String type() { + if (this.inner.display() == null) { + return null; + } + return this.inner.display().operation(); + } + +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointImpl.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointImpl.java new file mode 100644 index 000000000000..8bd5a2eb07bc --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointImpl.java @@ -0,0 +1,543 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.google.common.base.Function; +import com.google.common.collect.Lists; +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.CdnEndpoint; +import com.microsoft.azure.management.cdn.CdnProfile; +import com.microsoft.azure.management.cdn.CustomDomainValidationResult; +import com.microsoft.azure.management.cdn.DeepCreatedOrigin; +import com.microsoft.azure.management.cdn.EndpointResourceState; +import com.microsoft.azure.management.cdn.GeoFilter; +import com.microsoft.azure.management.cdn.GeoFilterActions; +import com.microsoft.azure.management.cdn.QueryStringCachingBehavior; +import com.microsoft.azure.management.resources.fluentcore.arm.CountryISOCode; +import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.ExternalChildResourceImpl; +import com.microsoft.azure.management.resources.fluentcore.utils.ResourceNamer; +import rx.Observable; +import rx.functions.Action1; +import rx.functions.Func1; +import rx.functions.Func3; +import rx.functions.FuncN; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +/** + * Implementation for {@link CdnEndpoint}. + */ +@LangDefinition +class CdnEndpointImpl extends ExternalChildResourceImpl + implements CdnEndpoint, + + CdnEndpoint.DefinitionStages.Blank.StandardEndpoint, + CdnEndpoint.DefinitionStages.Blank.PremiumEndpoint, + CdnEndpoint.DefinitionStages.WithStandardAttach, + CdnEndpoint.DefinitionStages.WithPremiumAttach, + + CdnEndpoint.UpdateDefinitionStages.Blank.StandardEndpoint, + CdnEndpoint.UpdateDefinitionStages.Blank.PremiumEndpoint, + CdnEndpoint.UpdateDefinitionStages.WithStandardAttach, + CdnEndpoint.UpdateDefinitionStages.WithPremiumAttach, + + CdnEndpoint.UpdateStandardEndpoint, + CdnEndpoint.UpdatePremiumEndpoint { + + private final EndpointsInner client; + private final OriginsInner originsClient; + private final CustomDomainsInner customDomainsClient; + private List customDomainList; + private List deletedCustomDomainList; + + CdnEndpointImpl(String name, + CdnProfileImpl parent, + EndpointInner inner, + EndpointsInner client, + OriginsInner originsClient, + CustomDomainsInner customDomainsClient) { + super(name, parent, inner); + this.client = client; + this.originsClient = originsClient; + this.customDomainsClient = customDomainsClient; + this.customDomainList = new ArrayList(); + this.deletedCustomDomainList = new ArrayList(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Observable createAsync() { + final CdnEndpointImpl self = this; + return this.client.createAsync(this.parent().resourceGroupName(), + this.parent().name(), + this.name(), + this.inner()) + .map(new Func1() { + @Override + public CdnEndpoint call(EndpointInner inner) { + self.setInner(inner); + for (CustomDomainInner itemToCreate : self.customDomainList) { + self.customDomainsClient.create( + self.parent().resourceGroupName(), + self.parent().name(), + self.name(), + ResourceNamer.randomResourceName("CustomDomain", 50), + itemToCreate.hostName()); + } + self.customDomainList.clear(); + self.customDomainList.addAll(self.customDomainsClient.listByEndpoint( + self.parent().resourceGroupName(), + self.parent().name(), + self.name())); + return self; + } + }); + } + + @Override + public Observable updateAsync() { + final CdnEndpointImpl self = this; + EndpointUpdateParametersInner updateInner = new EndpointUpdateParametersInner(); + updateInner.withIsHttpAllowed(this.inner().isHttpAllowed()) + .withIsHttpsAllowed(this.inner().isHttpsAllowed()) + .withOriginPath(this.inner().originPath()) + .withOriginHostHeader(this.inner().originHostHeader()) + .withIsCompressionEnabled(this.inner().isCompressionEnabled()) + .withContentTypesToCompress(this.inner().contentTypesToCompress()) + .withGeoFilters(this.inner().geoFilters()) + .withOptimizationType(this.inner().optimizationType()) + .withQueryStringCachingBehavior(this.inner().queryStringCachingBehavior()) + .withTags(this.inner().getTags()); + + DeepCreatedOrigin originInner = this.inner().origins().get(0); + OriginUpdateParametersInner originParameters = new OriginUpdateParametersInner() + .withHostName(originInner.hostName()) + .withHttpPort(originInner.httpPort()) + .withHttpsPort(originInner.httpsPort()); + + Observable originObservable = this.originsClient.updateAsync( + this.parent().resourceGroupName(), + this.parent().name(), + this.name(), + originInner.name(), + originParameters); + + Observable endpointObservable = this.client.updateAsync( + this.parent().resourceGroupName(), + this.parent().name(), + this.name(), + updateInner) + .map(new Func1() { + @Override + public CdnEndpoint call(EndpointInner inner) { + self.setInner(inner); + return self; + } + }); + + List> customDomainDeleteObservables = new ArrayList<>(); + + for (CustomDomainInner itemToDelete : this.deletedCustomDomainList) { + customDomainDeleteObservables.add(this.customDomainsClient.deleteAsync( + this.parent().resourceGroupName(), + this.parent().name(), + this.name(), + itemToDelete.name())); + } + Observable deleteObservable = Observable.zip(customDomainDeleteObservables, new FuncN() { + @Override + public CustomDomainInner call(Object... objects) { + return null; + } + }); + + return Observable.zip( + originObservable, + endpointObservable, + deleteObservable, + new Func3() { + @Override + public CdnEndpoint call(OriginInner originInner, CdnEndpoint cdnEndpoint, CustomDomainInner customDomain) { + return cdnEndpoint; + } + }).doOnNext(new Action1() { + @Override + public void call(CdnEndpoint cdnEndpoint) { + self.deletedCustomDomainList.clear(); + } + }); + } + + + @Override + public Observable deleteAsync() { + return this.client.deleteAsync(this.parent().resourceGroupName(), + this.parent().name(), + this.name()).map(new Func1() { + @Override + public Void call(Void result) { + return result; + } + }); + } + + @Override + public CdnEndpointImpl refresh() { + EndpointInner inner = this.client.get(this.parent().resourceGroupName(), + this.parent().name(), + this.name()); + this.setInner(inner); + this.customDomainList.clear(); + this.deletedCustomDomainList.clear(); + this.customDomainList.addAll(this.customDomainsClient.listByEndpoint( + this.parent().resourceGroupName(), + this.parent().name(), + this.name())); + return this; + } + + @Override + public CdnProfileImpl attach() { + return this.parent().withEndpoint(this); + } + + @Override + public String originHostHeader() { + return this.inner().originHostHeader(); + } + + @Override + public String originPath() { + return this.inner().originPath(); + } + + @Override + public List contentTypesToCompress() { + return this.inner().contentTypesToCompress(); + } + + @Override + public boolean isCompressionEnabled() { + return this.inner().isCompressionEnabled(); + } + + @Override + public boolean isHttpAllowed() { + return this.inner().isHttpAllowed(); + } + + @Override + public boolean isHttpsAllowed() { + return this.inner().isHttpsAllowed(); + } + + @Override + public QueryStringCachingBehavior queryStringCachingBehavior() { + return this.inner().queryStringCachingBehavior(); + } + + @Override + public String optimizationType() { + return this.inner().optimizationType(); + } + + @Override + public List geoFilters() { + return this.inner().geoFilters(); + } + + @Override + public String hostName() { + return this.inner().hostName(); + } + + @Override + public EndpointResourceState resourceState() { + return this.inner().resourceState(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String originHostName() { + if (this.inner().origins() != null && !this.inner().origins().isEmpty()) { + return this.inner().origins().get(0).hostName(); + } + return null; + } + + @Override + public int httpPort() { + if (this.inner().origins() != null && !this.inner().origins().isEmpty()) { + return this.inner().origins().get(0).httpPort(); + } + return 0; + } + + @Override + public int httpsPort() { + if (this.inner().origins() != null && !this.inner().origins().isEmpty()) { + return this.inner().origins().get(0).httpsPort(); + } + return 0; + } + + @Override + public List customDomains() { + return Collections.unmodifiableList( + Lists.transform(this.customDomainList, + new Function() { + public String apply(CustomDomainInner customDomain) { + return customDomain.hostName(); + } + })); + } + + @Override + public void start() { + this.parent().startEndpoint(this.name()); + } + + @Override + public void stop() { + this.parent().stopEndpoint(this.name()); + } + + @Override + public void purgeContent(List contentPaths) { + this.parent().purgeEndpointContent(this.name(), contentPaths); + } + + @Override + public void loadContent(List contentPaths) { + this.parent().loadEndpointContent(this.name(), contentPaths); + } + + @Override + public CustomDomainValidationResult validateCustomDomain(String hostName) { + return this.parent().validateEndpointCustomDomain(this.name(), hostName); + } + + @Override + public CdnEndpointImpl withOrigin(String originName, String hostname) { + this.inner().origins().add( + new DeepCreatedOrigin() + .withName(originName) + .withHostName(hostname)); + return this; + } + + @Override + public CdnEndpointImpl withOrigin(String hostname) { + return this.withOrigin("origin", hostname); + } + + @Override + public CdnEndpointImpl withPremiumOrigin(String originName, String hostname) { + return this.withOrigin(originName, hostname); + } + + @Override + public CdnEndpointImpl withPremiumOrigin(String hostname) { + return this.withOrigin(hostname); + } + + @Override + public CdnEndpointImpl withOriginPath(String originPath) { + this.inner().withOriginPath(originPath); + return this; + } + + @Override + public CdnEndpointImpl withHttpAllowed(boolean httpAllowed) { + this.inner().withIsHttpAllowed(httpAllowed); + return this; + } + + @Override + public CdnEndpointImpl withHttpsAllowed(boolean httpsAllowed) { + this.inner().withIsHttpsAllowed(httpsAllowed); + return this; + } + + @Override + public CdnEndpointImpl withHttpPort(int httpPort) { + if (this.inner().origins() != null && !this.inner().origins().isEmpty()) { + this.inner().origins().get(0).withHttpPort(httpPort); + } + return this; + } + + @Override + public CdnEndpointImpl withHttpsPort(int httpsPort) { + if (this.inner().origins() != null && !this.inner().origins().isEmpty()) { + this.inner().origins().get(0).withHttpsPort(httpsPort); + } + return this; + } + + @Override + public CdnEndpointImpl withHostHeader(String hostHeader) { + this.inner().withOriginHostHeader(hostHeader); + return this; + } + + @Override + public CdnEndpointImpl withContentTypesToCompress(List contentTypesToCompress) { + this.inner().withContentTypesToCompress(contentTypesToCompress); + return this; + } + + @Override + public CdnEndpointImpl withoutContentTypesToCompress() { + if (this.inner().contentTypesToCompress() != null) { + this.inner().contentTypesToCompress().clear(); + } + return this; + } + + @Override + public CdnEndpointImpl withContentTypeToCompress(String contentTypeToCompress) { + if (this.inner().contentTypesToCompress() == null) { + this.inner().withContentTypesToCompress(new ArrayList()); + } + this.inner().contentTypesToCompress().add(contentTypeToCompress); + return this; + } + + @Override + public CdnEndpointImpl withoutContentTypeToCompress(String contentTypeToCompress) { + if (this.inner().contentTypesToCompress() != null) { + this.inner().contentTypesToCompress().remove(contentTypeToCompress); + } + return this; + } + + @Override + public CdnEndpointImpl withCompressionEnabled(boolean compressionEnabled) { + this.inner().withIsCompressionEnabled(compressionEnabled); + return this; + } + + @Override + public CdnEndpointImpl withQueryStringCachingBehavior(QueryStringCachingBehavior cachingBehavior) { + this.inner().withQueryStringCachingBehavior(cachingBehavior); + return this; + } + + @Override + public CdnEndpointImpl withGeoFilters(List geoFilters) { + this.inner().withGeoFilters(geoFilters); + return this; + } + + @Override + public CdnEndpointImpl withoutGeoFilters() { + if (this.inner().geoFilters() != null) { + this.inner().geoFilters().clear(); + } + return this; + } + + @Override + public CdnEndpointImpl withGeoFilter(String relativePath, GeoFilterActions action, CountryISOCode countryCode) { + GeoFilter geoFilter = this.createGeoFiltersObject(relativePath, action); + + if (geoFilter.countryCodes() == null) { + geoFilter.withCountryCodes(new ArrayList()); + } + geoFilter.countryCodes().add(countryCode.toString()); + + this.inner().geoFilters().add(geoFilter); + return this; + } + + @Override + public CdnEndpointImpl withGeoFilter(String relativePath, GeoFilterActions action, List countryCodes) { + GeoFilter geoFilter = this.createGeoFiltersObject(relativePath, action); + + if (geoFilter.countryCodes() == null) { + geoFilter.withCountryCodes(new ArrayList()); + } else { + geoFilter.countryCodes().isEmpty(); + } + + for (CountryISOCode countryCode : countryCodes) { + geoFilter.countryCodes().add(countryCode.toString()); + } + + this.inner().geoFilters().add(geoFilter); + return this; + } + + @Override + public CdnEndpointImpl withoutGeoFilter(String relativePath) { + for (Iterator iter = this.inner().geoFilters().listIterator(); iter.hasNext();) { + GeoFilter geoFilter = iter.next(); + if (geoFilter.relativePath().equals(relativePath)) { + iter.remove(); + } + } + return this; + } + + @Override + public CdnEndpointImpl withCustomDomain(String hostName) { + if (this.customDomainList != null) { + this.customDomainList.add(new CustomDomainInner().withHostName(hostName)); + } + return this; + } + + @Override + public CdnEndpointImpl withoutCustomDomain(String hostName) { + for (Iterator iter = this.customDomainList.listIterator(); iter.hasNext();) { + CustomDomainInner customDomain = iter.next(); + if (hostName.equals(customDomain.hostName())) { + iter.remove(); + deletedCustomDomainList.add(customDomain); + } + } + return this; + } + + private GeoFilter createGeoFiltersObject(String relativePath, GeoFilterActions action) { + if (this.inner().geoFilters() == null) { + this.inner().withGeoFilters(new ArrayList()); + } + GeoFilter geoFilter = null; + for (GeoFilter filter : this.inner().geoFilters()) { + if (filter.relativePath().equals(relativePath)) { + geoFilter = filter; + break; + } + } + if (geoFilter == null) { + geoFilter = new GeoFilter(); + } + else { + this.inner().geoFilters().remove(geoFilter); + } + geoFilter.withRelativePath(relativePath) + .withAction(action); + + return geoFilter; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointsImpl.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointsImpl.java new file mode 100644 index 000000000000..20c8098c99fb --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnEndpointsImpl.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.CdnEndpoint; +import com.microsoft.azure.management.cdn.CdnProfile; +import com.microsoft.azure.management.cdn.CheckNameAvailabilityResult; +import com.microsoft.azure.management.cdn.DeepCreatedOrigin; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.ExternalChildResourcesCachedImpl; +import com.microsoft.azure.management.resources.fluentcore.utils.ResourceNamer; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Represents an endpoint collection associated with a CDN manager profile. + */ +@LangDefinition +class CdnEndpointsImpl extends + ExternalChildResourcesCachedImpl { + private final EndpointsInner client; + private final OriginsInner originsClient; + private final CustomDomainsInner customDomainsClient; + + CdnEndpointsImpl(EndpointsInner client, + OriginsInner originsClient, + CustomDomainsInner customDomainsClient, + CdnProfileImpl parent) { + super(parent, "Endpoint"); + this.client = client; + this.originsClient = originsClient; + this.customDomainsClient = customDomainsClient; + } + + /** + * @return the azure endpoints as a map indexed by name. + */ + Map endpointsAsMap() { + Map result = new HashMap<>(); + for (Map.Entry entry : this.collection().entrySet()) { + CdnEndpointImpl endpoint = entry.getValue(); + result.put(entry.getKey(), endpoint); + } + return Collections.unmodifiableMap(result); + } + + /** + * Mark the endpoint with given name as to be removed. + * + * @param name the name of the endpoint to be removed + */ + public void remove(String name) { + this.prepareRemove(name); + } + + /** + * Adds the endpoint to the collection. + * + * @param endpoint the endpoint + */ + public void addEndpoint(CdnEndpointImpl endpoint) { + this.addChildResource(endpoint); + } + + @Override + protected List listChildResources() { + List childResources = new ArrayList<>(); + + for (EndpointInner innerEndpoint : this.client.listByProfile( + this.parent().resourceGroupName(), + this.parent().name())) { + childResources.add(new CdnEndpointImpl(innerEndpoint.name(), + this.parent(), + innerEndpoint, + this.client, + this.originsClient, + this.customDomainsClient)); + } + return Collections.unmodifiableList(childResources); + } + + @Override + protected CdnEndpointImpl newChildResource(String name) { + CdnEndpointImpl endpoint = new CdnEndpointImpl(name, + this.parent(), + new EndpointInner(), + this.client, + this.originsClient, + this.customDomainsClient); + + return endpoint; + } + + public CdnEndpointImpl defineNewEndpoint(String endpointName, String originName, String endpointOriginHostname) { + CdnEndpointImpl endpoint = this.defineNewEndpoint(endpointName); + endpoint.inner().origins().add( + new DeepCreatedOrigin() + .withName(originName) + .withHostName(endpointOriginHostname)); + return endpoint; + } + + public CdnEndpointImpl defineNewEndpoint(String endpointName, String endpointOriginHostname) { + return this.defineNewEndpoint(endpointName, "origin", endpointOriginHostname); + } + + public CdnEndpointImpl defineNewEndpoint(String name) { + CdnEndpointImpl endpoint = this.prepareDefine(name); + endpoint.inner().withLocation(endpoint.parent().region().toString()); + endpoint.inner().withOrigins(new ArrayList()); + return endpoint; + } + + + public CdnEndpointImpl defineNewEndpoint() { + String endpointName = this.generateUniqueEndpointName("Endpoint"); + return this.defineNewEndpoint(endpointName); + } + + public CdnEndpointImpl defineNewEndpointWithOriginHostname(String endpointOriginHostname) { + String endpointName = this.generateUniqueEndpointName("Endpoint"); + CdnEndpointImpl endpoint = this.defineNewEndpoint(endpointName, "origin", endpointOriginHostname); + return endpoint; + } + + public CdnEndpointImpl updateEndpoint(String name) { + CdnEndpointImpl endpoint = this.prepareUpdate(name); + return endpoint; + } + + private String generateUniqueEndpointName(String endpointNamePrefix) { + String endpointName; + CheckNameAvailabilityResult result; + + do { + endpointName = ResourceNamer.randomResourceName(endpointNamePrefix, 50); + + result = this.parent().checkEndpointNameAvailability(endpointName); + + } while (!result.nameAvailable()); + + return endpointName; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManager.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManager.java new file mode 100644 index 000000000000..edd589c315f9 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnManager.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.RestClient; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.cdn.CdnProfiles; +import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable; +import com.microsoft.azure.management.resources.fluentcore.arm.implementation.AzureConfigurableImpl; +import com.microsoft.azure.management.resources.fluentcore.arm.implementation.Manager; + +/** + * Entry point to Azure CDN management. + */ +public final class CdnManager extends Manager { + // Collections + private CdnProfiles profiles; + + /** + * Get a Configurable instance that can be used to create {@link CdnManager} + * with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new CdnManager.ConfigurableImpl(); + } + + /** + * Creates an instance of TrafficManager that exposes traffic manager management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the TrafficManager + */ + public static CdnManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new CdnManager(credentials.getEnvironment().newRestClientBuilder() + .withCredentials(credentials) + .build(), subscriptionId); + } + + /** + * Creates an instance of TrafficManager that exposes traffic manager management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the TrafficManager + */ + public static CdnManager authenticate(RestClient restClient, String subscriptionId) { + return new CdnManager(restClient, subscriptionId); + } + + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of TrafficManager that exposes traffic manager management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing traffic manager management API entry points that work across subscriptions + */ + CdnManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * The implementation for Configurable interface. + */ + private static class ConfigurableImpl + extends AzureConfigurableImpl + implements Configurable { + + public CdnManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return CdnManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + + private CdnManager(RestClient restClient, String subscriptionId) { + super(restClient, + subscriptionId, + new CdnManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } + + /** + * @return entry point to traffic manager profile management + */ + public CdnProfiles profiles() { + if (this.profiles == null) { + this.profiles = new CdnProfilesImpl( + super.innerManagementClient, + this); + } + return this.profiles; + } +} \ No newline at end of file diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfileImpl.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfileImpl.java new file mode 100644 index 000000000000..3ce909c794d1 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfileImpl.java @@ -0,0 +1,274 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.CdnEndpoint; +import com.microsoft.azure.management.cdn.CdnProfile; +import com.microsoft.azure.management.cdn.CheckNameAvailabilityResult; +import com.microsoft.azure.management.cdn.CustomDomainValidationResult; +import com.microsoft.azure.management.cdn.Sku; +import com.microsoft.azure.management.cdn.SkuName; +import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; +import rx.Observable; +import rx.functions.Func1; + +import java.util.List; +import java.util.Map; + +/** + * Implementation for {@link CdnProfile}. + */ +@LangDefinition +class CdnProfileImpl + extends GroupableResourceImpl< + CdnProfile, + ProfileInner, + CdnProfileImpl, + CdnManager> + implements + CdnProfile, + CdnProfile.Definition, + CdnProfile.Update { + private final EndpointsInner endpointsClient; + private final OriginsInner originsClient; + private final CustomDomainsInner customDomainsClient; + private final ProfilesInner innerCollection; + private CdnEndpointsImpl endpointsImpl; + + CdnProfileImpl(String name, + final ProfileInner innerModel, + final ProfilesInner innerCollection, + final EndpointsInner endpointsClient, + final OriginsInner originsClient, + final CustomDomainsInner customDomainsClient, + final CdnManager cdnManager) { + super(name, innerModel, cdnManager); + this.innerCollection = innerCollection; + this.endpointsClient = endpointsClient; + this.originsClient = originsClient; + this.customDomainsClient = customDomainsClient; + this.endpointsImpl = new CdnEndpointsImpl(this.endpointsClient, + this.originsClient, + this.customDomainsClient, + this); + } + + @Override + public Map endpoints() { + return this.endpointsImpl.endpointsAsMap(); + } + + @Override + public String generateSsoUri() { + SsoUriInner ssoUri = this.innerCollection.generateSsoUri( + this.resourceGroupName(), + this.name()); + if (ssoUri != null) { + return ssoUri.ssoUriValue(); + } + return null; + } + + @Override + public void startEndpoint(String endpointName) { + this.endpointsClient.start(this.resourceGroupName(), this.name(), endpointName); + } + + @Override + public void stopEndpoint(String endpointName) { + this.endpointsClient.stop(this.resourceGroupName(), this.name(), endpointName); + } + + @Override + public void purgeEndpointContent(String endpointName, List contentPaths) { + this.endpointsClient.purgeContent(this.resourceGroupName(), this.name(), endpointName, contentPaths); + } + + @Override + public void loadEndpointContent(String endpointName, List contentPaths) { + this.endpointsClient.loadContent(this.resourceGroupName(), this.name(), endpointName, contentPaths); + } + + @Override + public CustomDomainValidationResult validateEndpointCustomDomain(String endpointName, String hostName) { + return new CustomDomainValidationResult( + this.endpointsClient.validateCustomDomain( + this.resourceGroupName(), + this.name(), + endpointName, + hostName)); + } + + @Override + public CheckNameAvailabilityResult checkEndpointNameAvailability(String name) { + return this.myManager.profiles().checkEndpointNameAvailability(name); + } + + @Override + public boolean isPremiumVerizon() { + if (this.sku() != null + && this.sku().name() != null + && this.sku().name().equals(SkuName.PREMIUM_VERIZON)) { + return true; + } + return false; + } + + @Override + public String regionName() { + return this.inner().location(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public String resourceState() { + return this.inner().resourceState().toString(); + } + + @Override + public CdnProfileImpl refresh() { + ProfileInner cdnProfileInner = + this.innerCollection.get(this.resourceGroupName(), this.name()); + this.setInner(cdnProfileInner); + return this; + } + + @Override + public Observable updateResourceAsync() { + final CdnProfileImpl self = this; + + return self.endpointsImpl.commitAndGetAllAsync() + .flatMap(new Func1, Observable>() { + public Observable call(List endpoints) { + return innerCollection.updateAsync(resourceGroupName(), name(), inner().getTags()) + .map(new Func1() { + @Override + public CdnProfile call(ProfileInner profileInner) { + self.setInner(profileInner); + return self; + } + }); + } + }); + } + + @Override + public Observable createResourceAsync() { + final CdnProfileImpl self = this; + return innerCollection.createAsync(resourceGroupName(), name(), inner()) + .map(new Func1() { + @Override + public CdnProfile call(ProfileInner profileInner) { + self.setInner(profileInner); + return self; + } + }).flatMap(new Func1>() { + @Override + public Observable call(CdnProfile profile) { + return self.endpointsImpl.commitAndGetAllAsync() + .map(new Func1, CdnProfile>() { + @Override + public CdnProfile call(List endpoints) { + return self; + } + }); + } + }); + } + + @Override + public CdnProfileImpl withStandardAkamaiSku() { + this.inner() + .withSku(new Sku() + .withName(SkuName.STANDARD_AKAMAI)); + return this; + } + + @Override + public CdnProfileImpl withStandardVerizonSku() { + this.inner() + .withSku(new Sku() + .withName(SkuName.STANDARD_VERIZON)); + return this; + } + + @Override + public CdnProfileImpl withPremiumVerizonSku() { + this.inner() + .withSku(new Sku() + .withName(SkuName.PREMIUM_VERIZON)); + return this; + } + + @Override + public CdnProfileImpl withNewEndpoint(String endpointOriginHostname) { + CdnEndpointImpl endpoint = this.endpointsImpl.defineNewEndpointWithOriginHostname(endpointOriginHostname); + this.endpointsImpl.addEndpoint(endpoint); + return this; + } + + @Override + public CdnEndpointImpl defineNewEndpoint() { + return this.endpointsImpl.defineNewEndpoint(); + } + + @Override + public CdnEndpointImpl defineNewEndpoint(String name) { + return this.endpointsImpl.defineNewEndpoint(name); + } + + @Override + public CdnEndpointImpl defineNewEndpoint(String name, String endpointOriginHostname) { + return this.endpointsImpl.defineNewEndpoint(name, endpointOriginHostname); + } + + @Override + public CdnProfileImpl withNewPremiumEndpoint(String endpointOriginHostname) { + return this.withNewEndpoint(endpointOriginHostname); + } + + @Override + public CdnEndpointImpl defineNewPremiumEndpoint() { + return this.endpointsImpl.defineNewEndpoint(); + } + + @Override + public CdnEndpointImpl defineNewPremiumEndpoint(String name) { + return this.defineNewEndpoint(name); + } + + @Override + public CdnEndpointImpl defineNewPremiumEndpoint(String name, String endpointOriginHostname) { + return this.defineNewEndpoint(name, endpointOriginHostname); + } + + @Override + public CdnEndpointImpl updateEndpoint(String name) { + return this.endpointsImpl.updateEndpoint(name); + } + + @Override + public CdnEndpointImpl updatePremiumEndpoint(String name) { + return this.endpointsImpl.updateEndpoint(name); + } + + @Override + public Update withoutEndpoint(String name) { + this.endpointsImpl.remove(name); + return this; + } + + CdnProfileImpl withEndpoint(CdnEndpointImpl endpoint) { + this.endpointsImpl.addEndpoint(endpoint); + return this; + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfilesImpl.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfilesImpl.java new file mode 100644 index 000000000000..15314743b02b --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/CdnProfilesImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn.implementation; + +import com.microsoft.azure.PagedList; +import com.microsoft.azure.management.apigeneration.LangDefinition; +import com.microsoft.azure.management.cdn.CdnProfile; +import com.microsoft.azure.management.cdn.CdnProfiles; +import com.microsoft.azure.management.cdn.CheckNameAvailabilityResult; +import com.microsoft.azure.management.cdn.Operation; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl; +import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter; +import rx.Observable; + +import java.util.List; + +/** + * Implementation for {@link CdnProfiles}. + */ +@LangDefinition +class CdnProfilesImpl + extends GroupableResourcesImpl< + CdnProfile, + CdnProfileImpl, + ProfileInner, + ProfilesInner, + CdnManager> + implements CdnProfiles { + private final EndpointsInner endpointsClient; + private final OriginsInner originsClient; + private final CustomDomainsInner customDomainsClient; + private final CdnManagementClientImpl cdnManagementClient; + + CdnProfilesImpl( + final CdnManagementClientImpl cdnManagementClient, + final CdnManager cdnManager) { + super(cdnManagementClient.profiles(), cdnManager); + this.endpointsClient = cdnManagementClient.endpoints(); + this.originsClient = cdnManagementClient.origins(); + this.customDomainsClient = cdnManagementClient.customDomains(); + this.cdnManagementClient = cdnManagementClient; + } + + @Override + public PagedList list() { + return wrapList(this.innerCollection.list()); + } + + @Override + public PagedList listByGroup(String groupName) { + return wrapList(this.innerCollection.listByResourceGroup(groupName)); + } + + @Override + public CdnProfile getByGroup(String groupName, String name) { + return wrapModel(this.innerCollection.get(groupName, name)); + } + + @Override + protected CdnProfileImpl wrapModel(String name) { + return new CdnProfileImpl(name, + new ProfileInner(), + this.innerCollection, + this.endpointsClient, + this.originsClient, + this.customDomainsClient, + this.myManager); + } + + @Override + protected CdnProfileImpl wrapModel(ProfileInner inner) { + return new CdnProfileImpl(inner.name(), + inner, + this.innerCollection, + this.endpointsClient, + this.originsClient, + this.customDomainsClient, + this.myManager); + } + + @Override + public CdnProfileImpl define(String name) { + return wrapModel(name); + } + + @Override + public String generateSsoUri(String resourceGroupName, String profileName) { + SsoUriInner ssoUri = this.cdnManagementClient.profiles().generateSsoUri(resourceGroupName, profileName); + if (ssoUri != null) { + return ssoUri.ssoUriValue(); + } + return null; + } + + @Override + public CheckNameAvailabilityResult checkEndpointNameAvailability(String name) { + return new CheckNameAvailabilityResult(this.cdnManagementClient.checkNameAvailability(name)); + } + + @Override + public PagedList listOperations() { + return (new PagedListConverter() { + @Override + public Operation typeConvert(OperationInner inner) { + return new Operation(inner); + } + }).convert(this.cdnManagementClient.listOperations()); + } + + @Override + public void startEndpoint(String resourceGroupName, String profileName, String endpointName) { + this.cdnManagementClient.endpoints().start(resourceGroupName, profileName, endpointName); + } + + @Override + public void stopEndpoint(String resourceGroupName, String profileName, String endpointName) { + this.cdnManagementClient.endpoints().stop(resourceGroupName, profileName, endpointName); + } + + @Override + public void purgeEndpointContent(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + this.cdnManagementClient.endpoints().purgeContent(resourceGroupName, profileName, endpointName, contentPaths); + } + + @Override + public void loadEndpointContent(String resourceGroupName, String profileName, String endpointName, List contentPaths) { + this.cdnManagementClient.endpoints().loadContent(resourceGroupName, profileName, endpointName, contentPaths); + } + + @Override + public Observable deleteByGroupAsync(String groupName, String name) { + return this.innerCollection.deleteAsync(groupName, name); + } +} diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/package-info.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/package-info.java new file mode 100644 index 000000000000..a827b0d09c17 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for CdnManagementClient. + * Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure. + */ +package com.microsoft.azure.management.cdn.implementation; diff --git a/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/package-info.java b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/package-info.java new file mode 100644 index 000000000000..cacf51cbc161 --- /dev/null +++ b/azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for CdnManagementClient. + * Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure. + */ +package com.microsoft.azure.management.cdn; diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/ManageCdn.java b/azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/ManageCdn.java new file mode 100644 index 000000000000..da1450077efd --- /dev/null +++ b/azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/ManageCdn.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management.cdn.samples; + +import com.microsoft.azure.management.Azure; +import com.microsoft.azure.management.cdn.CdnEndpoint; +import com.microsoft.azure.management.cdn.CdnProfile; +import com.microsoft.azure.management.cdn.CustomDomainValidationResult; +import com.microsoft.azure.management.cdn.GeoFilterActions; +import com.microsoft.azure.management.cdn.QueryStringCachingBehavior; +import com.microsoft.azure.management.resources.fluentcore.arm.CountryISOCode; +import com.microsoft.azure.management.resources.fluentcore.arm.Region; +import com.microsoft.azure.management.samples.Utils; +import okhttp3.logging.HttpLoggingInterceptor; + +import java.io.File; + +/** + * Created by hovsepm on 10/26/2016. + */ +public final class ManageCdn { + + /** + * Main entry point. + * @param args the parameters + */ + public static void main(String[] args) { + + final String cdnStandardProfileName = Utils.createRandomName("cdnStandardProfile"); + final String cdnPremiumProfileName = Utils.createRandomName("cdnPremiumProfile"); + final String cdnEndpointName = "endpoint-f3757d2a3e10"; + final String cdnPremiumEndpointName = "premiumVerizonEndpointFluentTest"; + final String rgName = Utils.createRandomName("rgRCCDN"); + + try { + + final File credFile = new File("D:/my.azureauth"); + + Azure azure = Azure + .configure() + .withLogLevel(HttpLoggingInterceptor.Level.BASIC) + //.withProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 8888))) + .authenticate(credFile) + .withDefaultSubscription(); + + // Print selected subscription + System.out.println("Selected subscription: " + azure.subscriptionId()); + + try { + // ============================================================ + // Create a redis cache + + System.out.println("Creating a CDN Profile"); + + CdnProfile standardProfile = azure.cdnProfiles().define(cdnStandardProfileName) + .withRegion(Region.US_CENTRAL) + .withNewResourceGroup(rgName) + + .withStandardAkamaiSku() + .withNewEndpoint("supername.cloudapp.net") + .defineNewEndpoint("akamiEndpointWithoutMuchProperties") + .withOrigin("originSuperName", "storageforazdevextest.blob.core.windows.net") + .attach() + .defineNewEndpoint(cdnEndpointName, "mylinuxapp.azurewebsites.net") + .withContentTypeToCompress("powershell/pain") + .withGeoFilter("/path/videos", GeoFilterActions.BLOCK, CountryISOCode.ARGENTINA) + .withGeoFilter("/path/images", GeoFilterActions.BLOCK, CountryISOCode.BELGIUM) + .withContentTypeToCompress("text/plain") + .withCompressionEnabled(true) + .withQueryStringCachingBehavior(QueryStringCachingBehavior.BYPASS_CACHING) + .withHttpsAllowed(true) + .withHttpsPort(444) + .withHttpAllowed(true) + .withHttpPort(85) + .withCustomDomain("sdk-1-f3757d2a3e10.azureedge-test.net") + .withCustomDomain("sdk-2-f3757d2a3e10.azureedge-test.net") + .attach() + .create(); + + CdnProfile premiumProfile = azure.cdnProfiles().define(cdnPremiumProfileName) + .withRegion(Region.US_CENTRAL) + .withNewResourceGroup(rgName) + .withPremiumVerizonSku() + .withNewPremiumEndpoint("someweirdname.blob.core.windows.net") + .defineNewPremiumEndpoint("supermuperep1") + .withPremiumOrigin("originPremium", "xplattestvmss1sto0575014.blob.core.windows.net") + .attach() + .defineNewPremiumEndpoint(cdnPremiumEndpointName) + .withPremiumOrigin("supername.cloudapp.net") + .withHttpAllowed(true) + .withHttpsAllowed(true) + .withHttpsPort(12) + .withHttpPort(123) + .attach() + .create(); + + CdnProfile profileRead = standardProfile.refresh(); + + for (CdnEndpoint endpoint : profileRead.endpoints().values()) { + System.out.println("CDN Endpoint: " + endpoint.name()); + System.out.println("EP Hostname: " + endpoint.hostName()); + System.out.println("EP Origin hostname: " + endpoint.originHostName()); + System.out.println("EP optimization type: " + endpoint.optimizationType()); + System.out.println("EP Origin host header: " + endpoint.originHostHeader()); + System.out.println("EP Origin path: " + endpoint.originPath()); + for (String customDomain : endpoint.customDomains()) { + System.out.println("EP custom domain: " + customDomain); + } + } + + if (!standardProfile.isPremiumVerizon()) { + standardProfile.update() + .withTag("provider", "Akamai") + .withNewEndpoint("www.somewebsite.com") + .defineNewEndpoint("somenewnamefortheendpoint") + .withOrigin("www.someotherwebsite.com") + .withGeoFilter("/path/music", GeoFilterActions.BLOCK, CountryISOCode.ESTONIA) + .attach() + .updateEndpoint(cdnEndpointName) + .withoutGeoFilters() + .withHttpAllowed(true) + .withHttpPort(1111) + .withoutCustomDomain("sdk-2-f3757d2a3e10.azureedge-test.net") + .parent() + .apply(); + } + + premiumProfile.update() + .withTag("provider", "Verizon") + .withNewPremiumEndpoint("xplattestvmss1sto0575014.blob.core.windows.net") + .defineNewPremiumEndpoint("supermuperep3") + .withPremiumOrigin("xplattestvmss1sto0575014.blob.core.windows.net") + .attach() + .updatePremiumEndpoint(cdnPremiumEndpointName) + .withHttpsAllowed(true) + .withHttpsPort(1111) + .parent() + .withoutEndpoint("supermuperep1") + .apply(); + + String ssoUri = premiumProfile.generateSsoUri(); + + System.out.println("Standard Akamai Endpoints: " + standardProfile.endpoints().size()); + CdnEndpoint standardEp = standardProfile.endpoints().get(cdnEndpointName); + CustomDomainValidationResult validationResult = standardEp.validateCustomDomain("sdk-2-f3757d2a3e10.azureedge-test.net"); + standardProfile.stopEndpoint(standardEp.name()); + standardEp.start(); + + } catch (Exception f) { + System.out.println(f.getMessage()); + f.printStackTrace(); + } finally { + if (azure.resourceGroups().getByName(rgName) != null) { + System.out.println("Deleting Resource Group: " + rgName); + azure.resourceGroups().deleteByName(rgName); + System.out.println("Deleted Resource Group: " + rgName); + } else { + System.out.println("Did not create any resources in Azure. No clean up is necessary"); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + } + + private ManageCdn() { + } +} diff --git a/azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/package-info.java b/azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/package-info.java new file mode 100644 index 000000000000..9bafbaf74612 --- /dev/null +++ b/azure-samples/src/main/java/com/microsoft/azure/management/cdn/samples/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +/** + * This package contains the classes for CDN samples. + */ +package com.microsoft.azure.management.cdn.samples; diff --git a/azure/pom.xml b/azure/pom.xml index a662e3507a27..af0a463750ac 100644 --- a/azure/pom.xml +++ b/azure/pom.xml @@ -125,6 +125,11 @@ com.microsoft.azure api-annotations 0.0.1 + + + com.microsoft.azure + azure-mgmt-cdn + 1.0.0-beta4-SNAPSHOT com.microsoft.azure diff --git a/azure/src/main/java/com/microsoft/azure/management/Azure.java b/azure/src/main/java/com/microsoft/azure/management/Azure.java index 686a202c5787..223d899588e5 100644 --- a/azure/src/main/java/com/microsoft/azure/management/Azure.java +++ b/azure/src/main/java/com/microsoft/azure/management/Azure.java @@ -13,6 +13,8 @@ import com.microsoft.azure.credentials.AzureTokenCredentials; import com.microsoft.azure.management.batch.BatchAccounts; import com.microsoft.azure.management.batch.implementation.BatchManager; +import com.microsoft.azure.management.cdn.CdnProfiles; +import com.microsoft.azure.management.cdn.implementation.CdnManager; import com.microsoft.azure.management.compute.AvailabilitySets; import com.microsoft.azure.management.compute.ComputeUsages; import com.microsoft.azure.management.compute.VirtualMachineImages; @@ -71,6 +73,7 @@ public final class Azure { private final BatchManager batchManager; private final TrafficManager trafficManager; private final RedisManager redisManager; + private final CdnManager cdnManager; private final DnsZoneManager dnsZoneManager; private final SqlServerManager sqlServerManager; private final String subscriptionId; @@ -277,6 +280,7 @@ private Azure(RestClient restClient, String subscriptionId, String tenantId) { this.batchManager = BatchManager.authenticate(restClient, subscriptionId); this.trafficManager = TrafficManager.authenticate(restClient, subscriptionId); this.redisManager = RedisManager.authenticate(restClient, subscriptionId); + this.cdnManager = CdnManager.authenticate(restClient, subscriptionId); this.dnsZoneManager = DnsZoneManager.authenticate(restClient, subscriptionId); this.sqlServerManager = SqlServerManager.authenticate(restClient, subscriptionId); this.subscriptionId = subscriptionId; @@ -471,6 +475,13 @@ public RedisCaches redisCaches() { return redisManager.redisCaches(); } + /** + * @return entry point to managing cdn manager profiles. + */ + public CdnProfiles cdnProfiles() { + return cdnManager.profiles(); + } + /** * @return entry point to managing Dns zones. */ diff --git a/azure/src/test/java/com/microsoft/azure/management/AzureTests.java b/azure/src/test/java/com/microsoft/azure/management/AzureTests.java index b411eadd4e03..8c13309778e7 100644 --- a/azure/src/test/java/com/microsoft/azure/management/AzureTests.java +++ b/azure/src/test/java/com/microsoft/azure/management/AzureTests.java @@ -432,6 +432,18 @@ public void testTrafficManager() throws Exception { .runTest(azure.trafficManagerProfiles(), azure.resourceGroups()); } + @Test + public void testRedis() throws Exception { + new TestRedis() + .runTest(azure.redisCaches(), azure.resourceGroups()); + } + + @Test + public void testCdnManager() throws Exception { + new TestCdn() + .runTest(azure.cdnProfiles(), azure.resourceGroups()); + } + @Test public void testDnsZones() throws Exception { new TestDns() diff --git a/azure/src/test/java/com/microsoft/azure/management/TestCdn.java b/azure/src/test/java/com/microsoft/azure/management/TestCdn.java new file mode 100644 index 000000000000..e5bc8ef61192 --- /dev/null +++ b/azure/src/test/java/com/microsoft/azure/management/TestCdn.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +package com.microsoft.azure.management; + +import com.microsoft.azure.management.cdn.CdnEndpoint; +import com.microsoft.azure.management.cdn.CdnProfile; +import com.microsoft.azure.management.cdn.CdnProfiles; +import com.microsoft.azure.management.cdn.GeoFilter; +import com.microsoft.azure.management.cdn.GeoFilterActions; +import com.microsoft.azure.management.cdn.QueryStringCachingBehavior; +import com.microsoft.azure.management.cdn.SkuName; +import com.microsoft.azure.management.resources.fluentcore.arm.CountryISOCode; +import com.microsoft.azure.management.resources.fluentcore.arm.Region; +import org.junit.Assert; + +import java.util.Map; + +/** + * Test of CDN management. + */ +public class TestCdn extends TestTemplate { + @Override + public CdnProfile createResource(CdnProfiles profiles) throws Exception { + final Region region = Region.US_EAST; + final String groupName = "rg" + this.testId; + final String cdnProfileName = "cdnProfile" + this.testId; + final String cdnEndpointName = "cdnEndpoint" + this.testId; + final String cdnOriginHostName = "mylinuxapp.azurewebsites.net"; + + CdnProfile cdnProfile = profiles.define(cdnProfileName) + .withRegion(region) + .withNewResourceGroup(groupName) + .withStandardAkamaiSku() + .defineNewEndpoint(cdnEndpointName) + .withOrigin(cdnOriginHostName) + .withGeoFilter("/path/videos", GeoFilterActions.BLOCK, CountryISOCode.ARGENTINA) + .withGeoFilter("/path/images", GeoFilterActions.BLOCK, CountryISOCode.BELGIUM) + .withContentTypeToCompress("text/plain") + .withCompressionEnabled(true) + .withQueryStringCachingBehavior(QueryStringCachingBehavior.BYPASS_CACHING) + .withHttpsAllowed(true) + .withHttpsPort(444) + .withHttpAllowed(false) + .withHttpPort(85) + .attach() + .create(); + + Assert.assertTrue(cdnProfile.sku().name().equals(SkuName.STANDARD_AKAMAI)); + Assert.assertNotNull(cdnProfile.endpoints()); + Assert.assertEquals(1, cdnProfile.endpoints().size()); + CdnEndpoint endpoint = cdnProfile.endpoints().get(cdnEndpointName); + Assert.assertNotNull(endpoint); + Assert.assertEquals(cdnOriginHostName, endpoint.originHostName()); + Assert.assertEquals(444, endpoint.httpsPort()); + Assert.assertEquals(85, endpoint.httpPort()); + Assert.assertFalse(endpoint.isHttpAllowed()); + Assert.assertTrue(endpoint.isHttpsAllowed()); + Assert.assertTrue(endpoint.isCompressionEnabled()); + Assert.assertEquals(QueryStringCachingBehavior.BYPASS_CACHING, endpoint.queryStringCachingBehavior()); + Assert.assertNotNull(endpoint.geoFilters()); + Assert.assertEquals(QueryStringCachingBehavior.BYPASS_CACHING, endpoint.queryStringCachingBehavior()); + + return cdnProfile; + } + + @Override + public CdnProfile updateResource(CdnProfile profile) throws Exception { + String firstEndpointName = profile.endpoints().keySet().iterator().next(); + + // Remove an endpoint, update two endpoints and add new one + // + profile.update() + .withTag("provider", "Akamai") + .withNewEndpoint("www.bing.com") + .defineNewEndpoint("somenewnamefortheendpoint") + .withOrigin("www.contoso.com") + .withGeoFilter("/path/music", GeoFilterActions.BLOCK, CountryISOCode.UNITED_STATES_OUTLYING_ISLANDS) + .attach() + .updateEndpoint(firstEndpointName) + .withHttpAllowed(true) + .withHttpPort(1111) + .withoutGeoFilters() + .parent() + .apply(); + + Assert.assertEquals(2, profile.endpoints().size()); + CdnEndpoint updatedEndpoint = profile.endpoints().get(firstEndpointName); + Assert.assertTrue(updatedEndpoint.isHttpsAllowed()); + Assert.assertEquals(1111, updatedEndpoint.httpPort()); + Assert.assertEquals(0, updatedEndpoint.geoFilters().size()); + + return profile; + } + + @Override + public void print(CdnProfile profile) { + StringBuilder info = new StringBuilder(); + info.append("CDN Profile: ").append(profile.id()) + .append("\n\tName: ").append(profile.name()) + .append("\n\tResource group: ").append(profile.resourceGroupName()) + .append("\n\tRegion: ").append(profile.regionName()) + .append("\n\tSku: ").append(profile.sku().name()) + .append("\n\tTags: ").append(profile.tags()); + + Map cdnEndpoints = profile.endpoints(); + if (!cdnEndpoints.isEmpty()) { + info.append("\n\tCDN endpoints:"); + int idx = 1; + for (CdnEndpoint endpoint : cdnEndpoints.values()) { + info.append("\n\t\tCDN endpoint: #").append(idx++) + .append("\n\t\t\tId: ").append(endpoint.id()) + .append("\n\t\t\tName: ").append(endpoint.name()) + .append("\n\t\t\tState: ").append(endpoint.resourceState()) + .append("\n\t\t\tHost name: ").append(endpoint.hostName()) + .append("\n\t\t\tOrigin host name: ").append(endpoint.originHostName()) + .append("\n\t\t\tOrigin host header: ").append(endpoint.originHostHeader()) + .append("\n\t\t\tOrigin path: ").append(endpoint.originPath()) + .append("\n\t\t\tOptimization type: ").append(endpoint.optimizationType()) + .append("\n\t\t\tQuery string caching behavior: ").append(endpoint.queryStringCachingBehavior()) + .append("\n\t\t\tHttp allowed: ").append(endpoint.isHttpAllowed()) + .append("\t\tHttp port: ").append(endpoint.httpPort()) + .append("\n\t\t\tHttps allowed: ").append(endpoint.isHttpsAllowed()) + .append("\t\tHttps port: ").append(endpoint.httpsPort()) + .append("\n\t\t\tCompression enabled: ").append(endpoint.isCompressionEnabled()); + + info.append("\n\t\t\tContent types to compress: "); + for (String contentTypeToCompress : endpoint.contentTypesToCompress()) { + info.append("\n\t\t\t\t").append(contentTypeToCompress); + } + + info.append("\n\t\t\tGeo filters: "); + for (GeoFilter geoFilter : endpoint.geoFilters()) { + info.append("\n\t\t\t\tAction: ").append(geoFilter.action()); + info.append("\n\t\t\t\tRelativePath: ").append(geoFilter.relativePath()); + info.append("\n\t\t\t\tCountry codes: "); + for (String countryCode : geoFilter.countryCodes()) { + info.append("\n\t\t\t\t\t").append(countryCode); + } + } + + info.append("\n\t\t\tCustom domains: "); + for (String customDomain : endpoint.customDomains()) { + info.append("\n\t\t\t\t").append(customDomain); + } + } + } + System.out.println(info.toString()); + } +}