diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ComputeRole.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ComputeRole.java new file mode 100644 index 00000000000..1e681e5d9b0 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ComputeRole.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.azurestack; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ComputeRole. + */ +public final class ComputeRole extends ExpandableStringEnum { + /** Static value None for ComputeRole. */ + public static final ComputeRole NONE = fromString("None"); + + /** Static value IaaS for ComputeRole. */ + public static final ComputeRole IAAS = fromString("IaaS"); + + /** Static value PaaS for ComputeRole. */ + public static final ComputeRole PAAS = fromString("PaaS"); + + /** + * Creates or finds a ComputeRole from its string representation. + * @param name a name to look for + * @return the corresponding ComputeRole + */ + @JsonCreator + public static ComputeRole fromString(String name) { + return fromString(name, ComputeRole.class); + } + + /** + * @return known ComputeRole values + */ + public static Collection values() { + return values(ComputeRole.class); + } +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/DataDiskImage.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/DataDiskImage.java new file mode 100644 index 00000000000..2f7e64d7123 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/DataDiskImage.java @@ -0,0 +1,47 @@ +/** + * 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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Data disk image. + */ +public class DataDiskImage { + /** + * The LUN. + */ + @JsonProperty(value = "lun", access = JsonProperty.Access.WRITE_ONLY) + private Integer lun; + + /** + * SAS key for source blob. + */ + @JsonProperty(value = "sourceBlobSasUri", access = JsonProperty.Access.WRITE_ONLY) + private String sourceBlobSasUri; + + /** + * Get the lun value. + * + * @return the lun value + */ + public Integer lun() { + return this.lun; + } + + /** + * Get the sourceBlobSasUri value. + * + * @return the sourceBlobSasUri value + */ + public String sourceBlobSasUri() { + return this.sourceBlobSasUri; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/Display.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/Display.java new file mode 100644 index 00000000000..daa89d44962 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/Display.java @@ -0,0 +1,127 @@ +/** + * 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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains the localized display information for this particular operation or + * action. + */ +public class Display { + /** + * The localized, friendly version of the resource provider name. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * The localized, friendly version of the resource type related to this + * action or operation; the resource type should match the public + * documentation for the resource provider. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The localized, friendly name for the operation. Use the name as it will + * displayed to the user. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * The localized, friendly description for the operation. The description + * will be displayed to the user. It should be thorough and concise for + * used in both tooltips and detailed views. + */ + @JsonProperty(value = "description") + private String description; + + /** + * 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 Display object itself. + */ + public Display 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 Display object itself. + */ + public Display 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 Display object itself. + */ + public Display withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the Display object itself. + */ + public Display withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/IconUris.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/IconUris.java new file mode 100644 index 00000000000..1813d20115a --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/IconUris.java @@ -0,0 +1,147 @@ +/** + * 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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Links to product icons. + */ +public class IconUris { + /** + * URI to large icon. + */ + @JsonProperty(value = "large") + private String large; + + /** + * URI to wide icon. + */ + @JsonProperty(value = "wide") + private String wide; + + /** + * URI to medium icon. + */ + @JsonProperty(value = "medium") + private String medium; + + /** + * URI to small icon. + */ + @JsonProperty(value = "small") + private String small; + + /** + * URI to hero icon. + */ + @JsonProperty(value = "hero") + private String hero; + + /** + * Get the large value. + * + * @return the large value + */ + public String large() { + return this.large; + } + + /** + * Set the large value. + * + * @param large the large value to set + * @return the IconUris object itself. + */ + public IconUris withLarge(String large) { + this.large = large; + return this; + } + + /** + * Get the wide value. + * + * @return the wide value + */ + public String wide() { + return this.wide; + } + + /** + * Set the wide value. + * + * @param wide the wide value to set + * @return the IconUris object itself. + */ + public IconUris withWide(String wide) { + this.wide = wide; + return this; + } + + /** + * Get the medium value. + * + * @return the medium value + */ + public String medium() { + return this.medium; + } + + /** + * Set the medium value. + * + * @param medium the medium value to set + * @return the IconUris object itself. + */ + public IconUris withMedium(String medium) { + this.medium = medium; + return this; + } + + /** + * Get the small value. + * + * @return the small value + */ + public String small() { + return this.small; + } + + /** + * Set the small value. + * + * @param small the small value to set + * @return the IconUris object itself. + */ + public IconUris withSmall(String small) { + this.small = small; + return this; + } + + /** + * Get the hero value. + * + * @return the hero value + */ + public String hero() { + return this.hero; + } + + /** + * Set the hero value. + * + * @param hero the hero value to set + * @return the IconUris object itself. + */ + public IconUris withHero(String hero) { + this.hero = hero; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/OperatingSystem.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/OperatingSystem.java new file mode 100644 index 00000000000..bdca6b4c439 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/OperatingSystem.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.azurestack; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperatingSystem. + */ +public final class OperatingSystem extends ExpandableStringEnum { + /** Static value None for OperatingSystem. */ + public static final OperatingSystem NONE = fromString("None"); + + /** Static value Windows for OperatingSystem. */ + public static final OperatingSystem WINDOWS = fromString("Windows"); + + /** Static value Linux for OperatingSystem. */ + public static final OperatingSystem LINUX = fromString("Linux"); + + /** + * Creates or finds a OperatingSystem from its string representation. + * @param name a name to look for + * @return the corresponding OperatingSystem + */ + @JsonCreator + public static OperatingSystem fromString(String name) { + return fromString(name, OperatingSystem.class); + } + + /** + * @return known OperatingSystem values + */ + public static Collection values() { + return values(OperatingSystem.class); + } +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/OsDiskImage.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/OsDiskImage.java new file mode 100644 index 00000000000..8e92f8f4256 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/OsDiskImage.java @@ -0,0 +1,48 @@ +/** + * 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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * OS disk image. + */ +public class OsDiskImage { + /** + * OS operating system type. Possible values include: 'None', 'Windows', + * 'Linux'. + */ + @JsonProperty(value = "operatingSystem", access = JsonProperty.Access.WRITE_ONLY) + private OperatingSystem operatingSystem; + + /** + * SAS key for source blob. + */ + @JsonProperty(value = "sourceBlobSasUri", access = JsonProperty.Access.WRITE_ONLY) + private String sourceBlobSasUri; + + /** + * Get the operatingSystem value. + * + * @return the operatingSystem value + */ + public OperatingSystem operatingSystem() { + return this.operatingSystem; + } + + /** + * Get the sourceBlobSasUri value. + * + * @return the sourceBlobSasUri value + */ + public String sourceBlobSasUri() { + return this.sourceBlobSasUri; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProductLink.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProductLink.java new file mode 100644 index 00000000000..88cb0fb0c1b --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProductLink.java @@ -0,0 +1,69 @@ +/** + * 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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Link with additional information about a product. + */ +public class ProductLink { + /** + * The description of the link. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The URI corresponding to the link. + */ + @JsonProperty(value = "uri") + private String uri; + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the ProductLink object itself. + */ + public ProductLink withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the uri value. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri value. + * + * @param uri the uri value to set + * @return the ProductLink object itself. + */ + public ProductLink withUri(String uri) { + this.uri = uri; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProductProperties.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProductProperties.java new file mode 100644 index 00000000000..10a98174670 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProductProperties.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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional properties of the product. + */ +public class ProductProperties { + /** + * The version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the version value. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the ProductProperties object itself. + */ + public ProductProperties withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProvisioningState.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProvisioningState.java new file mode 100644 index 00000000000..0307a089d57 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/ProvisioningState.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.azurestack; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningState. + */ +public enum ProvisioningState { + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Canceled. */ + CANCELED("Canceled"); + + /** The actual serialized value for a ProvisioningState instance. */ + private String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/VirtualMachineExtensionProductProperties.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/VirtualMachineExtensionProductProperties.java new file mode 100644 index 00000000000..7104b6fef7c --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/VirtualMachineExtensionProductProperties.java @@ -0,0 +1,127 @@ +/** + * 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.azurestack; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Product information. + */ +@JsonFlatten +public class VirtualMachineExtensionProductProperties { + /** + * Specifies kind of compute role inclided in the package. Possible values + * include: 'None', 'IaaS', 'PaaS'. + */ + @JsonProperty(value = "computeRole", access = JsonProperty.Access.WRITE_ONLY) + private ComputeRole computeRole; + + /** + * Specifies if product is a Virtual Machine Extension. + */ + @JsonProperty(value = "isSystemExtension", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isSystemExtension; + + /** + * The URI. + */ + @JsonProperty(value = "sourceBlob.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Indicates if specified product supports multiple extensions. + */ + @JsonProperty(value = "supportMultipleExtensions", access = JsonProperty.Access.WRITE_ONLY) + private Boolean supportMultipleExtensions; + + /** + * Specifies product version. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Specifies operating system used by the product. Possible values include: + * 'None', 'Windows', 'Linux'. + */ + @JsonProperty(value = "vmOsType", access = JsonProperty.Access.WRITE_ONLY) + private OperatingSystem vmOsType; + + /** + * Indicates if virtual machine Scale Set is enabled in the specified + * product. + */ + @JsonProperty(value = "vmScaleSetEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean vmScaleSetEnabled; + + /** + * Get the computeRole value. + * + * @return the computeRole value + */ + public ComputeRole computeRole() { + return this.computeRole; + } + + /** + * Get the isSystemExtension value. + * + * @return the isSystemExtension value + */ + public Boolean isSystemExtension() { + return this.isSystemExtension; + } + + /** + * Get the uri value. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get the supportMultipleExtensions value. + * + * @return the supportMultipleExtensions value + */ + public Boolean supportMultipleExtensions() { + return this.supportMultipleExtensions; + } + + /** + * Get the version value. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the vmOsType value. + * + * @return the vmOsType value + */ + public OperatingSystem vmOsType() { + return this.vmOsType; + } + + /** + * Get the vmScaleSetEnabled value. + * + * @return the vmScaleSetEnabled value + */ + public Boolean vmScaleSetEnabled() { + return this.vmScaleSetEnabled; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/VirtualMachineProductProperties.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/VirtualMachineProductProperties.java new file mode 100644 index 00000000000..292bef6fc3a --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/VirtualMachineProductProperties.java @@ -0,0 +1,63 @@ +/** + * 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.azurestack; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Product information. + */ +public class VirtualMachineProductProperties { + /** + * Specifies product version. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * OS disk image used by product. + */ + @JsonProperty(value = "osDiskImage", access = JsonProperty.Access.WRITE_ONLY) + private OsDiskImage osDiskImage; + + /** + * List of attached data disks. + */ + @JsonProperty(value = "dataDiskImages", access = JsonProperty.Access.WRITE_ONLY) + private List dataDiskImages; + + /** + * Get the version value. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the osDiskImage value. + * + * @return the osDiskImage value + */ + public OsDiskImage osDiskImage() { + return this.osDiskImage; + } + + /** + * Get the dataDiskImages value. + * + * @return the dataDiskImages value + */ + public List dataDiskImages() { + return this.dataDiskImages; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ActivationKeyResultInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ActivationKeyResultInner.java new file mode 100644 index 00000000000..cd6d4d86494 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ActivationKeyResultInner.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.azurestack.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource containing the Azure Stack activation key. + */ +public class ActivationKeyResultInner { + /** + * Azure Stack activation key. + */ + @JsonProperty(value = "activationKey") + private String activationKey; + + /** + * Get the activationKey value. + * + * @return the activationKey value + */ + public String activationKey() { + return this.activationKey; + } + + /** + * Set the activationKey value. + * + * @param activationKey the activationKey value to set + * @return the ActivationKeyResultInner object itself. + */ + public ActivationKeyResultInner withActivationKey(String activationKey) { + this.activationKey = activationKey; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/AzureStackManagementClientImpl.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/AzureStackManagementClientImpl.java new file mode 100644 index 00000000000..6907542c013 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/AzureStackManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * 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.azurestack.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AzureStackManagementClientImpl class. + */ +public class AzureStackManagementClientImpl extends AzureServiceClient { + /** 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; + } + + /** Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials that uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AzureStackManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client API Version. */ + private String apiVersion; + + /** + * Gets Client API Version. + * + * @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 AzureStackManagementClientImpl 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 AzureStackManagementClientImpl 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 AzureStackManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The ProductsInner object to access its operations. + */ + private ProductsInner products; + + /** + * Gets the ProductsInner object to access its operations. + * @return the ProductsInner object. + */ + public ProductsInner products() { + return this.products; + } + + /** + * The RegistrationsInner object to access its operations. + */ + private RegistrationsInner registrations; + + /** + * Gets the RegistrationsInner object to access its operations. + * @return the RegistrationsInner object. + */ + public RegistrationsInner registrations() { + return this.registrations; + } + + /** + * The CustomerSubscriptionsInner object to access its operations. + */ + private CustomerSubscriptionsInner customerSubscriptions; + + /** + * Gets the CustomerSubscriptionsInner object to access its operations. + * @return the CustomerSubscriptionsInner object. + */ + public CustomerSubscriptionsInner customerSubscriptions() { + return this.customerSubscriptions; + } + + /** + * Initializes an instance of AzureStackManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AzureStackManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AzureStackManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AzureStackManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AzureStackManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AzureStackManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-06-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.products = new ProductsInner(restClient().retrofit(), this); + this.registrations = new RegistrationsInner(restClient().retrofit(), this); + this.customerSubscriptions = new CustomerSubscriptionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "AzureStackManagementClient", "2017-06-01"); + } +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/CustomerSubscriptionInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/CustomerSubscriptionInner.java new file mode 100644 index 00000000000..409bfd2bc08 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/CustomerSubscriptionInner.java @@ -0,0 +1,46 @@ +/** + * 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.azurestack.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Customer subcription. + */ +@JsonFlatten +public class CustomerSubscriptionInner extends Resource { + /** + * Tenant Id. + */ + @JsonProperty(value = "properties.tenantId") + private String tenantId; + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the CustomerSubscriptionInner object itself. + */ + public CustomerSubscriptionInner withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/CustomerSubscriptionsInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/CustomerSubscriptionsInner.java new file mode 100644 index 00000000000..842502ce720 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/CustomerSubscriptionsInner.java @@ -0,0 +1,610 @@ +/** + * 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.azurestack.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +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.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CustomerSubscriptions. + */ +public class CustomerSubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private CustomerSubscriptionsService service; + /** The service client containing this operation class. */ + private AzureStackManagementClientImpl client; + + /** + * Initializes an instance of CustomerSubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomerSubscriptionsInner(Retrofit retrofit, AzureStackManagementClientImpl client) { + this.service = retrofit.create(CustomerSubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CustomerSubscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomerSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.CustomerSubscriptions list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.CustomerSubscriptions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Path("customerSubscriptionName") String customerSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.CustomerSubscriptions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Path("customerSubscriptionName") String customerSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.CustomerSubscriptions create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}") + Observable> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Path("customerSubscriptionName") String customerSubscriptionName, @Query("api-version") String apiVersion, @Body CustomerSubscriptionInner customerCreationParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.CustomerSubscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerSubscriptionInner> object if successful. + */ + public PagedList list(final String resourceGroup, final String registrationName) { + ServiceResponse> response = listSinglePageAsync(resourceGroup, registrationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroup, final String registrationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroup, registrationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerSubscriptionInner> object + */ + public Observable> listAsync(final String resourceGroup, final String registrationName) { + return listWithServiceResponseAsync(resourceGroup, registrationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerSubscriptionInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroup, final String registrationName) { + return listSinglePageAsync(resourceGroup, registrationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns a list of products. + * + ServiceResponse> * @param resourceGroup Name of the resource group. + ServiceResponse> * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroup, final String registrationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName 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(), resourceGroup, registrationName, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerSubscriptionInner object if successful. + */ + public CustomerSubscriptionInner get(String resourceGroup, String registrationName, String customerSubscriptionName) { + return getWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName).toBlocking().single().body(); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroup, String registrationName, String customerSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName), serviceCallback); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerSubscriptionInner object + */ + public Observable getAsync(String resourceGroup, String registrationName, String customerSubscriptionName) { + return getWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName).map(new Func1, CustomerSubscriptionInner>() { + @Override + public CustomerSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerSubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroup, String registrationName, String customerSubscriptionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName is required and cannot be null."); + } + if (customerSubscriptionName == null) { + throw new IllegalArgumentException("Parameter customerSubscriptionName 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(this.client.subscriptionId(), resourceGroup, registrationName, customerSubscriptionName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroup, String registrationName, String customerSubscriptionName) { + deleteWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName).toBlocking().single().body(); + } + + /** + * Deletes a customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroup, String registrationName, String customerSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName), serviceCallback); + } + + /** + * Deletes a customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroup, String registrationName, String customerSubscriptionName) { + return deleteWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroup, String registrationName, String customerSubscriptionName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName is required and cannot be null."); + } + if (customerSubscriptionName == null) { + throw new IllegalArgumentException("Parameter customerSubscriptionName 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.delete(this.client.subscriptionId(), resourceGroup, registrationName, customerSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates a new customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @param customerCreationParameters Parameters use to create a customer subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerSubscriptionInner object if successful. + */ + public CustomerSubscriptionInner create(String resourceGroup, String registrationName, String customerSubscriptionName, CustomerSubscriptionInner customerCreationParameters) { + return createWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName, customerCreationParameters).toBlocking().single().body(); + } + + /** + * Creates a new customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @param customerCreationParameters Parameters use to create a customer subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroup, String registrationName, String customerSubscriptionName, CustomerSubscriptionInner customerCreationParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName, customerCreationParameters), serviceCallback); + } + + /** + * Creates a new customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @param customerCreationParameters Parameters use to create a customer subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerSubscriptionInner object + */ + public Observable createAsync(String resourceGroup, String registrationName, String customerSubscriptionName, CustomerSubscriptionInner customerCreationParameters) { + return createWithServiceResponseAsync(resourceGroup, registrationName, customerSubscriptionName, customerCreationParameters).map(new Func1, CustomerSubscriptionInner>() { + @Override + public CustomerSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new customer subscription under a registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param customerSubscriptionName Name of the product. + * @param customerCreationParameters Parameters use to create a customer subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerSubscriptionInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroup, String registrationName, String customerSubscriptionName, CustomerSubscriptionInner customerCreationParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName is required and cannot be null."); + } + if (customerSubscriptionName == null) { + throw new IllegalArgumentException("Parameter customerSubscriptionName 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 (customerCreationParameters == null) { + throw new IllegalArgumentException("Parameter customerCreationParameters is required and cannot be null."); + } + Validator.validate(customerCreationParameters); + return service.create(this.client.subscriptionId(), resourceGroup, registrationName, customerSubscriptionName, this.client.apiVersion(), customerCreationParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerSubscriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerSubscriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerSubscriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns a list of products. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerSubscriptionInner> 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."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ExtendedProductInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ExtendedProductInner.java new file mode 100644 index 00000000000..a66960121cc --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ExtendedProductInner.java @@ -0,0 +1,195 @@ +/** + * 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.azurestack.implementation; + +import com.microsoft.azure.management.azurestack.ComputeRole; +import com.microsoft.azure.management.azurestack.OperatingSystem; +import com.microsoft.azure.management.azurestack.OsDiskImage; +import java.util.List; +import com.microsoft.azure.management.azurestack.DataDiskImage; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Extended description about the product required for installing it into Azure + * Stack. + */ +@JsonFlatten +public class ExtendedProductInner { + /** + * The URI to the .azpkg file that provides information required for + * showing product in the gallery. + */ + @JsonProperty(value = "galleryPackageBlobSasUri", access = JsonProperty.Access.WRITE_ONLY) + private String galleryPackageBlobSasUri; + + /** + * Specifies the kind of the product (virtualMachine or + * virtualMachineExtension). + */ + @JsonProperty(value = "productKind", access = JsonProperty.Access.WRITE_ONLY) + private String productKind; + + /** + * Specifies kind of compute role inclided in the package. Possible values + * include: 'None', 'IaaS', 'PaaS'. + */ + @JsonProperty(value = "properties.computeRole", access = JsonProperty.Access.WRITE_ONLY) + private ComputeRole computeRole; + + /** + * Specifies if product is a Virtual Machine Extension. + */ + @JsonProperty(value = "properties.isSystemExtension", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isSystemExtension; + + /** + * The URI. + */ + @JsonProperty(value = "properties.sourceBlob.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Indicates if specified product supports multiple extensions. + */ + @JsonProperty(value = "properties.supportMultipleExtensions", access = JsonProperty.Access.WRITE_ONLY) + private Boolean supportMultipleExtensions; + + /** + * Specifies product version. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Specifies operating system used by the product. Possible values include: + * 'None', 'Windows', 'Linux'. + */ + @JsonProperty(value = "properties.vmOsType", access = JsonProperty.Access.WRITE_ONLY) + private OperatingSystem vmOsType; + + /** + * Indicates if virtual machine Scale Set is enabled in the specified + * product. + */ + @JsonProperty(value = "properties.vmScaleSetEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean vmScaleSetEnabled; + + /** + * OS disk image used by product. + */ + @JsonProperty(value = "properties.osDiskImage", access = JsonProperty.Access.WRITE_ONLY) + private OsDiskImage osDiskImage; + + /** + * List of attached data disks. + */ + @JsonProperty(value = "properties.dataDiskImages", access = JsonProperty.Access.WRITE_ONLY) + private List dataDiskImages; + + /** + * Get the galleryPackageBlobSasUri value. + * + * @return the galleryPackageBlobSasUri value + */ + public String galleryPackageBlobSasUri() { + return this.galleryPackageBlobSasUri; + } + + /** + * Get the productKind value. + * + * @return the productKind value + */ + public String productKind() { + return this.productKind; + } + + /** + * Get the computeRole value. + * + * @return the computeRole value + */ + public ComputeRole computeRole() { + return this.computeRole; + } + + /** + * Get the isSystemExtension value. + * + * @return the isSystemExtension value + */ + public Boolean isSystemExtension() { + return this.isSystemExtension; + } + + /** + * Get the uri value. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get the supportMultipleExtensions value. + * + * @return the supportMultipleExtensions value + */ + public Boolean supportMultipleExtensions() { + return this.supportMultipleExtensions; + } + + /** + * Get the version value. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the vmOsType value. + * + * @return the vmOsType value + */ + public OperatingSystem vmOsType() { + return this.vmOsType; + } + + /** + * Get the vmScaleSetEnabled value. + * + * @return the vmScaleSetEnabled value + */ + public Boolean vmScaleSetEnabled() { + return this.vmScaleSetEnabled; + } + + /** + * Get the osDiskImage value. + * + * @return the osDiskImage value + */ + public OsDiskImage osDiskImage() { + return this.osDiskImage; + } + + /** + * Get the dataDiskImages value. + * + * @return the dataDiskImages value + */ + public List dataDiskImages() { + return this.dataDiskImages; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/OperationInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/OperationInner.java new file mode 100644 index 00000000000..aa9f7208503 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/OperationInner.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.azurestack.implementation; + +import com.microsoft.azure.management.azurestack.Display; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the supported REST operation. + */ +public class OperationInner { + /** + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Contains the localized display information for this particular operation + * or action. + */ + @JsonProperty(value = "display") + private Display display; + + /** + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * 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 Display display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(Display display) { + this.display = display; + return this; + } + + /** + * Get the origin value. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin value. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/OperationsInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/OperationsInner.java new file mode 100644 index 00000000000..11bcc6e1bb6 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.azurestack.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private AzureStackManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, AzureStackManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Operations list" }) + @GET("providers/Microsoft.AzureStack/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns the list of supported REST operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns the list of supported REST operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns the list of supported REST operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the list of supported REST operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns the list of supported REST operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the list of supported REST operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns the list of supported REST operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns the list of supported REST operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the list of supported REST operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns the list of supported REST operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/PageImpl.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/PageImpl.java new file mode 100644 index 00000000000..474c5bd0519 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/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.azurestack.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 nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + 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-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ProductInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ProductInner.java new file mode 100644 index 00000000000..8c56a7dd59c --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ProductInner.java @@ -0,0 +1,466 @@ +/** + * 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.azurestack.implementation; + +import com.microsoft.azure.management.azurestack.IconUris; +import java.util.List; +import com.microsoft.azure.management.azurestack.ProductLink; +import com.microsoft.azure.management.azurestack.ProductProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Product information. + */ +@JsonFlatten +public class ProductInner extends Resource { + /** + * The display name of the product. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The description of the product. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The user-friendly name of the product publisher. + */ + @JsonProperty(value = "properties.publisherDisplayName") + private String publisherDisplayName; + + /** + * Publisher identifier. + */ + @JsonProperty(value = "properties.publisherIdentifier") + private String publisherIdentifier; + + /** + * The offer representing the product. + */ + @JsonProperty(value = "properties.offer") + private String offer; + + /** + * The version of the product offer. + */ + @JsonProperty(value = "properties.offerVersion") + private String offerVersion; + + /** + * The product SKU. + */ + @JsonProperty(value = "properties.sku") + private String sku; + + /** + * The part number used for billing purposes. + */ + @JsonProperty(value = "properties.billingPartNumber") + private String billingPartNumber; + + /** + * The type of the Virtual Machine Extension. + */ + @JsonProperty(value = "properties.vmExtensionType") + private String vmExtensionType; + + /** + * The identifier of the gallery item corresponding to the product. + */ + @JsonProperty(value = "properties.galleryItemIdentity") + private String galleryItemIdentity; + + /** + * Additional links available for this product. + */ + @JsonProperty(value = "properties.iconUris") + private IconUris iconUris; + + /** + * Additional links available for this product. + */ + @JsonProperty(value = "properties.links") + private List links; + + /** + * The legal terms. + */ + @JsonProperty(value = "properties.legalTerms") + private String legalTerms; + + /** + * The privacy policy. + */ + @JsonProperty(value = "properties.privacyPolicy") + private String privacyPolicy; + + /** + * The length of product content. + */ + @JsonProperty(value = "properties.payloadLength") + private Long payloadLength; + + /** + * The kind of the product (virtualMachine or virtualMachineExtension). + */ + @JsonProperty(value = "properties.productKind") + private String productKind; + + /** + * Additional properties for the product. + */ + @JsonProperty(value = "properties.productProperties") + private ProductProperties productProperties; + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the ProductInner object itself. + */ + public ProductInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the ProductInner object itself. + */ + public ProductInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the publisherDisplayName value. + * + * @return the publisherDisplayName value + */ + public String publisherDisplayName() { + return this.publisherDisplayName; + } + + /** + * Set the publisherDisplayName value. + * + * @param publisherDisplayName the publisherDisplayName value to set + * @return the ProductInner object itself. + */ + public ProductInner withPublisherDisplayName(String publisherDisplayName) { + this.publisherDisplayName = publisherDisplayName; + return this; + } + + /** + * Get the publisherIdentifier value. + * + * @return the publisherIdentifier value + */ + public String publisherIdentifier() { + return this.publisherIdentifier; + } + + /** + * Set the publisherIdentifier value. + * + * @param publisherIdentifier the publisherIdentifier value to set + * @return the ProductInner object itself. + */ + public ProductInner withPublisherIdentifier(String publisherIdentifier) { + this.publisherIdentifier = publisherIdentifier; + return this; + } + + /** + * Get the offer value. + * + * @return the offer value + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer value. + * + * @param offer the offer value to set + * @return the ProductInner object itself. + */ + public ProductInner withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the offerVersion value. + * + * @return the offerVersion value + */ + public String offerVersion() { + return this.offerVersion; + } + + /** + * Set the offerVersion value. + * + * @param offerVersion the offerVersion value to set + * @return the ProductInner object itself. + */ + public ProductInner withOfferVersion(String offerVersion) { + this.offerVersion = offerVersion; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ProductInner object itself. + */ + public ProductInner withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the billingPartNumber value. + * + * @return the billingPartNumber value + */ + public String billingPartNumber() { + return this.billingPartNumber; + } + + /** + * Set the billingPartNumber value. + * + * @param billingPartNumber the billingPartNumber value to set + * @return the ProductInner object itself. + */ + public ProductInner withBillingPartNumber(String billingPartNumber) { + this.billingPartNumber = billingPartNumber; + return this; + } + + /** + * Get the vmExtensionType value. + * + * @return the vmExtensionType value + */ + public String vmExtensionType() { + return this.vmExtensionType; + } + + /** + * Set the vmExtensionType value. + * + * @param vmExtensionType the vmExtensionType value to set + * @return the ProductInner object itself. + */ + public ProductInner withVmExtensionType(String vmExtensionType) { + this.vmExtensionType = vmExtensionType; + return this; + } + + /** + * Get the galleryItemIdentity value. + * + * @return the galleryItemIdentity value + */ + public String galleryItemIdentity() { + return this.galleryItemIdentity; + } + + /** + * Set the galleryItemIdentity value. + * + * @param galleryItemIdentity the galleryItemIdentity value to set + * @return the ProductInner object itself. + */ + public ProductInner withGalleryItemIdentity(String galleryItemIdentity) { + this.galleryItemIdentity = galleryItemIdentity; + return this; + } + + /** + * Get the iconUris value. + * + * @return the iconUris value + */ + public IconUris iconUris() { + return this.iconUris; + } + + /** + * Set the iconUris value. + * + * @param iconUris the iconUris value to set + * @return the ProductInner object itself. + */ + public ProductInner withIconUris(IconUris iconUris) { + this.iconUris = iconUris; + return this; + } + + /** + * Get the links value. + * + * @return the links value + */ + public List links() { + return this.links; + } + + /** + * Set the links value. + * + * @param links the links value to set + * @return the ProductInner object itself. + */ + public ProductInner withLinks(List links) { + this.links = links; + return this; + } + + /** + * Get the legalTerms value. + * + * @return the legalTerms value + */ + public String legalTerms() { + return this.legalTerms; + } + + /** + * Set the legalTerms value. + * + * @param legalTerms the legalTerms value to set + * @return the ProductInner object itself. + */ + public ProductInner withLegalTerms(String legalTerms) { + this.legalTerms = legalTerms; + return this; + } + + /** + * Get the privacyPolicy value. + * + * @return the privacyPolicy value + */ + public String privacyPolicy() { + return this.privacyPolicy; + } + + /** + * Set the privacyPolicy value. + * + * @param privacyPolicy the privacyPolicy value to set + * @return the ProductInner object itself. + */ + public ProductInner withPrivacyPolicy(String privacyPolicy) { + this.privacyPolicy = privacyPolicy; + return this; + } + + /** + * Get the payloadLength value. + * + * @return the payloadLength value + */ + public Long payloadLength() { + return this.payloadLength; + } + + /** + * Set the payloadLength value. + * + * @param payloadLength the payloadLength value to set + * @return the ProductInner object itself. + */ + public ProductInner withPayloadLength(Long payloadLength) { + this.payloadLength = payloadLength; + return this; + } + + /** + * Get the productKind value. + * + * @return the productKind value + */ + public String productKind() { + return this.productKind; + } + + /** + * Set the productKind value. + * + * @param productKind the productKind value to set + * @return the ProductInner object itself. + */ + public ProductInner withProductKind(String productKind) { + this.productKind = productKind; + return this; + } + + /** + * Get the productProperties value. + * + * @return the productProperties value + */ + public ProductProperties productProperties() { + return this.productProperties; + } + + /** + * Set the productProperties value. + * + * @param productProperties the productProperties value to set + * @return the ProductInner object itself. + */ + public ProductInner withProductProperties(ProductProperties productProperties) { + this.productProperties = productProperties; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ProductsInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ProductsInner.java new file mode 100644 index 00000000000..057ea1e4a0d --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/ProductsInner.java @@ -0,0 +1,502 @@ +/** + * 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.azurestack.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +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.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Products. + */ +public class ProductsInner { + /** The Retrofit service to perform REST calls. */ + private ProductsService service; + /** The service client containing this operation class. */ + private AzureStackManagementClientImpl client; + + /** + * Initializes an instance of ProductsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductsInner(Retrofit retrofit, AzureStackManagementClientImpl client) { + this.service = retrofit.create(ProductsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Products to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Products list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Products get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Products listDetails" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/products/{productName}/listDetails") + Observable> listDetails(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Products listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductInner> object if successful. + */ + public PagedList list(final String resourceGroup, final String registrationName) { + ServiceResponse> response = listSinglePageAsync(resourceGroup, registrationName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroup, final String registrationName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroup, registrationName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listAsync(final String resourceGroup, final String registrationName) { + return listWithServiceResponseAsync(resourceGroup, registrationName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of products. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroup, final String registrationName) { + return listSinglePageAsync(resourceGroup, registrationName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns a list of products. + * + ServiceResponse> * @param resourceGroup Name of the resource group. + ServiceResponse> * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroup, final String registrationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName 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(), resourceGroup, registrationName, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductInner object if successful. + */ + public ProductInner get(String resourceGroup, String registrationName, String productName) { + return getWithServiceResponseAsync(resourceGroup, registrationName, productName).toBlocking().single().body(); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroup, String registrationName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroup, registrationName, productName), serviceCallback); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable getAsync(String resourceGroup, String registrationName, String productName) { + return getWithServiceResponseAsync(resourceGroup, registrationName, productName).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the specified product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroup, String registrationName, String productName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName 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(this.client.subscriptionId(), resourceGroup, registrationName, productName, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the extended properties of a product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ExtendedProductInner object if successful. + */ + public ExtendedProductInner listDetails(String resourceGroup, String registrationName, String productName) { + return listDetailsWithServiceResponseAsync(resourceGroup, registrationName, productName).toBlocking().single().body(); + } + + /** + * Returns the extended properties of a product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listDetailsAsync(String resourceGroup, String registrationName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listDetailsWithServiceResponseAsync(resourceGroup, registrationName, productName), serviceCallback); + } + + /** + * Returns the extended properties of a product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedProductInner object + */ + public Observable listDetailsAsync(String resourceGroup, String registrationName, String productName) { + return listDetailsWithServiceResponseAsync(resourceGroup, registrationName, productName).map(new Func1, ExtendedProductInner>() { + @Override + public ExtendedProductInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the extended properties of a product. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param productName Name of the product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ExtendedProductInner object + */ + public Observable> listDetailsWithServiceResponseAsync(String resourceGroup, String registrationName, String productName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName 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.listDetails(this.client.subscriptionId(), resourceGroup, registrationName, productName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDetailsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDetailsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of products. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns a list of products. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> 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."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationInner.java new file mode 100644 index 00000000000..237621f0ee7 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationInner.java @@ -0,0 +1,99 @@ +/** + * 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.azurestack.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Registration information. + */ +@JsonFlatten +public class RegistrationInner extends Resource { + /** + * The object identifier associated with the Azure Stack connecting to + * Azure. + */ + @JsonProperty(value = "properties.objectId") + private String objectId; + + /** + * The identifier of the registered Azure Stack. + */ + @JsonProperty(value = "properties.cloudId") + private String cloudId; + + /** + * Specifies the billing mode for the Azure Stack registration. + */ + @JsonProperty(value = "properties.billingModel") + private String billingModel; + + /** + * Get the objectId value. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId value. + * + * @param objectId the objectId value to set + * @return the RegistrationInner object itself. + */ + public RegistrationInner withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the cloudId value. + * + * @return the cloudId value + */ + public String cloudId() { + return this.cloudId; + } + + /** + * Set the cloudId value. + * + * @param cloudId the cloudId value to set + * @return the RegistrationInner object itself. + */ + public RegistrationInner withCloudId(String cloudId) { + this.cloudId = cloudId; + return this; + } + + /** + * Get the billingModel value. + * + * @return the billingModel value + */ + public String billingModel() { + return this.billingModel; + } + + /** + * Set the billingModel value. + * + * @param billingModel the billingModel value to set + * @return the RegistrationInner object itself. + */ + public RegistrationInner withBillingModel(String billingModel) { + this.billingModel = billingModel; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationParameterInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationParameterInner.java new file mode 100644 index 00000000000..7d5181356ee --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationParameterInner.java @@ -0,0 +1,46 @@ +/** + * 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.azurestack.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Registration resource. + */ +@JsonFlatten +public class RegistrationParameterInner extends Resource { + /** + * The token identifying registered Azure Stack. + */ + @JsonProperty(value = "properties.registrationToken", required = true) + private String registrationToken; + + /** + * Get the registrationToken value. + * + * @return the registrationToken value + */ + public String registrationToken() { + return this.registrationToken; + } + + /** + * Set the registrationToken value. + * + * @param registrationToken the registrationToken value to set + * @return the RegistrationParameterInner object itself. + */ + public RegistrationParameterInner withRegistrationToken(String registrationToken) { + this.registrationToken = registrationToken; + return this; + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationsInner.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationsInner.java new file mode 100644 index 00000000000..4f344dc57d0 --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/RegistrationsInner.java @@ -0,0 +1,676 @@ +/** + * 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.azurestack.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +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.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Registrations. + */ +public class RegistrationsInner implements InnerSupportsGet, InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private RegistrationsService service; + /** The service client containing this operation class. */ + private AzureStackManagementClientImpl client; + + /** + * Initializes an instance of RegistrationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RegistrationsInner(Retrofit retrofit, AzureStackManagementClientImpl client) { + this.service = retrofit.create(RegistrationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Registrations to be + * used by Retrofit to perform actually REST calls. + */ + interface RegistrationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Registrations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Registrations getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Registrations delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Registrations createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Query("api-version") String apiVersion, @Body RegistrationParameterInner token, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Registrations getActivationKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/getactivationkey") + Observable> getActivationKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Path("registrationName") String registrationName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.azurestack.Registrations listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns a list of all registrations. + * + * @param resourceGroup Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<RegistrationInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroup) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroup).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns a list of all registrations. + * + * @param resourceGroup Name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroup, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroup), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns a list of all registrations. + * + * @param resourceGroup Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistrationInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroup) { + return listByResourceGroupWithServiceResponseAsync(resourceGroup) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of all registrations. + * + * @param resourceGroup Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistrationInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroup) { + return listByResourceGroupSinglePageAsync(resourceGroup) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns a list of all registrations. + * + ServiceResponse> * @param resourceGroup Name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RegistrationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroup) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup 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(this.client.subscriptionId(), resourceGroup, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the properties of an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistrationInner object if successful. + */ + public RegistrationInner getByResourceGroup(String resourceGroup, String registrationName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroup, registrationName).toBlocking().single().body(); + } + + /** + * Returns the properties of an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroup, String registrationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroup, registrationName), serviceCallback); + } + + /** + * Returns the properties of an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistrationInner object + */ + public Observable getByResourceGroupAsync(String resourceGroup, String registrationName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroup, registrationName).map(new Func1, RegistrationInner>() { + @Override + public RegistrationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the properties of an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistrationInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroup, String registrationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName 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.getByResourceGroup(this.client.subscriptionId(), resourceGroup, registrationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete the requested Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroup, String registrationName) { + deleteWithServiceResponseAsync(resourceGroup, registrationName).toBlocking().single().body(); + } + + /** + * Delete the requested Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroup, String registrationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroup, registrationName), serviceCallback); + } + + /** + * Delete the requested Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroup, String registrationName) { + return deleteWithServiceResponseAsync(resourceGroup, registrationName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the requested Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroup, String registrationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName 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.delete(this.client.subscriptionId(), resourceGroup, registrationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param token Registration token + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the RegistrationInner object if successful. + */ + public RegistrationInner createOrUpdate(String resourceGroup, String registrationName, RegistrationParameterInner token) { + return createOrUpdateWithServiceResponseAsync(resourceGroup, registrationName, token).toBlocking().single().body(); + } + + /** + * Create or update an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param token Registration token + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroup, String registrationName, RegistrationParameterInner token, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroup, registrationName, token), serviceCallback); + } + + /** + * Create or update an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param token Registration token + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistrationInner object + */ + public Observable createOrUpdateAsync(String resourceGroup, String registrationName, RegistrationParameterInner token) { + return createOrUpdateWithServiceResponseAsync(resourceGroup, registrationName, token).map(new Func1, RegistrationInner>() { + @Override + public RegistrationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Stack registration. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param token Registration token + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RegistrationInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroup, String registrationName, RegistrationParameterInner token) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName 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 (token == null) { + throw new IllegalArgumentException("Parameter token is required and cannot be null."); + } + Validator.validate(token); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroup, registrationName, this.client.apiVersion(), token, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns Azure Stack Activation Key. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivationKeyResultInner object if successful. + */ + public ActivationKeyResultInner getActivationKey(String resourceGroup, String registrationName) { + return getActivationKeyWithServiceResponseAsync(resourceGroup, registrationName).toBlocking().single().body(); + } + + /** + * Returns Azure Stack Activation Key. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getActivationKeyAsync(String resourceGroup, String registrationName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getActivationKeyWithServiceResponseAsync(resourceGroup, registrationName), serviceCallback); + } + + /** + * Returns Azure Stack Activation Key. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivationKeyResultInner object + */ + public Observable getActivationKeyAsync(String resourceGroup, String registrationName) { + return getActivationKeyWithServiceResponseAsync(resourceGroup, registrationName).map(new Func1, ActivationKeyResultInner>() { + @Override + public ActivationKeyResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns Azure Stack Activation Key. + * + * @param resourceGroup Name of the resource group. + * @param registrationName Name of the Azure Stack registration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivationKeyResultInner object + */ + public Observable> getActivationKeyWithServiceResponseAsync(String resourceGroup, String registrationName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (registrationName == null) { + throw new IllegalArgumentException("Parameter registrationName 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.getActivationKey(this.client.subscriptionId(), resourceGroup, registrationName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getActivationKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getActivationKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a list of all registrations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<RegistrationInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns a list of all registrations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns a list of all registrations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistrationInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of all registrations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RegistrationInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns a list of all registrations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RegistrationInner> 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."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, 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.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/package-info.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/implementation/package-info.java new file mode 100644 index 00000000000..bf6e823fc4b --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/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 AzureStackManagementClient. + * Azure Stack. + */ +package com.microsoft.azure.management.azurestack.implementation; diff --git a/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/package-info.java b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/package-info.java new file mode 100644 index 00000000000..dfb7c4b99fc --- /dev/null +++ b/azure-mgmt-azurestack/src/main/java/com/microsoft/azure/management/azurestack/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 AzureStackManagementClient. + * Azure Stack. + */ +package com.microsoft.azure.management.azurestack;