diff --git a/sdk/storage/mgmt-v2018_07_01/pom.xml b/sdk/storage/mgmt-v2018_07_01/pom.xml index 3113c4975fa34..67c219a2529b2 100644 --- a/sdk/storage/mgmt-v2018_07_01/pom.xml +++ b/sdk/storage/mgmt-v2018_07_01/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 1.2.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-storage @@ -19,7 +19,7 @@ jar Microsoft Azure SDK for Storage Management This package contains Microsoft Storage Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainer.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainer.java index 3094bc2edbce2..f8cad4b502824 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainer.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainer.java @@ -16,8 +16,8 @@ import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.storage.v2018_07_01.implementation.StorageManager; -import org.joda.time.DateTime; import java.util.Map; +import org.joda.time.DateTime; /** * Type representing BlobContainer. @@ -96,7 +96,7 @@ public interface BlobContainer extends HasInner, Indexable, /** * The entirety of the BlobContainer definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBlobService, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBlobService, DefinitionStages.WithPublicAccess, DefinitionStages.WithMetadata, DefinitionStages.WithCreate { } /** @@ -115,8 +115,35 @@ interface Blank extends WithBlobService { interface WithBlobService { /** * Specifies resourceGroupName, accountName. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only + * @return the next definition stage + */ + WithPublicAccess withExistingBlobService(String resourceGroupName, String accountName); + } + + /** + * The stage of the blobcontainer definition allowing to specify PublicAccess. + */ + interface WithPublicAccess { + /** + * Specifies publicAccess. + * @param publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @return the next definition stage + */ + WithMetadata withPublicAccess(PublicAccess publicAccess); + } + + /** + * The stage of the blobcontainer definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata A name-value pair to associate with the container as metadata + * @return the next definition stage */ - WithCreate withExistingBlobService(String resourceGroupName, String accountName); + WithCreate withMetadata(Map metadata); } /** @@ -130,12 +157,36 @@ interface WithCreate extends Creatable { /** * The template for a BlobContainer update operation, containing all the settings that can be modified. */ - interface Update extends Appliable { + interface Update extends Appliable, UpdateStages.WithPublicAccess, UpdateStages.WithMetadata { } /** * Grouping of BlobContainer update stages. */ interface UpdateStages { + /** + * The stage of the blobcontainer update allowing to specify PublicAccess. + */ + interface WithPublicAccess { + /** + * Specifies publicAccess. + * @param publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @return the next update stage + */ + Update withPublicAccess(PublicAccess publicAccess); + } + + /** + * The stage of the blobcontainer update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata A name-value pair to associate with the container as metadata + * @return the next update stage + */ + Update withMetadata(Map metadata); + } + } } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainers.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainers.java index 19a94b05e165b..a72756046faf7 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainers.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobContainers.java @@ -86,6 +86,17 @@ public interface BlobContainers { */ Observable clearLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List tags); + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable leaseAsync(String resourceGroupName, String accountName, String containerName); + /** * Gets the existing immutability policy along with the corresponding ETag in response headers and body. * diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobServiceProperties.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobServiceProperties.java new file mode 100644 index 0000000000000..482aa5f47cf92 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobServiceProperties.java @@ -0,0 +1,175 @@ +/** + * 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.storage.v2018_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.storage.v2018_07_01.implementation.BlobServicePropertiesInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storage.v2018_07_01.implementation.StorageManager; + +/** + * Type representing BlobServiceProperties. + */ +public interface BlobServiceProperties extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the cors value. + */ + CorsRules cors(); + + /** + * @return the defaultServiceVersion value. + */ + String defaultServiceVersion(); + + /** + * @return the deleteRetentionPolicy value. + */ + DeleteRetentionPolicy deleteRetentionPolicy(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BlobServiceProperties definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithStorageAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of BlobServiceProperties definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BlobServiceProperties definition. + */ + interface Blank extends WithStorageAccount { + } + + /** + * The stage of the blobserviceproperties definition allowing to specify StorageAccount. + */ + interface WithStorageAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only + * @return the next definition stage + */ + WithCreate withExistingStorageAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the blobserviceproperties definition allowing to specify Cors. + */ + interface WithCors { + /** + * Specifies cors. + * @param cors Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service + * @return the next definition stage + */ + WithCreate withCors(CorsRules cors); + } + + /** + * The stage of the blobserviceproperties definition allowing to specify DefaultServiceVersion. + */ + interface WithDefaultServiceVersion { + /** + * Specifies defaultServiceVersion. + * @param defaultServiceVersion DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions + * @return the next definition stage + */ + WithCreate withDefaultServiceVersion(String defaultServiceVersion); + } + + /** + * The stage of the blobserviceproperties definition allowing to specify DeleteRetentionPolicy. + */ + interface WithDeleteRetentionPolicy { + /** + * Specifies deleteRetentionPolicy. + * @param deleteRetentionPolicy The blob service properties for soft delete + * @return the next definition stage + */ + WithCreate withDeleteRetentionPolicy(DeleteRetentionPolicy deleteRetentionPolicy); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithCors, DefinitionStages.WithDefaultServiceVersion, DefinitionStages.WithDeleteRetentionPolicy { + } + } + /** + * The template for a BlobServiceProperties update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCors, UpdateStages.WithDefaultServiceVersion, UpdateStages.WithDeleteRetentionPolicy { + } + + /** + * Grouping of BlobServiceProperties update stages. + */ + interface UpdateStages { + /** + * The stage of the blobserviceproperties update allowing to specify Cors. + */ + interface WithCors { + /** + * Specifies cors. + * @param cors Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service + * @return the next update stage + */ + Update withCors(CorsRules cors); + } + + /** + * The stage of the blobserviceproperties update allowing to specify DefaultServiceVersion. + */ + interface WithDefaultServiceVersion { + /** + * Specifies defaultServiceVersion. + * @param defaultServiceVersion DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions + * @return the next update stage + */ + Update withDefaultServiceVersion(String defaultServiceVersion); + } + + /** + * The stage of the blobserviceproperties update allowing to specify DeleteRetentionPolicy. + */ + interface WithDeleteRetentionPolicy { + /** + * Specifies deleteRetentionPolicy. + * @param deleteRetentionPolicy The blob service properties for soft delete + * @return the next update stage + */ + Update withDeleteRetentionPolicy(DeleteRetentionPolicy deleteRetentionPolicy); + } + + } +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobServices.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobServices.java new file mode 100644 index 0000000000000..5a317c549c256 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/BlobServices.java @@ -0,0 +1,30 @@ +/** + * 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.storage.v2018_07_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.storage.v2018_07_01.implementation.BlobServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BlobServices. + */ +public interface BlobServices extends SupportsCreating, HasInner { + /** + * Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getServicePropertiesAsync(String resourceGroupName, String accountName); + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CorsRule.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CorsRule.java new file mode 100644 index 0000000000000..18d2183444157 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CorsRule.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.v2018_07_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies a CORS rule for the Blob service. + */ +public class CorsRule { + /** + * Required if CorsRule element is present. A list of origin domains that + * will be allowed via CORS, or "*" to allow all domains. + */ + @JsonProperty(value = "allowedOrigins", required = true) + private List allowedOrigins; + + /** + * Required if CorsRule element is present. A list of HTTP methods that are + * allowed to be executed by the origin. + */ + @JsonProperty(value = "allowedMethods", required = true) + private List allowedMethods; + + /** + * Required if CorsRule element is present. The number of seconds that the + * client/browser should cache a preflight response. + */ + @JsonProperty(value = "maxAgeInSeconds", required = true) + private int maxAgeInSeconds; + + /** + * Required if CorsRule element is present. A list of response headers to + * expose to CORS clients. + */ + @JsonProperty(value = "exposedHeaders", required = true) + private List exposedHeaders; + + /** + * Required if CorsRule element is present. A list of headers allowed to be + * part of the cross-origin request. + */ + @JsonProperty(value = "allowedHeaders", required = true) + private List allowedHeaders; + + /** + * Get required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. + * + * @return the allowedOrigins value + */ + public List allowedOrigins() { + return this.allowedOrigins; + } + + /** + * Set required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow all domains. + * + * @param allowedOrigins the allowedOrigins value to set + * @return the CorsRule object itself. + */ + public CorsRule withAllowedOrigins(List allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + /** + * Get required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. + * + * @return the allowedMethods value + */ + public List allowedMethods() { + return this.allowedMethods; + } + + /** + * Set required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin. + * + * @param allowedMethods the allowedMethods value to set + * @return the CorsRule object itself. + */ + public CorsRule withAllowedMethods(List allowedMethods) { + this.allowedMethods = allowedMethods; + return this; + } + + /** + * Get required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. + * + * @return the maxAgeInSeconds value + */ + public int maxAgeInSeconds() { + return this.maxAgeInSeconds; + } + + /** + * Set required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response. + * + * @param maxAgeInSeconds the maxAgeInSeconds value to set + * @return the CorsRule object itself. + */ + public CorsRule withMaxAgeInSeconds(int maxAgeInSeconds) { + this.maxAgeInSeconds = maxAgeInSeconds; + return this; + } + + /** + * Get required if CorsRule element is present. A list of response headers to expose to CORS clients. + * + * @return the exposedHeaders value + */ + public List exposedHeaders() { + return this.exposedHeaders; + } + + /** + * Set required if CorsRule element is present. A list of response headers to expose to CORS clients. + * + * @param exposedHeaders the exposedHeaders value to set + * @return the CorsRule object itself. + */ + public CorsRule withExposedHeaders(List exposedHeaders) { + this.exposedHeaders = exposedHeaders; + return this; + } + + /** + * Get required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. + * + * @return the allowedHeaders value + */ + public List allowedHeaders() { + return this.allowedHeaders; + } + + /** + * Set required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request. + * + * @param allowedHeaders the allowedHeaders value to set + * @return the CorsRule object itself. + */ + public CorsRule withAllowedHeaders(List allowedHeaders) { + this.allowedHeaders = allowedHeaders; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CorsRules.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CorsRules.java new file mode 100644 index 0000000000000..f87c9c9854426 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CorsRules.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.storage.v2018_07_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Sets the CORS rules. You can include up to five CorsRule elements in the + * request. + */ +public class CorsRules { + /** + * The List of CORS rules. You can include up to five CorsRule elements in + * the request. + */ + @JsonProperty(value = "corsRules") + private List corsRules; + + /** + * Get the List of CORS rules. You can include up to five CorsRule elements in the request. + * + * @return the corsRules value + */ + public List corsRules() { + return this.corsRules; + } + + /** + * Set the List of CORS rules. You can include up to five CorsRule elements in the request. + * + * @param corsRules the corsRules value to set + * @return the CorsRules object itself. + */ + public CorsRules withCorsRules(List corsRules) { + this.corsRules = corsRules; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CustomDomain.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CustomDomain.java index d94a30c7346dd..a8d0a25a03e6d 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CustomDomain.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/CustomDomain.java @@ -26,8 +26,8 @@ public class CustomDomain { * Indicates whether indirect CName validation is enabled. Default value is * false. This should only be set on updates. */ - @JsonProperty(value = "useSubDomain") - private Boolean useSubDomain; + @JsonProperty(value = "useSubDomainName") + private Boolean useSubDomainName; /** * Get gets or sets the custom domain name assigned to the storage account. Name is the CNAME source. @@ -52,20 +52,20 @@ public CustomDomain withName(String name) { /** * Get indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. * - * @return the useSubDomain value + * @return the useSubDomainName value */ - public Boolean useSubDomain() { - return this.useSubDomain; + public Boolean useSubDomainName() { + return this.useSubDomainName; } /** * Set indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates. * - * @param useSubDomain the useSubDomain value to set + * @param useSubDomainName the useSubDomainName value to set * @return the CustomDomain object itself. */ - public CustomDomain withUseSubDomain(Boolean useSubDomain) { - this.useSubDomain = useSubDomain; + public CustomDomain withUseSubDomainName(Boolean useSubDomainName) { + this.useSubDomainName = useSubDomainName; return this; } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/DeleteRetentionPolicy.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/DeleteRetentionPolicy.java new file mode 100644 index 0000000000000..6f2da384f4c05 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/DeleteRetentionPolicy.java @@ -0,0 +1,70 @@ +/** + * 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.storage.v2018_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The blob service properties for soft delete. + */ +public class DeleteRetentionPolicy { + /** + * Indicates whether DeleteRetentionPolicy is enabled for the Blob service. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Indicates the number of days that the deleted blob should be retained. + * The minimum specified value can be 1 and the maximum value can be 365. + */ + @JsonProperty(value = "days") + private Integer days; + + /** + * Get indicates whether DeleteRetentionPolicy is enabled for the Blob service. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether DeleteRetentionPolicy is enabled for the Blob service. + * + * @param enabled the enabled value to set + * @return the DeleteRetentionPolicy object itself. + */ + public DeleteRetentionPolicy withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get indicates the number of days that the deleted blob should be retained. The minimum specified value can be 1 and the maximum value can be 365. + * + * @return the days value + */ + public Integer days() { + return this.days; + } + + /** + * Set indicates the number of days that the deleted blob should be retained. The minimum specified value can be 1 and the maximum value can be 365. + * + * @param days the days value to set + * @return the DeleteRetentionPolicy object itself. + */ + public DeleteRetentionPolicy withDays(Integer days) { + this.days = days; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/Dimension.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/Dimension.java index 865d0b65bb53c..b6f9ada52d1a4 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/Dimension.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/Dimension.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Dimension of blobs, possiblly be blob type or access tier. + * Dimension of blobs, possibly be blob type or access tier. */ public class Dimension { /** diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/GeoReplicationStats.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/GeoReplicationStats.java new file mode 100644 index 0000000000000..6a767bc92feee --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/GeoReplicationStats.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.v2018_07_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Statistics related to replication for storage account's Blob, Table, Queue + * and File services. It is only available when geo-redundant replication is + * enabled for the storage account. + */ +public class GeoReplicationStats { + /** + * The status of the secondary location. Possible values are: - Live: + * Indicates that the secondary location is active and operational. - + * Bootstrap: Indicates initial synchronization from the primary location + * to the secondary location is in progress.This typically occurs when + * replication is first enabled. - Unavailable: Indicates that the + * secondary location is temporarily unavailable. Possible values include: + * 'Live', 'Bootstrap', 'Unavailable'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private GeoReplicationStatus status; + + /** + * All primary writes preceding this UTC date/time value are guaranteed to + * be available for read operations. Primary writes following this point in + * time may or may not be available for reads. Element may be default value + * if value of LastSyncTime is not available, this can happen if secondary + * is offline or we are in bootstrap. + */ + @JsonProperty(value = "lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastSyncTime; + + /** + * A boolean flag which indicates whether or not account failover is + * supported for the account. + */ + @JsonProperty(value = "canFailover", access = JsonProperty.Access.WRITE_ONLY) + private Boolean canFailover; + + /** + * Get the status of the secondary location. Possible values are: - Live: Indicates that the secondary location is active and operational. - Bootstrap: Indicates initial synchronization from the primary location to the secondary location is in progress.This typically occurs when replication is first enabled. - Unavailable: Indicates that the secondary location is temporarily unavailable. Possible values include: 'Live', 'Bootstrap', 'Unavailable'. + * + * @return the status value + */ + public GeoReplicationStatus status() { + return this.status; + } + + /** + * Get all primary writes preceding this UTC date/time value are guaranteed to be available for read operations. Primary writes following this point in time may or may not be available for reads. Element may be default value if value of LastSyncTime is not available, this can happen if secondary is offline or we are in bootstrap. + * + * @return the lastSyncTime value + */ + public DateTime lastSyncTime() { + return this.lastSyncTime; + } + + /** + * Get a boolean flag which indicates whether or not account failover is supported for the account. + * + * @return the canFailover value + */ + public Boolean canFailover() { + return this.canFailover; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/GeoReplicationStatus.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/GeoReplicationStatus.java new file mode 100644 index 0000000000000..78eddbb466895 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/GeoReplicationStatus.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.storage.v2018_07_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for GeoReplicationStatus. + */ +public final class GeoReplicationStatus extends ExpandableStringEnum { + /** Static value Live for GeoReplicationStatus. */ + public static final GeoReplicationStatus LIVE = fromString("Live"); + + /** Static value Bootstrap for GeoReplicationStatus. */ + public static final GeoReplicationStatus BOOTSTRAP = fromString("Bootstrap"); + + /** Static value Unavailable for GeoReplicationStatus. */ + public static final GeoReplicationStatus UNAVAILABLE = fromString("Unavailable"); + + /** + * Creates or finds a GeoReplicationStatus from its string representation. + * @param name a name to look for + * @return the corresponding GeoReplicationStatus + */ + @JsonCreator + public static GeoReplicationStatus fromString(String name) { + return fromString(name, GeoReplicationStatus.class); + } + + /** + * @return known GeoReplicationStatus values + */ + public static Collection values() { + return values(GeoReplicationStatus.class); + } +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ImmutabilityPolicy.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ImmutabilityPolicy.java index a70873dc21f39..9a3f763714f9e 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ImmutabilityPolicy.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ImmutabilityPolicy.java @@ -55,7 +55,7 @@ public interface ImmutabilityPolicy extends HasInner, I /** * The entirety of the ImmutabilityPolicy definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithContainer, DefinitionStages.WithImmutabilityPeriodSinceCreationInDays, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithContainer, DefinitionStages.WithIfMatch, DefinitionStages.WithImmutabilityPeriodSinceCreationInDays, DefinitionStages.WithCreate { } /** @@ -74,8 +74,24 @@ interface Blank extends WithContainer { interface WithContainer { /** * Specifies resourceGroupName, accountName, containerName. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number + * @return the next definition stage */ - WithImmutabilityPeriodSinceCreationInDays withExistingContainer(String resourceGroupName, String accountName, String containerName); + WithIfMatch withExistingContainer(String resourceGroupName, String accountName, String containerName); + } + + /** + * The stage of the immutabilitypolicy definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied + * @return the next definition stage + */ + WithImmutabilityPeriodSinceCreationInDays withIfMatch(String ifMatch); } /** @@ -84,6 +100,8 @@ interface WithContainer { interface WithImmutabilityPeriodSinceCreationInDays { /** * Specifies immutabilityPeriodSinceCreationInDays. + * @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days + * @return the next definition stage */ WithCreate withImmutabilityPeriodSinceCreationInDays(int immutabilityPeriodSinceCreationInDays); } @@ -99,19 +117,33 @@ interface WithCreate extends Creatable { /** * The template for a ImmutabilityPolicy update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, UpdateStages.WithImmutabilityPeriodSinceCreationInDays { + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithImmutabilityPeriodSinceCreationInDays { } /** * Grouping of ImmutabilityPolicy update stages. */ interface UpdateStages { + /** + * The stage of the immutabilitypolicy update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + /** * The stage of the immutabilitypolicy update allowing to specify ImmutabilityPeriodSinceCreationInDays. */ interface WithImmutabilityPeriodSinceCreationInDays { /** * Specifies immutabilityPeriodSinceCreationInDays. + * @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days + * @return the next update stage */ Update withImmutabilityPeriodSinceCreationInDays(int immutabilityPeriodSinceCreationInDays); } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/LeaseContainerRequest.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/LeaseContainerRequest.java new file mode 100644 index 0000000000000..36270f628dc1b --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/LeaseContainerRequest.java @@ -0,0 +1,152 @@ +/** + * 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.storage.v2018_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Lease Container request schema. + */ +public class LeaseContainerRequest { + /** + * Specifies the lease action. Can be one of the available actions. + * Possible values include: 'Acquire', 'Renew', 'Change', 'Release', + * 'Break'. + */ + @JsonProperty(value = "action", required = true) + private String action; + + /** + * Identifies the lease. Can be specified in any valid GUID string format. + */ + @JsonProperty(value = "leaseId") + private String leaseId; + + /** + * Optional. For a break action, proposed duration the lease should + * continue before it is broken, in seconds, between 0 and 60. + */ + @JsonProperty(value = "breakPeriod") + private Integer breakPeriod; + + /** + * Required for acquire. Specifies the duration of the lease, in seconds, + * or negative one (-1) for a lease that never expires. + */ + @JsonProperty(value = "leaseDuration") + private Integer leaseDuration; + + /** + * Optional for acquire, required for change. Proposed lease ID, in a GUID + * string format. + */ + @JsonProperty(value = "proposedLeaseId") + private String proposedLeaseId; + + /** + * Get specifies the lease action. Can be one of the available actions. Possible values include: 'Acquire', 'Renew', 'Change', 'Release', 'Break'. + * + * @return the action value + */ + public String action() { + return this.action; + } + + /** + * Set specifies the lease action. Can be one of the available actions. Possible values include: 'Acquire', 'Renew', 'Change', 'Release', 'Break'. + * + * @param action the action value to set + * @return the LeaseContainerRequest object itself. + */ + public LeaseContainerRequest withAction(String action) { + this.action = action; + return this; + } + + /** + * Get identifies the lease. Can be specified in any valid GUID string format. + * + * @return the leaseId value + */ + public String leaseId() { + return this.leaseId; + } + + /** + * Set identifies the lease. Can be specified in any valid GUID string format. + * + * @param leaseId the leaseId value to set + * @return the LeaseContainerRequest object itself. + */ + public LeaseContainerRequest withLeaseId(String leaseId) { + this.leaseId = leaseId; + return this; + } + + /** + * Get optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. + * + * @return the breakPeriod value + */ + public Integer breakPeriod() { + return this.breakPeriod; + } + + /** + * Set optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. + * + * @param breakPeriod the breakPeriod value to set + * @return the LeaseContainerRequest object itself. + */ + public LeaseContainerRequest withBreakPeriod(Integer breakPeriod) { + this.breakPeriod = breakPeriod; + return this; + } + + /** + * Get required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. + * + * @return the leaseDuration value + */ + public Integer leaseDuration() { + return this.leaseDuration; + } + + /** + * Set required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. + * + * @param leaseDuration the leaseDuration value to set + * @return the LeaseContainerRequest object itself. + */ + public LeaseContainerRequest withLeaseDuration(Integer leaseDuration) { + this.leaseDuration = leaseDuration; + return this; + } + + /** + * Get optional for acquire, required for change. Proposed lease ID, in a GUID string format. + * + * @return the proposedLeaseId value + */ + public String proposedLeaseId() { + return this.proposedLeaseId; + } + + /** + * Set optional for acquire, required for change. Proposed lease ID, in a GUID string format. + * + * @param proposedLeaseId the proposedLeaseId value to set + * @return the LeaseContainerRequest object itself. + */ + public LeaseContainerRequest withProposedLeaseId(String proposedLeaseId) { + this.proposedLeaseId = proposedLeaseId; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/LeaseContainerResponse.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/LeaseContainerResponse.java new file mode 100644 index 0000000000000..7250ed0e30bd5 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/LeaseContainerResponse.java @@ -0,0 +1,30 @@ +/** + * 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.storage.v2018_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storage.v2018_07_01.implementation.StorageManager; +import com.microsoft.azure.management.storage.v2018_07_01.implementation.LeaseContainerResponseInner; + +/** + * Type representing LeaseContainerResponse. + */ +public interface LeaseContainerResponse extends HasInner, HasManager { + /** + * @return the leaseId value. + */ + String leaseId(); + + /** + * @return the leaseTimeSeconds value. + */ + String leaseTimeSeconds(); + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ManagementPolicies.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ManagementPolicies.java new file mode 100644 index 0000000000000..b04b1bef2ced0 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ManagementPolicies.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.v2018_07_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.storage.v2018_07_01.implementation.ManagementPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagementPolicies. + */ +public interface ManagementPolicies extends SupportsCreating, HasInner { + /** + * Gets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName); + + /** + * Deletes the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName); + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ManagementPoliciesRulesSetParameter.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ManagementPoliciesRulesSetParameter.java new file mode 100644 index 0000000000000..22c4231bfb4e1 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ManagementPoliciesRulesSetParameter.java @@ -0,0 +1,49 @@ +/** + * 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.storage.v2018_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The Storage Account ManagementPolicies Rules, in JSON format. See more + * details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ +@JsonFlatten +public class ManagementPoliciesRulesSetParameter { + /** + * The Storage Account ManagementPolicies Rules, in JSON format. See more + * details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ + @JsonProperty(value = "properties.policy") + private Object policy; + + /** + * Get the Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @return the policy value + */ + public Object policy() { + return this.policy; + } + + /** + * Set the Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @param policy the policy value to set + * @return the ManagementPoliciesRulesSetParameter object itself. + */ + public ManagementPoliciesRulesSetParameter withPolicy(Object policy) { + this.policy = policy; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/SKUCapability.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/SKUCapability.java index d6557a5d4f927..525186013042e 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/SKUCapability.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/SKUCapability.java @@ -11,13 +11,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The capability information in the specified sku, including file encryption, - * network acls, change notification, etc. + * The capability information in the specified SKU, including file encryption, + * network ACLs, change notification, etc. */ public class SKUCapability { /** - * The name of capability, The capability information in the specified sku, - * including file encryption, network acls, change notification, etc. + * The name of capability, The capability information in the specified SKU, + * including file encryption, network ACLs, change notification, etc. */ @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; @@ -30,7 +30,7 @@ public class SKUCapability { private String value; /** - * Get the name of capability, The capability information in the specified sku, including file encryption, network acls, change notification, etc. + * Get the name of capability, The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. * * @return the name value */ diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ServiceSasParameters.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ServiceSasParameters.java index fc8c469d9632e..623550b03ebe8 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ServiceSasParameters.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/ServiceSasParameters.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The parameters to list service SAS credentials of a speicific resource. + * The parameters to list service SAS credentials of a specific resource. */ public class ServiceSasParameters { /** diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccount.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccount.java index eca1971d1f5f1..124265b35ef9c 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccount.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccount.java @@ -56,6 +56,16 @@ public interface StorageAccount extends HasInner, Resource, */ Encryption encryption(); + /** + * @return the failoverInProgress value. + */ + Boolean failoverInProgress(); + + /** + * @return the geoReplicationStats value. + */ + GeoReplicationStats geoReplicationStats(); + /** * @return the identity value. */ @@ -149,7 +159,9 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup, Resource.UpdateWithTags, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastModifiedTime value. + */ + DateTime lastModifiedTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the policy value. + */ + Object policy(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the StorageAccountManagementPolicies definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithStorageAccount, DefinitionStages.WithPolicy, DefinitionStages.WithCreate { + } + + /** + * Grouping of StorageAccountManagementPolicies definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a StorageAccountManagementPolicies definition. + */ + interface Blank extends WithStorageAccount { + } + + /** + * The stage of the storageaccountmanagementpolicies definition allowing to specify StorageAccount. + */ + interface WithStorageAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only + * @return the next definition stage + */ + WithPolicy withExistingStorageAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the storageaccountmanagementpolicies definition allowing to specify Policy. + */ + interface WithPolicy { + /** + * Specifies policy. + * @param policy The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts + * @return the next definition stage + */ + WithCreate withPolicy(Object policy); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a StorageAccountManagementPolicies update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPolicy { + } + + /** + * Grouping of StorageAccountManagementPolicies update stages. + */ + interface UpdateStages { + /** + * The stage of the storageaccountmanagementpolicies update allowing to specify Policy. + */ + interface WithPolicy { + /** + * Specifies policy. + * @param policy The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts + * @return the next update stage + */ + Update withPolicy(Object policy); + } + + } +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountRegenerateKeyParameters.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountRegenerateKeyParameters.java index a81e8d8647dc1..36ac7d94db624 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountRegenerateKeyParameters.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountRegenerateKeyParameters.java @@ -15,14 +15,14 @@ */ public class StorageAccountRegenerateKeyParameters { /** - * The name of storage keys that want to be regenerated, possible vaules + * The name of storage keys that want to be regenerated, possible values * are key1, key2. */ @JsonProperty(value = "keyName", required = true) private String keyName; /** - * Get the name of storage keys that want to be regenerated, possible vaules are key1, key2. + * Get the name of storage keys that want to be regenerated, possible values are key1, key2. * * @return the keyName value */ @@ -31,7 +31,7 @@ public String keyName() { } /** - * Set the name of storage keys that want to be regenerated, possible vaules are key1, key2. + * Set the name of storage keys that want to be regenerated, possible values are key1, key2. * * @param keyName the keyName value to set * @return the StorageAccountRegenerateKeyParameters object itself. diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountUpdateParameters.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountUpdateParameters.java index 2970b73066914..90ab301647292 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountUpdateParameters.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccountUpdateParameters.java @@ -21,7 +21,7 @@ public class StorageAccountUpdateParameters { /** * Gets or sets the SKU name. Note that the SKU name cannot be updated to - * Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those sku + * Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU * names be updated to any other value. */ @JsonProperty(value = "sku") @@ -93,7 +93,7 @@ public class StorageAccountUpdateParameters { private Kind kind; /** - * Get gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those sku names be updated to any other value. + * Get gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. * * @return the sku value */ @@ -102,7 +102,7 @@ public SkuInner sku() { } /** - * Set gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those sku names be updated to any other value. + * Set gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor can accounts of those SKU names be updated to any other value. * * @param sku the sku value to set * @return the StorageAccountUpdateParameters object itself. diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccounts.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccounts.java index 2556de0e4625c..c7283d8c7c277 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccounts.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/StorageAccounts.java @@ -15,6 +15,7 @@ import rx.Observable; import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; import com.microsoft.azure.management.storage.v2018_07_01.implementation.StorageAccountsInner; import com.microsoft.azure.arm.model.HasInner; @@ -37,7 +38,7 @@ public interface StorageAccounts extends SupportsCreating listServiceSASAsync(String resourceGroupName, String accountName, ServiceSasParameters parameters); + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverAsync(String resourceGroupName, String accountName); + /** * Checks that the storage account name is valid and is not already in use. * diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainerImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainerImpl.java index 0d07f22990817..7d0eac4eb1a65 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainerImpl.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainerImpl.java @@ -11,20 +11,24 @@ import com.microsoft.azure.management.storage.v2018_07_01.BlobContainer; import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; import rx.Observable; +import com.microsoft.azure.management.storage.v2018_07_01.PublicAccess; +import java.util.Map; import com.microsoft.azure.management.storage.v2018_07_01.ImmutabilityPolicyProperties; import org.joda.time.DateTime; import com.microsoft.azure.management.storage.v2018_07_01.LeaseDuration; import com.microsoft.azure.management.storage.v2018_07_01.LeaseState; import com.microsoft.azure.management.storage.v2018_07_01.LeaseStatus; import com.microsoft.azure.management.storage.v2018_07_01.LegalHoldProperties; -import java.util.Map; -import com.microsoft.azure.management.storage.v2018_07_01.PublicAccess; class BlobContainerImpl extends CreatableUpdatableImpl implements BlobContainer, BlobContainer.Definition, BlobContainer.Update { private final StorageManager manager; private String resourceGroupName; private String accountName; private String containerName; + private PublicAccess cpublicAccess; + private Map cmetadata; + private PublicAccess upublicAccess; + private Map umetadata; BlobContainerImpl(String name, StorageManager manager) { super(name, new BlobContainerInner()); @@ -39,7 +43,7 @@ class BlobContainerImpl extends CreatableUpdatableImpl createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); - return client.createAsync(this.resourceGroupName, this.accountName, this.containerName) + return client.createAsync(this.resourceGroupName, this.accountName, this.containerName, this.cpublicAccess, this.cmetadata) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); - return client.updateAsync(this.resourceGroupName, this.accountName, this.containerName) + return client.updateAsync(this.resourceGroupName, this.accountName, this.containerName, this.upublicAccess, this.umetadata) .map(innerToFluentMap(this)); } @@ -154,4 +158,24 @@ public BlobContainerImpl withExistingBlobService(String resourceGroupName, Strin return this; } + @Override + public BlobContainerImpl withPublicAccess(PublicAccess publicAccess) { + if (isInCreateMode()) { + this.cpublicAccess = publicAccess; + } else { + this.upublicAccess = publicAccess; + } + return this; + } + + @Override + public BlobContainerImpl withMetadata(Map metadata) { + if (isInCreateMode()) { + this.cmetadata = metadata; + } else { + this.umetadata = metadata; + } + return this; + } + } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersImpl.java index f95e86181d0f4..58404baa542f3 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersImpl.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersImpl.java @@ -17,6 +17,7 @@ import com.microsoft.azure.management.storage.v2018_07_01.ListContainerItems; import com.microsoft.azure.management.storage.v2018_07_01.BlobContainer; import com.microsoft.azure.management.storage.v2018_07_01.LegalHold; +import com.microsoft.azure.management.storage.v2018_07_01.LeaseContainerResponse; import java.util.List; import com.microsoft.azure.management.storage.v2018_07_01.ImmutabilityPolicy; @@ -120,14 +121,30 @@ public LegalHold call(LegalHoldInner inner) { }); } + @Override + public Observable leaseAsync(String resourceGroupName, String accountName, String containerName) { + BlobContainersInner client = this.inner(); + return client.leaseAsync(resourceGroupName, accountName, containerName) + .map(new Func1() { + @Override + public LeaseContainerResponse call(LeaseContainerResponseInner inner) { + return new LeaseContainerResponseImpl(inner, manager()); + } + }); + } + @Override public Observable getImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName) { BlobContainersInner client = this.inner(); return client.getImmutabilityPolicyAsync(resourceGroupName, accountName, containerName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ImmutabilityPolicy call(ImmutabilityPolicyInner inner) { - return wrapImmutabilityPolicyModel(inner); + public Observable call(ImmutabilityPolicyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ImmutabilityPolicy)wrapImmutabilityPolicyModel(inner)); + } } }); } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersInner.java index 0e5d79d11e6ca..f2f41a302356f 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.management.storage.v2018_07_01.BlobContainersExtendImmutabilityPolicyHeaders; import com.microsoft.azure.management.storage.v2018_07_01.BlobContainersGetImmutabilityPolicyHeaders; import com.microsoft.azure.management.storage.v2018_07_01.BlobContainersLockImmutabilityPolicyHeaders; +import com.microsoft.azure.management.storage.v2018_07_01.LeaseContainerRequest; import com.microsoft.azure.management.storage.v2018_07_01.PublicAccess; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; @@ -114,6 +115,10 @@ interface BlobContainersService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend") Observable> extendImmutabilityPolicy(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body ImmutabilityPolicyInner parameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2018_07_01.BlobContainers lease" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease") + Observable> lease(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body LeaseContainerRequest parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -178,10 +183,8 @@ public Observable> listWithServiceRespo if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.list(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.list(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -271,15 +274,13 @@ public Observable> createWithServiceResponse if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } + final String apiVersion = "2018-07-01"; final PublicAccess publicAccess = null; final Map metadata = null; BlobContainerInner blobContainer = new BlobContainerInner(); blobContainer.withPublicAccess(null); blobContainer.withMetadata(null); - return service.create(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), blobContainer, this.client.userAgent()) + return service.create(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), blobContainer, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -370,14 +371,12 @@ public Observable> createWithServiceResponse if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(metadata); + final String apiVersion = "2018-07-01"; BlobContainerInner blobContainer = new BlobContainerInner(); blobContainer.withPublicAccess(publicAccess); blobContainer.withMetadata(metadata); - return service.create(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), blobContainer, this.client.userAgent()) + return service.create(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), blobContainer, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -467,15 +466,13 @@ public Observable> updateWithServiceResponse if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } + final String apiVersion = "2018-07-01"; final PublicAccess publicAccess = null; final Map metadata = null; BlobContainerInner blobContainer = new BlobContainerInner(); blobContainer.withPublicAccess(null); blobContainer.withMetadata(null); - return service.update(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), blobContainer, this.client.userAgent()) + return service.update(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), blobContainer, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -566,14 +563,12 @@ public Observable> updateWithServiceResponse if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(metadata); + final String apiVersion = "2018-07-01"; BlobContainerInner blobContainer = new BlobContainerInner(); blobContainer.withPublicAccess(publicAccess); blobContainer.withMetadata(metadata); - return service.update(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), blobContainer, this.client.userAgent()) + return service.update(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), blobContainer, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -663,10 +658,8 @@ public Observable> getWithServiceResponseAsy if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.get(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.get(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -755,10 +748,8 @@ public Observable> deleteWithServiceResponseAsync(String r if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.delete(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.delete(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -853,16 +844,14 @@ public Observable> setLegalHoldWithServiceRespon if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (tags == null) { throw new IllegalArgumentException("Parameter tags is required and cannot be null."); } Validator.validate(tags); + final String apiVersion = "2018-07-01"; LegalHoldInner legalHold = new LegalHoldInner(); legalHold.withTags(tags); - return service.setLegalHold(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), legalHold, this.client.userAgent()) + return service.setLegalHold(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), legalHold, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -956,16 +945,14 @@ public Observable> clearLegalHoldWithServiceResp if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (tags == null) { throw new IllegalArgumentException("Parameter tags is required and cannot be null."); } Validator.validate(tags); + final String apiVersion = "2018-07-01"; LegalHoldInner legalHold = new LegalHoldInner(); legalHold.withTags(tags); - return service.clearLegalHold(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), legalHold, this.client.userAgent()) + return service.clearLegalHold(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), legalHold, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1059,14 +1046,12 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1157,13 +1142,11 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1253,12 +1236,10 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1345,11 +1326,9 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1443,14 +1422,12 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1544,13 +1521,11 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1648,15 +1623,13 @@ public Observable, Observable>>() { @Override public Observable> call(Response response) { @@ -1677,4 +1650,185 @@ private ServiceResponseWithHeaders leaseAsync(String resourceGroupName, String accountName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(leaseWithServiceResponseAsync(resourceGroupName, accountName, containerName), serviceCallback); + } + + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LeaseContainerResponseInner object + */ + public Observable leaseAsync(String resourceGroupName, String accountName, String containerName) { + return leaseWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1, LeaseContainerResponseInner>() { + @Override + public LeaseContainerResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LeaseContainerResponseInner object + */ + public Observable> leaseWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-07-01"; + final LeaseContainerRequest parameters = null; + return service.lease(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = leaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @param parameters Lease Container request body. + * @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 LeaseContainerResponseInner object if successful. + */ + public LeaseContainerResponseInner lease(String resourceGroupName, String accountName, String containerName, LeaseContainerRequest parameters) { + return leaseWithServiceResponseAsync(resourceGroupName, accountName, containerName, parameters).toBlocking().single().body(); + } + + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @param parameters Lease Container request body. + * @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 leaseAsync(String resourceGroupName, String accountName, String containerName, LeaseContainerRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(leaseWithServiceResponseAsync(resourceGroupName, accountName, containerName, parameters), serviceCallback); + } + + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @param parameters Lease Container request body. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LeaseContainerResponseInner object + */ + public Observable leaseAsync(String resourceGroupName, String accountName, String containerName, LeaseContainerRequest parameters) { + return leaseWithServiceResponseAsync(resourceGroupName, accountName, containerName, parameters).map(new Func1, LeaseContainerResponseInner>() { + @Override + public LeaseContainerResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. + * @param parameters Lease Container request body. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LeaseContainerResponseInner object + */ + public Observable> leaseWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, LeaseContainerRequest parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-07-01"; + return service.lease(resourceGroupName, accountName, containerName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = leaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse leaseDelegate(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); + } + } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicePropertiesImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicePropertiesImpl.java new file mode 100644 index 0000000000000..fa527e8409355 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicePropertiesImpl.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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.management.storage.v2018_07_01.BlobServiceProperties; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.storage.v2018_07_01.CorsRules; +import com.microsoft.azure.management.storage.v2018_07_01.DeleteRetentionPolicy; + +class BlobServicePropertiesImpl extends CreatableUpdatableImpl implements BlobServiceProperties, BlobServiceProperties.Definition, BlobServiceProperties.Update { + private final StorageManager manager; + private String resourceGroupName; + private String accountName; + + BlobServicePropertiesImpl(String name, StorageManager manager) { + super(name, new BlobServicePropertiesInner()); + this.manager = manager; + // Set resource name + this.accountName = name; + // + } + + BlobServicePropertiesImpl(BlobServicePropertiesInner inner, StorageManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.accountName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "storageAccounts"); + // + } + + @Override + public StorageManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BlobServicesInner client = this.manager().inner().blobServices(); + return client.setServicePropertiesAsync(this.resourceGroupName, this.accountName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BlobServicesInner client = this.manager().inner().blobServices(); + return client.setServicePropertiesAsync(this.resourceGroupName, this.accountName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BlobServicesInner client = this.manager().inner().blobServices(); + return client.getServicePropertiesAsync(this.resourceGroupName, this.accountName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public CorsRules cors() { + return this.inner().cors(); + } + + @Override + public String defaultServiceVersion() { + return this.inner().defaultServiceVersion(); + } + + @Override + public DeleteRetentionPolicy deleteRetentionPolicy() { + return this.inner().deleteRetentionPolicy(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BlobServicePropertiesImpl withExistingStorageAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public BlobServicePropertiesImpl withCors(CorsRules cors) { + this.inner().withCors(cors); + return this; + } + + @Override + public BlobServicePropertiesImpl withDefaultServiceVersion(String defaultServiceVersion) { + this.inner().withDefaultServiceVersion(defaultServiceVersion); + return this; + } + + @Override + public BlobServicePropertiesImpl withDeleteRetentionPolicy(DeleteRetentionPolicy deleteRetentionPolicy) { + this.inner().withDeleteRetentionPolicy(deleteRetentionPolicy); + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicePropertiesInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicePropertiesInner.java new file mode 100644 index 0000000000000..c4b4e1468ea2e --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicePropertiesInner.java @@ -0,0 +1,105 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.management.storage.v2018_07_01.CorsRules; +import com.microsoft.azure.management.storage.v2018_07_01.DeleteRetentionPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The properties of a storage account’s Blob service. + */ +@JsonFlatten +public class BlobServicePropertiesInner extends ProxyResource { + /** + * Specifies CORS rules for the Blob service. You can include up to five + * CorsRule elements in the request. If no CorsRule elements are included + * in the request body, all CORS rules will be deleted, and CORS will be + * disabled for the Blob service. + */ + @JsonProperty(value = "properties.cors") + private CorsRules cors; + + /** + * DefaultServiceVersion indicates the default version to use for requests + * to the Blob service if an incoming request’s version is not specified. + * Possible values include version 2008-10-27 and all more recent versions. + */ + @JsonProperty(value = "properties.defaultServiceVersion") + private String defaultServiceVersion; + + /** + * The blob service properties for soft delete. + */ + @JsonProperty(value = "properties.deleteRetentionPolicy") + private DeleteRetentionPolicy deleteRetentionPolicy; + + /** + * Get specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. + * + * @return the cors value + */ + public CorsRules cors() { + return this.cors; + } + + /** + * Set specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service. + * + * @param cors the cors value to set + * @return the BlobServicePropertiesInner object itself. + */ + public BlobServicePropertiesInner withCors(CorsRules cors) { + this.cors = cors; + return this; + } + + /** + * Get defaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. + * + * @return the defaultServiceVersion value + */ + public String defaultServiceVersion() { + return this.defaultServiceVersion; + } + + /** + * Set defaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions. + * + * @param defaultServiceVersion the defaultServiceVersion value to set + * @return the BlobServicePropertiesInner object itself. + */ + public BlobServicePropertiesInner withDefaultServiceVersion(String defaultServiceVersion) { + this.defaultServiceVersion = defaultServiceVersion; + return this; + } + + /** + * Get the blob service properties for soft delete. + * + * @return the deleteRetentionPolicy value + */ + public DeleteRetentionPolicy deleteRetentionPolicy() { + return this.deleteRetentionPolicy; + } + + /** + * Set the blob service properties for soft delete. + * + * @param deleteRetentionPolicy the deleteRetentionPolicy value to set + * @return the BlobServicePropertiesInner object itself. + */ + public BlobServicePropertiesInner withDeleteRetentionPolicy(DeleteRetentionPolicy deleteRetentionPolicy) { + this.deleteRetentionPolicy = deleteRetentionPolicy; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicesImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicesImpl.java new file mode 100644 index 0000000000000..5c09d7324c680 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicesImpl.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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storage.v2018_07_01.BlobServices; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.storage.v2018_07_01.BlobServiceProperties; + +class BlobServicesImpl extends WrapperImpl implements BlobServices { + private final StorageManager manager; + + BlobServicesImpl(StorageManager manager) { + super(manager.inner().blobServices()); + this.manager = manager; + } + + public StorageManager manager() { + return this.manager; + } + + @Override + public BlobServicePropertiesImpl define(String name) { + return wrapModel(name); + } + + private BlobServicePropertiesImpl wrapModel(BlobServicePropertiesInner inner) { + return new BlobServicePropertiesImpl(inner, manager()); + } + + private BlobServicePropertiesImpl wrapModel(String name) { + return new BlobServicePropertiesImpl(name, this.manager()); + } + + @Override + public Observable getServicePropertiesAsync(String resourceGroupName, String accountName) { + BlobServicesInner client = this.inner(); + return client.getServicePropertiesAsync(resourceGroupName, accountName) + .flatMap(new Func1>() { + @Override + public Observable call(BlobServicePropertiesInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BlobServiceProperties)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicesInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicesInner.java new file mode 100644 index 0000000000000..1c5c5ba9c881c --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobServicesInner.java @@ -0,0 +1,245 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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 okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BlobServices. + */ +public class BlobServicesInner { + /** The Retrofit service to perform REST calls. */ + private BlobServicesService service; + /** The service client containing this operation class. */ + private StorageManagementClientImpl client; + + /** + * Initializes an instance of BlobServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BlobServicesInner(Retrofit retrofit, StorageManagementClientImpl client) { + this.service = retrofit.create(BlobServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BlobServices to be + * used by Retrofit to perform actually REST calls. + */ + interface BlobServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2018_07_01.BlobServices setServiceProperties" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}") + Observable> setServiceProperties(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("BlobServicesName") String blobServicesName, @Query("api-version") String apiVersion, @Body BlobServicePropertiesInner parameters, @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.storage.v2018_07_01.BlobServices getServiceProperties" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}") + Observable> getServiceProperties(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("BlobServicesName") String blobServicesName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * @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 BlobServicePropertiesInner object if successful. + */ + public BlobServicePropertiesInner setServiceProperties(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { + return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); + } + + /** + * Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * @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 setServicePropertiesAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters), serviceCallback); + } + + /** + * Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobServicePropertiesInner object + */ + public Observable setServicePropertiesAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { + return setServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1, BlobServicePropertiesInner>() { + @Override + public BlobServicePropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param parameters The properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobServicePropertiesInner object + */ + public Observable> setServicePropertiesWithServiceResponseAsync(String resourceGroupName, String accountName, BlobServicePropertiesInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String blobServicesName = "default"; + final String apiVersion = "2018-07-01"; + return service.setServiceProperties(resourceGroupName, accountName, this.client.subscriptionId(), blobServicesName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = setServicePropertiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse setServicePropertiesDelegate(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); + } + + /** + * Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 BlobServicePropertiesInner object if successful. + */ + public BlobServicePropertiesInner getServiceProperties(String resourceGroupName, String accountName) { + return getServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 getServicePropertiesAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobServicePropertiesInner object + */ + public Observable getServicePropertiesAsync(String resourceGroupName, String accountName) { + return getServicePropertiesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, BlobServicePropertiesInner>() { + @Override + public BlobServicePropertiesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobServicePropertiesInner object + */ + public Observable> getServicePropertiesWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String blobServicesName = "default"; + final String apiVersion = "2018-07-01"; + return service.getServiceProperties(resourceGroupName, accountName, this.client.subscriptionId(), blobServicesName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getServicePropertiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getServicePropertiesDelegate(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); + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ImmutabilityPolicyImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ImmutabilityPolicyImpl.java index 6940a6bd79fad..156cb9d3fc4e2 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ImmutabilityPolicyImpl.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ImmutabilityPolicyImpl.java @@ -18,7 +18,9 @@ class ImmutabilityPolicyImpl extends CreatableUpdatableImpl createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); - return client.createOrUpdateImmutabilityPolicyAsync(this.resourceGroupName, this.accountName, this.containerName, this.cimmutabilityPeriodSinceCreationInDays) + return client.createOrUpdateImmutabilityPolicyAsync(this.resourceGroupName, this.accountName, this.containerName, this.cimmutabilityPeriodSinceCreationInDays, this.cifMatch) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); - return client.createOrUpdateImmutabilityPolicyAsync(this.resourceGroupName, this.accountName, this.containerName, this.uimmutabilityPeriodSinceCreationInDays) + return client.createOrUpdateImmutabilityPolicyAsync(this.resourceGroupName, this.accountName, this.containerName, this.uimmutabilityPeriodSinceCreationInDays, this.uifMatch) .map(innerToFluentMap(this)); } @@ -110,6 +112,16 @@ public ImmutabilityPolicyImpl withExistingContainer(String resourceGroupName, St return this; } + @Override + public ImmutabilityPolicyImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + @Override public ImmutabilityPolicyImpl withImmutabilityPeriodSinceCreationInDays(int immutabilityPeriodSinceCreationInDays) { if (isInCreateMode()) { diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/LeaseContainerResponseImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/LeaseContainerResponseImpl.java new file mode 100644 index 0000000000000..3b7f81c37079d --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/LeaseContainerResponseImpl.java @@ -0,0 +1,36 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.management.storage.v2018_07_01.LeaseContainerResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class LeaseContainerResponseImpl extends WrapperImpl implements LeaseContainerResponse { + private final StorageManager manager; + LeaseContainerResponseImpl(LeaseContainerResponseInner inner, StorageManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public StorageManager manager() { + return this.manager; + } + + @Override + public String leaseId() { + return this.inner().leaseId(); + } + + @Override + public String leaseTimeSeconds() { + return this.inner().leaseTimeSeconds(); + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/LeaseContainerResponseInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/LeaseContainerResponseInner.java new file mode 100644 index 0000000000000..963ca029e2b98 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/LeaseContainerResponseInner.java @@ -0,0 +1,70 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Lease Container response schema. + */ +public class LeaseContainerResponseInner { + /** + * Returned unique lease ID that must be included with any request to + * delete the container, or to renew, change, or release the lease. + */ + @JsonProperty(value = "leaseId") + private String leaseId; + + /** + * Approximate time remaining in the lease period, in seconds. + */ + @JsonProperty(value = "leaseTimeSeconds") + private String leaseTimeSeconds; + + /** + * Get returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. + * + * @return the leaseId value + */ + public String leaseId() { + return this.leaseId; + } + + /** + * Set returned unique lease ID that must be included with any request to delete the container, or to renew, change, or release the lease. + * + * @param leaseId the leaseId value to set + * @return the LeaseContainerResponseInner object itself. + */ + public LeaseContainerResponseInner withLeaseId(String leaseId) { + this.leaseId = leaseId; + return this; + } + + /** + * Get approximate time remaining in the lease period, in seconds. + * + * @return the leaseTimeSeconds value + */ + public String leaseTimeSeconds() { + return this.leaseTimeSeconds; + } + + /** + * Set approximate time remaining in the lease period, in seconds. + * + * @param leaseTimeSeconds the leaseTimeSeconds value to set + * @return the LeaseContainerResponseInner object itself. + */ + public LeaseContainerResponseInner withLeaseTimeSeconds(String leaseTimeSeconds) { + this.leaseTimeSeconds = leaseTimeSeconds; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ListServiceSasResponseInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ListServiceSasResponseInner.java index 81bad787aefe2..b72a192988254 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ListServiceSasResponseInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ListServiceSasResponseInner.java @@ -15,13 +15,13 @@ */ public class ListServiceSasResponseInner { /** - * List service SAS credentials of speicific resource. + * List service SAS credentials of specific resource. */ @JsonProperty(value = "serviceSasToken", access = JsonProperty.Access.WRITE_ONLY) private String serviceSasToken; /** - * Get list service SAS credentials of speicific resource. + * Get list service SAS credentials of specific resource. * * @return the serviceSasToken value */ diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ManagementPoliciesImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ManagementPoliciesImpl.java new file mode 100644 index 0000000000000..57d67a335fecd --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ManagementPoliciesImpl.java @@ -0,0 +1,66 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storage.v2018_07_01.ManagementPolicies; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountManagementPolicies; + +class ManagementPoliciesImpl extends WrapperImpl implements ManagementPolicies { + private final StorageManager manager; + + ManagementPoliciesImpl(StorageManager manager) { + super(manager.inner().managementPolicies()); + this.manager = manager; + } + + public StorageManager manager() { + return this.manager; + } + + @Override + public StorageAccountManagementPoliciesImpl define(String name) { + return wrapModel(name); + } + + private StorageAccountManagementPoliciesImpl wrapModel(StorageAccountManagementPoliciesInner inner) { + return new StorageAccountManagementPoliciesImpl(inner, manager()); + } + + private StorageAccountManagementPoliciesImpl wrapModel(String name) { + return new StorageAccountManagementPoliciesImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName) { + ManagementPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName) + .flatMap(new Func1>() { + @Override + public Observable call(StorageAccountManagementPoliciesInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((StorageAccountManagementPolicies)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName) { + ManagementPoliciesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName).toCompletable(); + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ManagementPoliciesInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ManagementPoliciesInner.java new file mode 100644 index 0000000000000..6ee0b003e413c --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/ManagementPoliciesInner.java @@ -0,0 +1,415 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.storage.v2018_07_01.ManagementPoliciesRulesSetParameter; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagementPolicies. + */ +public class ManagementPoliciesInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ManagementPoliciesService service; + /** The service client containing this operation class. */ + private StorageManagementClientImpl client; + + /** + * Initializes an instance of ManagementPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagementPoliciesInner(Retrofit retrofit, StorageManagementClientImpl client) { + this.service = retrofit.create(ManagementPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagementPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagementPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2018_07_01.ManagementPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("managementPolicyName") String managementPolicyName, @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.storage.v2018_07_01.ManagementPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("managementPolicyName") String managementPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ManagementPoliciesRulesSetParameter properties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2018_07_01.ManagementPolicies delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("managementPolicyName") String managementPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 StorageAccountManagementPoliciesInner object if successful. + */ + public StorageAccountManagementPoliciesInner get(String resourceGroupName, String accountName) { + return getWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Gets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Gets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountManagementPoliciesInner object + */ + public Observable getAsync(String resourceGroupName, String accountName) { + return getWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, StorageAccountManagementPoliciesInner>() { + @Override + public StorageAccountManagementPoliciesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountManagementPoliciesInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String managementPolicyName = "default"; + final String apiVersion = "2018-03-01-preview"; + return service.get(resourceGroupName, accountName, this.client.subscriptionId(), managementPolicyName, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 StorageAccountManagementPoliciesInner object if successful. + */ + public StorageAccountManagementPoliciesInner createOrUpdate(String resourceGroupName, String accountName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountManagementPoliciesInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, StorageAccountManagementPoliciesInner>() { + @Override + public StorageAccountManagementPoliciesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountManagementPoliciesInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String managementPolicyName = "default"; + final String apiVersion = "2018-03-01-preview"; + final Object policy = null; + ManagementPoliciesRulesSetParameter properties = new ManagementPoliciesRulesSetParameter(); + properties.withPolicy(null); + return service.createOrUpdate(resourceGroupName, accountName, this.client.subscriptionId(), managementPolicyName, apiVersion, this.client.acceptLanguage(), properties, 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); + } + } + }); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param policy The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * @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 StorageAccountManagementPoliciesInner object if successful. + */ + public StorageAccountManagementPoliciesInner createOrUpdate(String resourceGroupName, String accountName, Object policy) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, policy).toBlocking().single().body(); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param policy The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * @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 resourceGroupName, String accountName, Object policy, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, policy), serviceCallback); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param policy The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountManagementPoliciesInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, Object policy) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, policy).map(new Func1, StorageAccountManagementPoliciesInner>() { + @Override + public StorageAccountManagementPoliciesInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param policy The Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountManagementPoliciesInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, Object policy) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String managementPolicyName = "default"; + final String apiVersion = "2018-03-01-preview"; + ManagementPoliciesRulesSetParameter properties = new ManagementPoliciesRulesSetParameter(); + properties.withPolicy(policy); + return service.createOrUpdate(resourceGroupName, accountName, this.client.subscriptionId(), managementPolicyName, apiVersion, this.client.acceptLanguage(), properties, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 resourceGroupName, String accountName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Deletes the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Deletes the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String accountName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the data policy rules associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String managementPolicyName = "default"; + final String apiVersion = "2018-03-01-preview"; + return service.delete(resourceGroupName, accountName, this.client.subscriptionId(), managementPolicyName, 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); + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/OperationsInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/OperationsInner.java index 6af8c590b97fb..4a0ecd1dc33e2 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/OperationsInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/OperationsInner.java @@ -102,10 +102,8 @@ public List call(ServiceResponse> response) * @return the observable to the List<OperationInner> object */ public Observable>> listWithServiceResponseAsync() { - 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()) + final String apiVersion = "2018-07-01"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -124,7 +122,7 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkuInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkuInner.java index 6473ac9f21ead..b834c87dfe411 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkuInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkuInner.java @@ -21,8 +21,8 @@ */ public class SkuInner { /** - * Gets or sets the sku name. Required for account creation; optional for - * update. Note that in older versions, sku name was called accountType. + * Gets or sets the SKU name. Required for account creation; optional for + * update. Note that in older versions, SKU name was called accountType. * Possible values include: 'Standard_LRS', 'Standard_GRS', * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS', 'Premium_ZRS'. */ @@ -30,7 +30,7 @@ public class SkuInner { private SkuName name; /** - * Gets the sku tier. This is based on the SKU name. Possible values + * Gets the SKU tier. This is based on the SKU name. Possible values * include: 'Standard', 'Premium'. */ @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) @@ -59,8 +59,8 @@ public class SkuInner { private List locations; /** - * The capability information in the specified sku, including file - * encryption, network acls, change notification, etc. + * The capability information in the specified SKU, including file + * encryption, network ACLs, change notification, etc. */ @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) private List capabilities; @@ -73,7 +73,7 @@ public class SkuInner { private List restrictions; /** - * Get gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS', 'Premium_ZRS'. + * Get gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS', 'Premium_ZRS'. * * @return the name value */ @@ -82,7 +82,7 @@ public SkuName name() { } /** - * Set gets or sets the sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS', 'Premium_ZRS'. + * Set gets or sets the SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. Possible values include: 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS', 'Premium_ZRS'. * * @param name the name value to set * @return the SkuInner object itself. @@ -93,7 +93,7 @@ public SkuInner withName(SkuName name) { } /** - * Get gets the sku tier. This is based on the SKU name. Possible values include: 'Standard', 'Premium'. + * Get gets the SKU tier. This is based on the SKU name. Possible values include: 'Standard', 'Premium'. * * @return the tier value */ @@ -129,7 +129,7 @@ public List locations() { } /** - * Get the capability information in the specified sku, including file encryption, network acls, change notification, etc. + * Get the capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. * * @return the capabilities value */ diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkusInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkusInner.java index 5b5faa8cb2e55..210c3a1ee176d 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkusInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/SkusInner.java @@ -112,10 +112,8 @@ public Observable>> listWithServiceResponseAsync( if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountImpl.java index 7d38ffba6fc2b..cb28d289fd307 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountImpl.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountImpl.java @@ -17,6 +17,7 @@ import org.joda.time.DateTime; import com.microsoft.azure.management.storage.v2018_07_01.CustomDomain; import com.microsoft.azure.management.storage.v2018_07_01.Encryption; +import com.microsoft.azure.management.storage.v2018_07_01.GeoReplicationStats; import com.microsoft.azure.management.storage.v2018_07_01.Identity; import com.microsoft.azure.management.storage.v2018_07_01.Kind; import com.microsoft.azure.management.storage.v2018_07_01.NetworkRuleSet; @@ -111,6 +112,16 @@ public Encryption encryption() { return this.inner().encryption(); } + @Override + public Boolean failoverInProgress() { + return this.inner().failoverInProgress(); + } + + @Override + public GeoReplicationStats geoReplicationStats() { + return this.inner().geoReplicationStats(); + } + @Override public Identity identity() { return this.inner().identity(); diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountInner.java index a1a80e5cdca42..c4f28d2274795 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountInner.java @@ -18,6 +18,7 @@ import com.microsoft.azure.management.storage.v2018_07_01.Encryption; import com.microsoft.azure.management.storage.v2018_07_01.AccessTier; import com.microsoft.azure.management.storage.v2018_07_01.NetworkRuleSet; +import com.microsoft.azure.management.storage.v2018_07_01.GeoReplicationStats; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -160,6 +161,19 @@ public class StorageAccountInner extends Resource { @JsonProperty(value = "properties.isHnsEnabled") private Boolean isHnsEnabled; + /** + * Geo Replication Stats. + */ + @JsonProperty(value = "properties.geoReplicationStats", access = JsonProperty.Access.WRITE_ONLY) + private GeoReplicationStats geoReplicationStats; + + /** + * If the failover is in progress, the value will be true, otherwise, it + * will be null. + */ + @JsonProperty(value = "properties.failoverInProgress", access = JsonProperty.Access.WRITE_ONLY) + private Boolean failoverInProgress; + /** * Get gets the SKU. * @@ -375,4 +389,22 @@ public StorageAccountInner withIsHnsEnabled(Boolean isHnsEnabled) { return this; } + /** + * Get geo Replication Stats. + * + * @return the geoReplicationStats value + */ + public GeoReplicationStats geoReplicationStats() { + return this.geoReplicationStats; + } + + /** + * Get if the failover is in progress, the value will be true, otherwise, it will be null. + * + * @return the failoverInProgress value + */ + public Boolean failoverInProgress() { + return this.failoverInProgress; + } + } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountManagementPoliciesImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountManagementPoliciesImpl.java new file mode 100644 index 0000000000000..3b5521cc4fa6c --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountManagementPoliciesImpl.java @@ -0,0 +1,115 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountManagementPolicies; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class StorageAccountManagementPoliciesImpl extends CreatableUpdatableImpl implements StorageAccountManagementPolicies, StorageAccountManagementPolicies.Definition, StorageAccountManagementPolicies.Update { + private final StorageManager manager; + private String resourceGroupName; + private String accountName; + private Object cpolicy; + private Object upolicy; + + StorageAccountManagementPoliciesImpl(String name, StorageManager manager) { + super(name, new StorageAccountManagementPoliciesInner()); + this.manager = manager; + // Set resource name + this.accountName = name; + // + } + + StorageAccountManagementPoliciesImpl(StorageAccountManagementPoliciesInner inner, StorageManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.accountName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "storageAccounts"); + // + } + + @Override + public StorageManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ManagementPoliciesInner client = this.manager().inner().managementPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.cpolicy) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagementPoliciesInner client = this.manager().inner().managementPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.upolicy) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagementPoliciesInner client = this.manager().inner().managementPolicies(); + return client.getAsync(this.resourceGroupName, this.accountName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object policy() { + return this.inner().policy(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public StorageAccountManagementPoliciesImpl withExistingStorageAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public StorageAccountManagementPoliciesImpl withPolicy(Object policy) { + if (isInCreateMode()) { + this.cpolicy = policy; + } else { + this.upolicy = policy; + } + return this; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountManagementPoliciesInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountManagementPoliciesInner.java new file mode 100644 index 0000000000000..f7c9938de5621 --- /dev/null +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountManagementPoliciesInner.java @@ -0,0 +1,64 @@ +/** + * 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.storage.v2018_07_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The Get Storage Account ManagementPolicies operation response. + */ +@JsonFlatten +public class StorageAccountManagementPoliciesInner extends ProxyResource { + /** + * The Storage Account ManagementPolicies Rules, in JSON format. See more + * details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ + @JsonProperty(value = "properties.policy") + private Object policy; + + /** + * Returns the date and time the ManagementPolicies was last modified. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModifiedTime; + + /** + * Get the Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @return the policy value + */ + public Object policy() { + return this.policy; + } + + /** + * Set the Storage Account ManagementPolicies Rules, in JSON format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @param policy the policy value to set + * @return the StorageAccountManagementPoliciesInner object itself. + */ + public StorageAccountManagementPoliciesInner withPolicy(Object policy) { + this.policy = policy; + return this; + } + + /** + * Get returns the date and time the ManagementPolicies was last modified. + * + * @return the lastModifiedTime value + */ + public DateTime lastModifiedTime() { + return this.lastModifiedTime; + } + +} diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsImpl.java index df33dc4aa49ac..e9b4942c0a70b 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsImpl.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsImpl.java @@ -179,6 +179,12 @@ public ListServiceSasResponse call(ListServiceSasResponseInner inner) { }); } + @Override + public Completable failoverAsync(String resourceGroupName, String accountName) { + StorageAccountsInner client = this.inner(); + return client.failoverAsync(resourceGroupName, accountName).toCompletable(); + } + @Override public Observable checkNameAvailabilityAsync(String name) { StorageAccountsInner client = this.inner(); diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsInner.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsInner.java index 20a62667e3bc7..ba0dceed7aa1f 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsInner.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageAccountsInner.java @@ -18,6 +18,7 @@ import com.microsoft.azure.management.storage.v2018_07_01.ServiceSasParameters; import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountCheckNameAvailabilityParameters; import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountCreateParameters; +import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountExpand; import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountRegenerateKeyParameters; import com.microsoft.azure.management.storage.v2018_07_01.StorageAccountUpdateParameters; import com.microsoft.azure.Page; @@ -42,6 +43,8 @@ import retrofit2.Response; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -87,7 +90,7 @@ interface StorageAccountsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2018_07_01.StorageAccounts getByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}") - Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$expand") StorageAccountExpand expand, @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.storage.v2018_07_01.StorageAccounts update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}") @@ -117,6 +120,14 @@ interface StorageAccountsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas") Observable> listServiceSAS(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body ServiceSasParameters parameters, @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.storage.v2018_07_01.StorageAccounts failover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover") + Observable> failover(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2018_07_01.StorageAccounts beginFailover" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover") + Observable> beginFailover(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -171,15 +182,13 @@ public Observable> checkNameAv if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } + final String apiVersion = "2018-07-01"; StorageAccountCheckNameAvailabilityParameters accountName = new StorageAccountCheckNameAvailabilityParameters(); accountName.withName(name); - return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), accountName, this.client.userAgent()) + return service.checkNameAvailability(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), accountName, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -269,11 +278,9 @@ public Observable> createWithServiceRespons if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(parameters); - Observable> observable = service.create(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + final String apiVersion = "2018-07-01"; + Observable> observable = service.create(resourceGroupName, accountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -346,11 +353,9 @@ public Observable> beginCreateWithServiceRe if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(parameters); - return service.beginCreate(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.beginCreate(resourceGroupName, accountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -433,10 +438,8 @@ public Observable> deleteWithServiceResponseAsync(String r if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.delete(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.delete(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -520,10 +523,90 @@ public Observable> getByResourceGroupWithSe if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + final String apiVersion = "2018-07-01"; + final StorageAccountExpand expand = null; + return service.getByResourceGroup(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, expand, 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); + } + } + }); + } + + /** + * Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param expand May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. Possible values include: 'geoReplicationStats' + * @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 StorageAccountInner object if successful. + */ + public StorageAccountInner getByResourceGroup(String resourceGroupName, String accountName, StorageAccountExpand expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName, expand).toBlocking().single().body(); + } + + /** + * Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param expand May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. Possible values include: 'geoReplicationStats' + * @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 resourceGroupName, String accountName, StorageAccountExpand expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName, expand), serviceCallback); + } + + /** + * Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param expand May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. Possible values include: 'geoReplicationStats' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String accountName, StorageAccountExpand expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName, expand).map(new Func1, StorageAccountInner>() { + @Override + public StorageAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param expand May be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats. Possible values include: 'geoReplicationStats' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageAccountInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String accountName, StorageAccountExpand expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } - return service.getByResourceGroup(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-07-01"; + return service.getByResourceGroup(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -613,11 +696,9 @@ public Observable> updateWithServiceRespons if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(parameters); - return service.update(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.update(resourceGroupName, accountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -690,10 +771,8 @@ public Observable>> listWithServiceRes if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -778,10 +857,8 @@ public Observable>> listByResourceGrou if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -869,10 +946,8 @@ public Observable> listKeysWi if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - return service.listKeys(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.listKeys(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -898,7 +973,7 @@ private ServiceResponse listKeysDelegate(Resp * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - * @param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2. + * @param keyName The name of storage keys that want to be regenerated, possible values are key1, key2. * @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 @@ -913,7 +988,7 @@ public StorageAccountListKeysResultInner regenerateKey(String resourceGroupName, * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - * @param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2. + * @param keyName The name of storage keys that want to be regenerated, possible values are key1, key2. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -927,7 +1002,7 @@ public ServiceFuture regenerateKeyAsync(Strin * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. - * @param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2. + * @param keyName The name of storage keys that want to be regenerated, possible values are key1, key2. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the StorageAccountListKeysResultInner object */ @@ -945,7 +1020,7 @@ public StorageAccountListKeysResultInner call(ServiceResponse> regenerate if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } if (keyName == null) { throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); } + final String apiVersion = "2018-07-01"; StorageAccountRegenerateKeyParameters regenerateKey = new StorageAccountRegenerateKeyParameters(); regenerateKey.withKeyName(keyName); - return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), regenerateKey, this.client.userAgent()) + return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), regenerateKey, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1057,11 +1130,9 @@ public Observable> listAccountSASWi if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(parameters); - return service.listAccountSAS(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.listAccountSAS(resourceGroupName, accountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1151,11 +1222,9 @@ public Observable> listServiceSASWi if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } Validator.validate(parameters); - return service.listServiceSAS(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.listServiceSAS(resourceGroupName, accountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1176,4 +1245,154 @@ private ServiceResponse listServiceSASDelegate(Resp .build(response); } + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 failover(String resourceGroupName, String accountName) { + failoverWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().last().body(); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 failoverAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverAsync(String resourceGroupName, String accountName) { + return failoverWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-07-01"; + Observable> observable = service.failover(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 beginFailover(String resourceGroupName, String accountName) { + beginFailoverWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @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 beginFailoverAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverAsync(String resourceGroupName, String accountName) { + return beginFailoverWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-07-01"; + return service.beginFailover(resourceGroupName, accountName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManagementClientImpl.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManagementClientImpl.java index 7b7c819632d77..eccc799d06b86 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManagementClientImpl.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManagementClientImpl.java @@ -10,6 +10,8 @@ import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; @@ -51,23 +53,11 @@ public StorageManagementClientImpl withSubscriptionId(String subscriptionId) { return this; } - /** The API version to use for this operation. */ - private String apiVersion; - - /** - * Gets The API version to use for this operation. - * - * @return the apiVersion value. - */ - public String apiVersion() { - return this.apiVersion; - } - - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +66,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +76,11 @@ public StorageManagementClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** 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. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +89,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +99,11 @@ public StorageManagementClientImpl withLongRunningOperationRetryTimeout(int long return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** Whether a unique x-ms-client-request-id should be generated. 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. + * Gets Whether a unique x-ms-client-request-id should be generated. 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. */ @@ -122,7 +112,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * Sets Whether a unique x-ms-client-request-id should be generated. 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 @@ -184,6 +174,19 @@ public UsagesInner usages() { return this.usages; } + /** + * The BlobServicesInner object to access its operations. + */ + private BlobServicesInner blobServices; + + /** + * Gets the BlobServicesInner object to access its operations. + * @return the BlobServicesInner object. + */ + public BlobServicesInner blobServices() { + return this.blobServices; + } + /** * The BlobContainersInner object to access its operations. */ @@ -197,6 +200,19 @@ public BlobContainersInner blobContainers() { return this.blobContainers; } + /** + * The ManagementPoliciesInner object to access its operations. + */ + private ManagementPoliciesInner managementPolicies; + + /** + * Gets the ManagementPoliciesInner object to access its operations. + * @return the ManagementPoliciesInner object. + */ + public ManagementPoliciesInner managementPolicies() { + return this.managementPolicies; + } + /** * Initializes an instance of StorageManagementClient client. * @@ -228,7 +244,6 @@ public StorageManagementClientImpl(RestClient restClient) { } protected void initialize() { - this.apiVersion = "2018-07-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -236,7 +251,9 @@ protected void initialize() { this.skus = new SkusInner(restClient().retrofit(), this); this.storageAccounts = new StorageAccountsInner(restClient().retrofit(), this); this.usages = new UsagesInner(restClient().retrofit(), this); + this.blobServices = new BlobServicesInner(restClient().retrofit(), this); this.blobContainers = new BlobContainersInner(restClient().retrofit(), this); + this.managementPolicies = new ManagementPoliciesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } @@ -247,6 +264,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "StorageManagementClient", "2018-07-01"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "StorageManagementClient", "2018-07-01"); } } diff --git a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManager.java b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManager.java index 5f20828e6920c..c54496fa7bb34 100644 --- a/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManager.java +++ b/sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/StorageManager.java @@ -20,7 +20,9 @@ import com.microsoft.azure.management.storage.v2018_07_01.Skus; import com.microsoft.azure.management.storage.v2018_07_01.StorageAccounts; import com.microsoft.azure.management.storage.v2018_07_01.Usages; +import com.microsoft.azure.management.storage.v2018_07_01.BlobServices; import com.microsoft.azure.management.storage.v2018_07_01.BlobContainers; +import com.microsoft.azure.management.storage.v2018_07_01.ManagementPolicies; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -32,7 +34,9 @@ public final class StorageManager extends ManagerCore>> listByLocationWithServiceRe if (location == null) { throw new IllegalArgumentException("Parameter location 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.listByLocation(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + final String apiVersion = "2018-07-01"; + return service.listByLocation(this.client.subscriptionId(), location, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) {