diff --git a/sdk/storage/mgmt-v2018_02_01/pom.xml b/sdk/storage/mgmt-v2018_02_01/pom.xml index 809261b3d75f9..5a03b510cb931 100644 --- a/sdk/storage/mgmt-v2018_02_01/pom.xml +++ b/sdk/storage/mgmt-v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/BlobContainer.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/BlobContainer.java index fd6c8a3baf7b6..e6256282596ac 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/BlobContainer.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/BlobContainers.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/BlobContainers.java index feaf8cb438fd2..b22510b3b26e4 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/BlobContainers.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/CustomDomain.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/CustomDomain.java index eb6a3f64f18f2..ab5fb6b3a0846 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/CustomDomain.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/Dimension.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/Dimension.java index e328ee85e6422..0c65384071b03 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/Dimension.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/ImmutabilityPolicy.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/ImmutabilityPolicy.java index d498ce639d8f2..8b5c0ce52f8f7 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/ImmutabilityPolicy.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/LeaseContainerRequest.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/LeaseContainerRequest.java new file mode 100644 index 0000000000000..378ba0d885e5f --- /dev/null +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/LeaseContainerResponse.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/LeaseContainerResponse.java new file mode 100644 index 0000000000000..33f884df3ac8c --- /dev/null +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storage.v2018_02_01.implementation.StorageManager; +import com.microsoft.azure.management.storage.v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/ServiceSasParameters.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/ServiceSasParameters.java index 030dd36f59f50..b7b1c328c71cc 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/ServiceSasParameters.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/StorageAccount.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/StorageAccount.java index f571f0589619e..c021886e588d9 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/StorageAccount.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/StorageAccount.java @@ -144,7 +144,9 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup, Resource.UpdateWithTags 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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersImpl.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersImpl.java index ed140db7d4e8c..12ffe17ce7298 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersImpl.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersImpl.java @@ -17,6 +17,7 @@ import com.microsoft.azure.management.storage.v2018_02_01.ListContainerItems; import com.microsoft.azure.management.storage.v2018_02_01.BlobContainer; import com.microsoft.azure.management.storage.v2018_02_01.LegalHold; +import com.microsoft.azure.management.storage.v2018_02_01.LeaseContainerResponse; import java.util.List; import com.microsoft.azure.management.storage.v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersInner.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersInner.java index 79f2511cae8ca..162132c628b29 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersInner.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/BlobContainersInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.management.storage.v2018_02_01.BlobContainersExtendImmutabilityPolicyHeaders; import com.microsoft.azure.management.storage.v2018_02_01.BlobContainersGetImmutabilityPolicyHeaders; import com.microsoft.azure.management.storage.v2018_02_01.BlobContainersLockImmutabilityPolicyHeaders; +import com.microsoft.azure.management.storage.v2018_02_01.LeaseContainerRequest; import com.microsoft.azure.management.storage.v2018_02_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_02_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); + } /** @@ -1677,4 +1682,189 @@ 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final LeaseContainerRequest parameters = null; + return service.lease(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.lease(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/ImmutabilityPolicyImpl.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/ImmutabilityPolicyImpl.java index f9e594e63ca26..abe385de55fea 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/ImmutabilityPolicyImpl.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/LeaseContainerResponseImpl.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/LeaseContainerResponseImpl.java new file mode 100644 index 0000000000000..86d386f02d2fb --- /dev/null +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01.implementation; + +import com.microsoft.azure.management.storage.v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/LeaseContainerResponseInner.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/LeaseContainerResponseInner.java new file mode 100644 index 0000000000000..04ce93344ef39 --- /dev/null +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/ListServiceSasResponseInner.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/ListServiceSasResponseInner.java index 1be2c12da9a07..aa2f104a83d06 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/ListServiceSasResponseInner.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_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_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/StorageAccountsInner.java b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/StorageAccountsInner.java index 75ae74d0594a0..45a42cd74d105 100644 --- a/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/StorageAccountsInner.java +++ b/sdk/storage/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/storage/v2018_02_01/implementation/StorageAccountsInner.java @@ -898,7 +898,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 +913,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 +927,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 +945,7 @@ public StorageAccountListKeysResultInner call(ServiceResponse