diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/AzureEntityResource.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/AzureEntityResource.java new file mode 100644 index 00000000000..f7cdc6f3149 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/AzureEntityResource.java @@ -0,0 +1,33 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResource extends AzureResource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/AzureResource.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/AzureResource.java new file mode 100644 index 00000000000..0fda136de18 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/AzureResource.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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Azure Resource Manager resource. + */ +public class AzureResource { + /** + * Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The type of the resource. Ex- Microsoft.Compute/virtualMachines or + * Microsoft.Storage/storageAccounts. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyProperties.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyProperties.java new file mode 100644 index 00000000000..35e07d05913 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyProperties.java @@ -0,0 +1,94 @@ +/** + * 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; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The properties of an ImmutabilityPolicy of a blob container. + */ +@JsonFlatten +public class ImmutabilityPolicyProperties { + /** + * The immutability period for the blobs in the container since the policy + * creation, in days. + */ + @JsonProperty(value = "properties.immutabilityPeriodSinceCreationInDays", required = true) + private int immutabilityPeriodSinceCreationInDays; + + /** + * The ImmutabilityPolicy state of a blob container, possible values + * include: Locked and Unlocked. Possible values include: 'Locked', + * 'Unlocked'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ImmutabilityPolicyState state; + + /** + * ImmutabilityPolicy Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * The ImmutabilityPolicy update history of the blob container. + */ + @JsonProperty(value = "updateHistory", access = JsonProperty.Access.WRITE_ONLY) + private List updateHistory; + + /** + * Get the immutabilityPeriodSinceCreationInDays value. + * + * @return the immutabilityPeriodSinceCreationInDays value + */ + public int immutabilityPeriodSinceCreationInDays() { + return this.immutabilityPeriodSinceCreationInDays; + } + + /** + * Set the immutabilityPeriodSinceCreationInDays value. + * + * @param immutabilityPeriodSinceCreationInDays the immutabilityPeriodSinceCreationInDays value to set + * @return the ImmutabilityPolicyProperties object itself. + */ + public ImmutabilityPolicyProperties withImmutabilityPeriodSinceCreationInDays(int immutabilityPeriodSinceCreationInDays) { + this.immutabilityPeriodSinceCreationInDays = immutabilityPeriodSinceCreationInDays; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public ImmutabilityPolicyState state() { + return this.state; + } + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get the updateHistory value. + * + * @return the updateHistory value + */ + public List updateHistory() { + return this.updateHistory; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyState.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyState.java new file mode 100644 index 00000000000..372a511fc5f --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyState.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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ImmutabilityPolicyState. + */ +public final class ImmutabilityPolicyState extends ExpandableStringEnum { + /** Static value Locked for ImmutabilityPolicyState. */ + public static final ImmutabilityPolicyState LOCKED = fromString("Locked"); + + /** Static value Unlocked for ImmutabilityPolicyState. */ + public static final ImmutabilityPolicyState UNLOCKED = fromString("Unlocked"); + + /** + * Creates or finds a ImmutabilityPolicyState from its string representation. + * @param name a name to look for + * @return the corresponding ImmutabilityPolicyState + */ + @JsonCreator + public static ImmutabilityPolicyState fromString(String name) { + return fromString(name, ImmutabilityPolicyState.class); + } + + /** + * @return known ImmutabilityPolicyState values + */ + public static Collection values() { + return values(ImmutabilityPolicyState.class); + } +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyUpdateType.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyUpdateType.java new file mode 100644 index 00000000000..41855f47074 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ImmutabilityPolicyUpdateType.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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ImmutabilityPolicyUpdateType. + */ +public final class ImmutabilityPolicyUpdateType extends ExpandableStringEnum { + /** Static value put for ImmutabilityPolicyUpdateType. */ + public static final ImmutabilityPolicyUpdateType PUT = fromString("put"); + + /** Static value lock for ImmutabilityPolicyUpdateType. */ + public static final ImmutabilityPolicyUpdateType LOCK = fromString("lock"); + + /** Static value extend for ImmutabilityPolicyUpdateType. */ + public static final ImmutabilityPolicyUpdateType EXTEND = fromString("extend"); + + /** + * Creates or finds a ImmutabilityPolicyUpdateType from its string representation. + * @param name a name to look for + * @return the corresponding ImmutabilityPolicyUpdateType + */ + @JsonCreator + public static ImmutabilityPolicyUpdateType fromString(String name) { + return fromString(name, ImmutabilityPolicyUpdateType.class); + } + + /** + * @return known ImmutabilityPolicyUpdateType values + */ + public static Collection values() { + return values(ImmutabilityPolicyUpdateType.class); + } +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseDuration.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseDuration.java new file mode 100644 index 00000000000..7dc337596ac --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseDuration.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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LeaseDuration. + */ +public final class LeaseDuration extends ExpandableStringEnum { + /** Static value Infinite for LeaseDuration. */ + public static final LeaseDuration INFINITE = fromString("Infinite"); + + /** Static value Fixed for LeaseDuration. */ + public static final LeaseDuration FIXED = fromString("Fixed"); + + /** + * Creates or finds a LeaseDuration from its string representation. + * @param name a name to look for + * @return the corresponding LeaseDuration + */ + @JsonCreator + public static LeaseDuration fromString(String name) { + return fromString(name, LeaseDuration.class); + } + + /** + * @return known LeaseDuration values + */ + public static Collection values() { + return values(LeaseDuration.class); + } +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseState.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseState.java new file mode 100644 index 00000000000..6a68b99b475 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseState.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LeaseState. + */ +public final class LeaseState extends ExpandableStringEnum { + /** Static value Available for LeaseState. */ + public static final LeaseState AVAILABLE = fromString("Available"); + + /** Static value Leased for LeaseState. */ + public static final LeaseState LEASED = fromString("Leased"); + + /** Static value Expired for LeaseState. */ + public static final LeaseState EXPIRED = fromString("Expired"); + + /** Static value Breaking for LeaseState. */ + public static final LeaseState BREAKING = fromString("Breaking"); + + /** Static value Broken for LeaseState. */ + public static final LeaseState BROKEN = fromString("Broken"); + + /** + * Creates or finds a LeaseState from its string representation. + * @param name a name to look for + * @return the corresponding LeaseState + */ + @JsonCreator + public static LeaseState fromString(String name) { + return fromString(name, LeaseState.class); + } + + /** + * @return known LeaseState values + */ + public static Collection values() { + return values(LeaseState.class); + } +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseStatus.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseStatus.java new file mode 100644 index 00000000000..a1fc414a8b4 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LeaseStatus.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; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LeaseStatus. + */ +public final class LeaseStatus extends ExpandableStringEnum { + /** Static value Locked for LeaseStatus. */ + public static final LeaseStatus LOCKED = fromString("Locked"); + + /** Static value Unlocked for LeaseStatus. */ + public static final LeaseStatus UNLOCKED = fromString("Unlocked"); + + /** + * Creates or finds a LeaseStatus from its string representation. + * @param name a name to look for + * @return the corresponding LeaseStatus + */ + @JsonCreator + public static LeaseStatus fromString(String name) { + return fromString(name, LeaseStatus.class); + } + + /** + * @return known LeaseStatus values + */ + public static Collection values() { + return values(LeaseStatus.class); + } +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LegalHoldProperties.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LegalHoldProperties.java new file mode 100644 index 00000000000..3eed4d2c177 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/LegalHoldProperties.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The LegalHold property of a blob container. + */ +public class LegalHoldProperties { + /** + * The hasLegalHold public property is set to true by SRP if there are at + * least one existing tag. The hasLegalHold public property is set to false + * by SRP if all existing legal hold tags are cleared out. There can be a + * maximum of 1000 blob containers with hasLegalHold=true for a given + * account. + */ + @JsonProperty(value = "hasLegalHold", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasLegalHold; + + /** + * The list of LegalHold tags of a blob container. + */ + @JsonProperty(value = "tags") + private List tags; + + /** + * Get the hasLegalHold value. + * + * @return the hasLegalHold value + */ + public Boolean hasLegalHold() { + return this.hasLegalHold; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the LegalHoldProperties object itself. + */ + public LegalHoldProperties withTags(List tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ListContainerItem.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ListContainerItem.java new file mode 100644 index 00000000000..9c9f6cd1122 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/ListContainerItem.java @@ -0,0 +1,206 @@ +/** + * 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; + +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.storage.implementation.AzureEntityResourceInner; + +/** + * The blob container properties be listed out. + */ +@JsonFlatten +public class ListContainerItem extends AzureEntityResourceInner { + /** + * Specifies whether data in the container may be accessed publicly and the + * level of access. Possible values include: 'Container', 'Blob', 'None'. + */ + @JsonProperty(value = "properties.publicAccess") + private PublicAccess publicAccess; + + /** + * Returns the date and time the container was last modified. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModifiedTime; + + /** + * The lease status of the container. Possible values include: 'Locked', + * 'Unlocked'. + */ + @JsonProperty(value = "properties.leaseStatus", access = JsonProperty.Access.WRITE_ONLY) + private LeaseStatus leaseStatus; + + /** + * Lease state of the container. Possible values include: 'Available', + * 'Leased', 'Expired', 'Breaking', 'Broken'. + */ + @JsonProperty(value = "properties.leaseState", access = JsonProperty.Access.WRITE_ONLY) + private LeaseState leaseState; + + /** + * Specifies whether the lease on a container is of infinite or fixed + * duration, only when the container is leased. Possible values include: + * 'Infinite', 'Fixed'. + */ + @JsonProperty(value = "properties.leaseDuration", access = JsonProperty.Access.WRITE_ONLY) + private LeaseDuration leaseDuration; + + /** + * A name-value pair to associate with the container as metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * The ImmutabilityPolicy property of the container. + */ + @JsonProperty(value = "properties.immutabilityPolicy", access = JsonProperty.Access.WRITE_ONLY) + private ImmutabilityPolicyProperties immutabilityPolicy; + + /** + * The LegalHold property of the container. + */ + @JsonProperty(value = "properties.legalHold", access = JsonProperty.Access.WRITE_ONLY) + private LegalHoldProperties legalHold; + + /** + * The hasLegalHold public property is set to true by SRP if there are at + * least one existing tag. The hasLegalHold public property is set to false + * by SRP if all existing legal hold tags are cleared out. There can be a + * maximum of 1000 blob containers with hasLegalHold=true for a given + * account. + */ + @JsonProperty(value = "properties.hasLegalHold", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasLegalHold; + + /** + * The hasImmutabilityPolicy public property is set to true by SRP if + * ImmutabilityPolicy has been created for this container. The + * hasImmutabilityPolicy public property is set to false by SRP if + * ImmutabilityPolicy has not been created for this container. + */ + @JsonProperty(value = "properties.hasImmutabilityPolicy", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasImmutabilityPolicy; + + /** + * Get the publicAccess value. + * + * @return the publicAccess value + */ + public PublicAccess publicAccess() { + return this.publicAccess; + } + + /** + * Set the publicAccess value. + * + * @param publicAccess the publicAccess value to set + * @return the ListContainerItem object itself. + */ + public ListContainerItem withPublicAccess(PublicAccess publicAccess) { + this.publicAccess = publicAccess; + return this; + } + + /** + * Get the lastModifiedTime value. + * + * @return the lastModifiedTime value + */ + public DateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the leaseStatus value. + * + * @return the leaseStatus value + */ + public LeaseStatus leaseStatus() { + return this.leaseStatus; + } + + /** + * Get the leaseState value. + * + * @return the leaseState value + */ + public LeaseState leaseState() { + return this.leaseState; + } + + /** + * Get the leaseDuration value. + * + * @return the leaseDuration value + */ + public LeaseDuration leaseDuration() { + return this.leaseDuration; + } + + /** + * Get the metadata value. + * + * @return the metadata value + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata value. + * + * @param metadata the metadata value to set + * @return the ListContainerItem object itself. + */ + public ListContainerItem withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the immutabilityPolicy value. + * + * @return the immutabilityPolicy value + */ + public ImmutabilityPolicyProperties immutabilityPolicy() { + return this.immutabilityPolicy; + } + + /** + * Get the legalHold value. + * + * @return the legalHold value + */ + public LegalHoldProperties legalHold() { + return this.legalHold; + } + + /** + * Get the hasLegalHold value. + * + * @return the hasLegalHold value + */ + public Boolean hasLegalHold() { + return this.hasLegalHold; + } + + /** + * Get the hasImmutabilityPolicy value. + * + * @return the hasImmutabilityPolicy value + */ + public Boolean hasImmutabilityPolicy() { + return this.hasImmutabilityPolicy; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/PublicAccess.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/PublicAccess.java new file mode 100644 index 00000000000..f6d53d58584 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/PublicAccess.java @@ -0,0 +1,56 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PublicAccess. + */ +public enum PublicAccess { + /** Enum value Container. */ + CONTAINER("Container"), + + /** Enum value Blob. */ + BLOB("Blob"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a PublicAccess instance. */ + private String value; + + PublicAccess(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PublicAccess instance. + * + * @param value the serialized value to parse. + * @return the parsed PublicAccess object, or null if unable to parse. + */ + @JsonCreator + public static PublicAccess fromString(String value) { + PublicAccess[] items = PublicAccess.values(); + for (PublicAccess item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/TagProperty.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/TagProperty.java new file mode 100644 index 00000000000..d510ca9c655 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/TagProperty.java @@ -0,0 +1,94 @@ +/** + * 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; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A tag of the LegalHold of a blob container. + */ +public class TagProperty { + /** + * The tag value. + */ + @JsonProperty(value = "tag", access = JsonProperty.Access.WRITE_ONLY) + private String tag; + + /** + * Returns the date and time the tag was added. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Returns the Object ID of the user who added the tag. + */ + @JsonProperty(value = "objectIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String objectIdentifier; + + /** + * Returns the Tenant ID that issued the token for the user who added the + * tag. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Returns the User Principal Name of the user who added the tag. + */ + @JsonProperty(value = "upn", access = JsonProperty.Access.WRITE_ONLY) + private String upn; + + /** + * Get the tag value. + * + * @return the tag value + */ + public String tag() { + return this.tag; + } + + /** + * Get the timestamp value. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the objectIdentifier value. + * + * @return the objectIdentifier value + */ + public String objectIdentifier() { + return this.objectIdentifier; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the upn value. + * + * @return the upn value + */ + public String upn() { + return this.upn; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UpdateHistoryProperty.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UpdateHistoryProperty.java new file mode 100644 index 00000000000..4b5f96b12ad --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/UpdateHistoryProperty.java @@ -0,0 +1,113 @@ +/** + * 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; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An update history of the ImmutabilityPolicy of a blob container. + */ +public class UpdateHistoryProperty { + /** + * The ImmutabilityPolicy update type of a blob container, possible values + * include: put, lock and extend. Possible values include: 'put', 'lock', + * 'extend'. + */ + @JsonProperty(value = "update", access = JsonProperty.Access.WRITE_ONLY) + private ImmutabilityPolicyUpdateType update; + + /** + * The immutability period for the blobs in the container since the policy + * creation, in days. + */ + @JsonProperty(value = "immutabilityPeriodSinceCreationInDays", access = JsonProperty.Access.WRITE_ONLY) + private Integer immutabilityPeriodSinceCreationInDays; + + /** + * Returns the date and time the ImmutabilityPolicy was updated. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * Returns the Object ID of the user who updated the ImmutabilityPolicy. + */ + @JsonProperty(value = "objectIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String objectIdentifier; + + /** + * Returns the Tenant ID that issued the token for the user who updated the + * ImmutabilityPolicy. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Returns the User Principal Name of the user who updated the + * ImmutabilityPolicy. + */ + @JsonProperty(value = "upn", access = JsonProperty.Access.WRITE_ONLY) + private String upn; + + /** + * Get the update value. + * + * @return the update value + */ + public ImmutabilityPolicyUpdateType update() { + return this.update; + } + + /** + * Get the immutabilityPeriodSinceCreationInDays value. + * + * @return the immutabilityPeriodSinceCreationInDays value + */ + public Integer immutabilityPeriodSinceCreationInDays() { + return this.immutabilityPeriodSinceCreationInDays; + } + + /** + * Get the timestamp value. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the objectIdentifier value. + * + * @return the objectIdentifier value + */ + public String objectIdentifier() { + return this.objectIdentifier; + } + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the upn value. + * + * @return the upn value + */ + public String upn() { + return this.upn; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/AzureEntityResourceInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/AzureEntityResourceInner.java new file mode 100644 index 00000000000..7fc468566c7 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/AzureEntityResourceInner.java @@ -0,0 +1,34 @@ +/** + * 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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResourceInner extends Resource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the etag value. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainerInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainerInner.java new file mode 100644 index 00000000000..2ded2622773 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainerInner.java @@ -0,0 +1,212 @@ +/** + * 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.implementation; + +import com.microsoft.azure.management.storage.PublicAccess; +import org.joda.time.DateTime; +import com.microsoft.azure.management.storage.LeaseStatus; +import com.microsoft.azure.management.storage.LeaseState; +import com.microsoft.azure.management.storage.LeaseDuration; +import java.util.Map; +import com.microsoft.azure.management.storage.ImmutabilityPolicyProperties; +import com.microsoft.azure.management.storage.LegalHoldProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Properties of the blob container, including Id, resource name, resource + * type, Etag. + */ +@JsonFlatten +public class BlobContainerInner extends AzureEntityResourceInner { + /** + * Specifies whether data in the container may be accessed publicly and the + * level of access. Possible values include: 'Container', 'Blob', 'None'. + */ + @JsonProperty(value = "properties.publicAccess") + private PublicAccess publicAccess; + + /** + * Returns the date and time the container was last modified. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModifiedTime; + + /** + * The lease status of the container. Possible values include: 'Locked', + * 'Unlocked'. + */ + @JsonProperty(value = "properties.leaseStatus", access = JsonProperty.Access.WRITE_ONLY) + private LeaseStatus leaseStatus; + + /** + * Lease state of the container. Possible values include: 'Available', + * 'Leased', 'Expired', 'Breaking', 'Broken'. + */ + @JsonProperty(value = "properties.leaseState", access = JsonProperty.Access.WRITE_ONLY) + private LeaseState leaseState; + + /** + * Specifies whether the lease on a container is of infinite or fixed + * duration, only when the container is leased. Possible values include: + * 'Infinite', 'Fixed'. + */ + @JsonProperty(value = "properties.leaseDuration", access = JsonProperty.Access.WRITE_ONLY) + private LeaseDuration leaseDuration; + + /** + * A name-value pair to associate with the container as metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * The ImmutabilityPolicy property of the container. + */ + @JsonProperty(value = "properties.immutabilityPolicy", access = JsonProperty.Access.WRITE_ONLY) + private ImmutabilityPolicyProperties immutabilityPolicy; + + /** + * The LegalHold property of the container. + */ + @JsonProperty(value = "properties.legalHold", access = JsonProperty.Access.WRITE_ONLY) + private LegalHoldProperties legalHold; + + /** + * The hasLegalHold public property is set to true by SRP if there are at + * least one existing tag. The hasLegalHold public property is set to false + * by SRP if all existing legal hold tags are cleared out. There can be a + * maximum of 1000 blob containers with hasLegalHold=true for a given + * account. + */ + @JsonProperty(value = "properties.hasLegalHold", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasLegalHold; + + /** + * The hasImmutabilityPolicy public property is set to true by SRP if + * ImmutabilityPolicy has been created for this container. The + * hasImmutabilityPolicy public property is set to false by SRP if + * ImmutabilityPolicy has not been created for this container. + */ + @JsonProperty(value = "properties.hasImmutabilityPolicy", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasImmutabilityPolicy; + + /** + * Get the publicAccess value. + * + * @return the publicAccess value + */ + public PublicAccess publicAccess() { + return this.publicAccess; + } + + /** + * Set the publicAccess value. + * + * @param publicAccess the publicAccess value to set + * @return the BlobContainerInner object itself. + */ + public BlobContainerInner withPublicAccess(PublicAccess publicAccess) { + this.publicAccess = publicAccess; + return this; + } + + /** + * Get the lastModifiedTime value. + * + * @return the lastModifiedTime value + */ + public DateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the leaseStatus value. + * + * @return the leaseStatus value + */ + public LeaseStatus leaseStatus() { + return this.leaseStatus; + } + + /** + * Get the leaseState value. + * + * @return the leaseState value + */ + public LeaseState leaseState() { + return this.leaseState; + } + + /** + * Get the leaseDuration value. + * + * @return the leaseDuration value + */ + public LeaseDuration leaseDuration() { + return this.leaseDuration; + } + + /** + * Get the metadata value. + * + * @return the metadata value + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata value. + * + * @param metadata the metadata value to set + * @return the BlobContainerInner object itself. + */ + public BlobContainerInner withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the immutabilityPolicy value. + * + * @return the immutabilityPolicy value + */ + public ImmutabilityPolicyProperties immutabilityPolicy() { + return this.immutabilityPolicy; + } + + /** + * Get the legalHold value. + * + * @return the legalHold value + */ + public LegalHoldProperties legalHold() { + return this.legalHold; + } + + /** + * Get the hasLegalHold value. + * + * @return the hasLegalHold value + */ + public Boolean hasLegalHold() { + return this.hasLegalHold; + } + + /** + * Get the hasImmutabilityPolicy value. + * + * @return the hasImmutabilityPolicy value + */ + public Boolean hasImmutabilityPolicy() { + return this.hasImmutabilityPolicy; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner.java new file mode 100644 index 00000000000..0a1496bb409 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner.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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for CreateOrUpdateImmutabilityPolicy operation. + */ +public class BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner { + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Match or + * If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get the eTag value. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag value. + * + * @param eTag the eTag value to set + * @return the BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner object itself. + */ + public BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersDeleteImmutabilityPolicyHeadersInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersDeleteImmutabilityPolicyHeadersInner.java new file mode 100644 index 00000000000..429e572174c --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersDeleteImmutabilityPolicyHeadersInner.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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DeleteImmutabilityPolicy operation. + */ +public class BlobContainersDeleteImmutabilityPolicyHeadersInner { + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Match or + * If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get the eTag value. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag value. + * + * @param eTag the eTag value to set + * @return the BlobContainersDeleteImmutabilityPolicyHeadersInner object itself. + */ + public BlobContainersDeleteImmutabilityPolicyHeadersInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersExtendImmutabilityPolicyHeadersInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersExtendImmutabilityPolicyHeadersInner.java new file mode 100644 index 00000000000..58707fededf --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersExtendImmutabilityPolicyHeadersInner.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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for ExtendImmutabilityPolicy operation. + */ +public class BlobContainersExtendImmutabilityPolicyHeadersInner { + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Match or + * If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get the eTag value. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag value. + * + * @param eTag the eTag value to set + * @return the BlobContainersExtendImmutabilityPolicyHeadersInner object itself. + */ + public BlobContainersExtendImmutabilityPolicyHeadersInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersGetImmutabilityPolicyHeadersInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersGetImmutabilityPolicyHeadersInner.java new file mode 100644 index 00000000000..afc3e5697ff --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersGetImmutabilityPolicyHeadersInner.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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetImmutabilityPolicy operation. + */ +public class BlobContainersGetImmutabilityPolicyHeadersInner { + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Match or + * If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get the eTag value. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag value. + * + * @param eTag the eTag value to set + * @return the BlobContainersGetImmutabilityPolicyHeadersInner object itself. + */ + public BlobContainersGetImmutabilityPolicyHeadersInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersInner.java new file mode 100644 index 00000000000..fd04f0f1147 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersInner.java @@ -0,0 +1,1675 @@ +/** + * 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.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.storage.PublicAccess; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BlobContainers. + */ +public class BlobContainersInner { + /** The Retrofit service to perform REST calls. */ + private BlobContainersService service; + /** The service client containing this operation class. */ + private StorageManagementClientImpl client; + + /** + * Initializes an instance of BlobContainersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BlobContainersInner(Retrofit retrofit, StorageManagementClientImpl client) { + this.service = retrofit.create(BlobContainersService.class); + this.client = client; + } + + /** + * The interface defining all the services for BlobContainers to be + * used by Retrofit to perform actually REST calls. + */ + interface BlobContainersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.BlobContainers list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers") + Observable> list(@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.BlobContainers create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BlobContainerInner blobContainer, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.BlobContainers update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BlobContainerInner blobContainer, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.BlobContainers get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @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.BlobContainers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @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.BlobContainers setLegalHold" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold") + Observable> setLegalHold(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body LegalHoldInner legalHold, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.BlobContainers clearLegalHold" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold") + Observable> clearLegalHold(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body LegalHoldInner legalHold, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.BlobContainers createOrUpdateImmutabilityPolicy" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}") + Observable> createOrUpdateImmutabilityPolicy(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("immutabilityPolicyName") String immutabilityPolicyName, @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.BlobContainers getImmutabilityPolicy" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}") + Observable> getImmutabilityPolicy(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("immutabilityPolicyName") String immutabilityPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @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.BlobContainers deleteImmutabilityPolicy" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}", method = "DELETE", hasBody = true) + Observable> deleteImmutabilityPolicy(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("containerName") String containerName, @Path("immutabilityPolicyName") String immutabilityPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @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.BlobContainers lockImmutabilityPolicy" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock") + Observable> lockImmutabilityPolicy(@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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.BlobContainers extendImmutabilityPolicy" }) + @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); + + } + + /** + * Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @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 ListContainerItemsInner object if successful. + */ + public ListContainerItemsInner list(String resourceGroupName, String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @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 listAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @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 ListContainerItemsInner object + */ + public Observable listAsync(String resourceGroupName, String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, ListContainerItemsInner>() { + @Override + public ListContainerItemsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @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 ListContainerItemsInner object + */ + public Observable> listWithServiceResponseAsync(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."); + } + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(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); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 + * @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 BlobContainerInner object if successful. + */ + public BlobContainerInner create(String resourceGroupName, String accountName, String containerName) { + return createWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body(); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, containerName), serviceCallback); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 BlobContainerInner object + */ + public Observable createAsync(String resourceGroupName, String accountName, String containerName) { + return createWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1, BlobContainerInner>() { + @Override + public BlobContainerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 BlobContainerInner object + */ + public Observable> createWithServiceResponseAsync(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 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @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 BlobContainerInner object if successful. + */ + public BlobContainerInner create(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata) { + return createWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata).toBlocking().single().body(); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata), serviceCallback); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobContainerInner object + */ + public Observable createAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata) { + return createWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata).map(new Func1, BlobContainerInner>() { + @Override + public BlobContainerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobContainerInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata) { + 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(metadata); + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 + * @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 BlobContainerInner object if successful. + */ + public BlobContainerInner update(String resourceGroupName, String accountName, String containerName) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body(); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 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 updateAsync(String resourceGroupName, String accountName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, containerName), serviceCallback); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 BlobContainerInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, String containerName) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1, BlobContainerInner>() { + @Override + public BlobContainerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 BlobContainerInner object + */ + public Observable> updateWithServiceResponseAsync(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 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @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 BlobContainerInner object if successful. + */ + public BlobContainerInner update(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata).toBlocking().single().body(); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @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 updateAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata), serviceCallback); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobContainerInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, containerName, publicAccess, metadata).map(new Func1, BlobContainerInner>() { + @Override + public BlobContainerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @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 publicAccess Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'Container', 'Blob', 'None' + * @param metadata A name-value pair to associate with the container as metadata. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BlobContainerInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, PublicAccess publicAccess, Map metadata) { + 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(metadata); + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 properties of a specified container. + * + * @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 + * @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 BlobContainerInner object if successful. + */ + public BlobContainerInner get(String resourceGroupName, String accountName, String containerName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body(); + } + + /** + * Gets properties of a specified container. + * + * @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 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, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, containerName), serviceCallback); + } + + /** + * Gets properties of a specified container. + * + * @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 BlobContainerInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String containerName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1, BlobContainerInner>() { + @Override + public BlobContainerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets properties of a specified container. + * + * @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 BlobContainerInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + return service.get(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes specified container under its 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 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 + * @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, String containerName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body(); + } + + /** + * Deletes specified container under its 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 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 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, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, containerName), serviceCallback); + } + + /** + * Deletes specified container under its 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 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 {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String containerName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes specified container under its 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 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 {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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."); + } + return service.delete(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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); + } + + /** + * Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @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 LegalHoldInner object if successful. + */ + public LegalHoldInner setLegalHold(String resourceGroupName, String accountName, String containerName, List tags) { + return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); + } + + /** + * Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @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 setLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags), serviceCallback); + } + + /** + * Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LegalHoldInner object + */ + public Observable setLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List tags) { + return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).map(new Func1, LegalHoldInner>() { + @Override + public LegalHoldInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LegalHoldInner object + */ + public Observable> setLegalHoldWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, List tags) { + 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."); + } + if (tags == null) { + throw new IllegalArgumentException("Parameter tags is required and cannot be null."); + } + Validator.validate(tags); + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = setLegalHoldDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse setLegalHoldDelegate(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); + } + + /** + * Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @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 LegalHoldInner object if successful. + */ + public LegalHoldInner clearLegalHold(String resourceGroupName, String accountName, String containerName, List tags) { + return clearLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); + } + + /** + * Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @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 clearLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(clearLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags), serviceCallback); + } + + /** + * Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LegalHoldInner object + */ + public Observable clearLegalHoldAsync(String resourceGroupName, String accountName, String containerName, List tags) { + return clearLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).map(new Func1, LegalHoldInner>() { + @Override + public LegalHoldInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @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 tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LegalHoldInner object + */ + public Observable> clearLegalHoldWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, List tags) { + 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."); + } + if (tags == null) { + throw new IllegalArgumentException("Parameter tags is required and cannot be null."); + } + Validator.validate(tags); + 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()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = clearLegalHoldDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse clearLegalHoldDelegate(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); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner createOrUpdateImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays) { + return createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays).toBlocking().single().body(); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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 createOrUpdateImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays), serviceCallback); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable createOrUpdateImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays) { + return createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable> createOrUpdateImmutabilityPolicyWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays) { + 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 String immutabilityPolicyName = "default"; + final String ifMatch = null; + ImmutabilityPolicyInner parameters = new ImmutabilityPolicyInner(); + parameters.withImmutabilityPeriodSinceCreationInDays(immutabilityPeriodSinceCreationInDays); + return service.createOrUpdateImmutabilityPolicy(resourceGroupName, accountName, containerName, immutabilityPolicyName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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. + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner createOrUpdateImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, String ifMatch) { + return createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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. + * @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 createOrUpdateImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays, ifMatch), serviceCallback); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable createOrUpdateImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, String ifMatch) { + return createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays, ifMatch).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @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 immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable> createOrUpdateImmutabilityPolicyWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, String ifMatch) { + 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 String immutabilityPolicyName = "default"; + ImmutabilityPolicyInner parameters = new ImmutabilityPolicyInner(); + parameters.withImmutabilityPeriodSinceCreationInDays(immutabilityPeriodSinceCreationInDays); + return service.createOrUpdateImmutabilityPolicy(resourceGroupName, accountName, containerName, immutabilityPolicyName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = createOrUpdateImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders createOrUpdateImmutabilityPolicyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BlobContainersCreateOrUpdateImmutabilityPolicyHeadersInner.class); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner getImmutabilityPolicy(String resourceGroupName, String accountName, String containerName) { + return getImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName).toBlocking().single().body(); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 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 getImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName), serviceCallback); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 ImmutabilityPolicyInner object + */ + public Observable getImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName) { + return getImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 ImmutabilityPolicyInner object + */ + public Observable> getImmutabilityPolicyWithServiceResponseAsync(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 String immutabilityPolicyName = "default"; + final String ifMatch = null; + return service.getImmutabilityPolicy(resourceGroupName, accountName, containerName, immutabilityPolicyName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 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. + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner getImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) { + return getImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body(); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 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. + * @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 getImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch), serviceCallback); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable getImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { + return getImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable> getImmutabilityPolicyWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { + 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 String immutabilityPolicyName = "default"; + return service.getImmutabilityPolicy(resourceGroupName, accountName, containerName, immutabilityPolicyName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getImmutabilityPolicyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BlobContainersGetImmutabilityPolicyHeadersInner.class); + } + + /** + * Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container. + * + * @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 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. + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner deleteImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) { + return deleteImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body(); + } + + /** + * Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container. + * + * @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 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. + * @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 deleteImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(deleteImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch), serviceCallback); + } + + /** + * Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container. + * + * @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable deleteImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { + return deleteImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container. + * + * @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable> deleteImmutabilityPolicyWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { + 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + final String immutabilityPolicyName = "default"; + return service.deleteImmutabilityPolicy(resourceGroupName, accountName, containerName, immutabilityPolicyName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = deleteImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders deleteImmutabilityPolicyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BlobContainersDeleteImmutabilityPolicyHeadersInner.class); + } + + /** + * Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @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 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. + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner lockImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) { + return lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body(); + } + + /** + * Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @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 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. + * @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 lockImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch), serviceCallback); + } + + /** + * Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable lockImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { + return lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable> lockImmutabilityPolicyWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { + 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + return service.lockImmutabilityPolicy(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = lockImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders lockImmutabilityPolicyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BlobContainersLockImmutabilityPolicyHeadersInner.class); + } + + /** + * Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @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 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. + * @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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 ImmutabilityPolicyInner object if successful. + */ + public ImmutabilityPolicyInner extendImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) { + return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).toBlocking().single().body(); + } + + /** + * Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @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 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. + * @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @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 extendImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays), serviceCallback); + } + + /** + * Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @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 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. + * @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable extendImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) { + return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).map(new Func1, ImmutabilityPolicyInner>() { + @Override + public ImmutabilityPolicyInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @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 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. + * @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImmutabilityPolicyInner object + */ + public Observable> extendImmutabilityPolicyWithServiceResponseAsync(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) { + 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."); + } + if (ifMatch == null) { + throw new IllegalArgumentException("Parameter ifMatch is required and cannot be null."); + } + ImmutabilityPolicyInner parameters = new ImmutabilityPolicyInner(); + parameters.withImmutabilityPeriodSinceCreationInDays(immutabilityPeriodSinceCreationInDays); + return service.extendImmutabilityPolicy(resourceGroupName, accountName, containerName, this.client.subscriptionId(), this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = extendImmutabilityPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders extendImmutabilityPolicyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, BlobContainersExtendImmutabilityPolicyHeadersInner.class); + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersLockImmutabilityPolicyHeadersInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersLockImmutabilityPolicyHeadersInner.java new file mode 100644 index 00000000000..df7663db080 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/BlobContainersLockImmutabilityPolicyHeadersInner.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.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for LockImmutabilityPolicy operation. + */ +public class BlobContainersLockImmutabilityPolicyHeadersInner { + /** + * The ETag HTTP response header. This is an opaque string. You can use it + * to detect whether the resource has changed between requests. In + * particular, you can pass the ETag to one of the If-Match or + * If-None-Match headers. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /** + * Get the eTag value. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag value. + * + * @param eTag the eTag value to set + * @return the BlobContainersLockImmutabilityPolicyHeadersInner object itself. + */ + public BlobContainersLockImmutabilityPolicyHeadersInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ImmutabilityPolicyInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ImmutabilityPolicyInner.java new file mode 100644 index 00000000000..5454aadc364 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ImmutabilityPolicyInner.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.implementation; + +import com.microsoft.azure.management.storage.ImmutabilityPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The ImmutabilityPolicy property of a blob container, including Id, resource + * name, resource type, Etag. + */ +@JsonFlatten +public class ImmutabilityPolicyInner extends AzureEntityResourceInner { + /** + * The immutability period for the blobs in the container since the policy + * creation, in days. + */ + @JsonProperty(value = "properties.immutabilityPeriodSinceCreationInDays", required = true) + private int immutabilityPeriodSinceCreationInDays; + + /** + * The ImmutabilityPolicy state of a blob container, possible values + * include: Locked and Unlocked. Possible values include: 'Locked', + * 'Unlocked'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private ImmutabilityPolicyState state; + + /** + * Get the immutabilityPeriodSinceCreationInDays value. + * + * @return the immutabilityPeriodSinceCreationInDays value + */ + public int immutabilityPeriodSinceCreationInDays() { + return this.immutabilityPeriodSinceCreationInDays; + } + + /** + * Set the immutabilityPeriodSinceCreationInDays value. + * + * @param immutabilityPeriodSinceCreationInDays the immutabilityPeriodSinceCreationInDays value to set + * @return the ImmutabilityPolicyInner object itself. + */ + public ImmutabilityPolicyInner withImmutabilityPeriodSinceCreationInDays(int immutabilityPeriodSinceCreationInDays) { + this.immutabilityPeriodSinceCreationInDays = immutabilityPeriodSinceCreationInDays; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public ImmutabilityPolicyState state() { + return this.state; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/LegalHoldInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/LegalHoldInner.java new file mode 100644 index 00000000000..31a0eabd185 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/LegalHoldInner.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.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The LegalHold property of a blob container. + */ +public class LegalHoldInner { + /** + * The hasLegalHold public property is set to true by SRP if there are at + * least one existing tag. The hasLegalHold public property is set to false + * by SRP if all existing legal hold tags are cleared out. There can be a + * maximum of 1000 blob containers with hasLegalHold=true for a given + * account. + */ + @JsonProperty(value = "hasLegalHold", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasLegalHold; + + /** + * Each tag should be 3 to 23 alphanumeric characters and is normalized to + * lower case at SRP. + */ + @JsonProperty(value = "tags", required = true) + private List tags; + + /** + * Get the hasLegalHold value. + * + * @return the hasLegalHold value + */ + public Boolean hasLegalHold() { + return this.hasLegalHold; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the LegalHoldInner object itself. + */ + public LegalHoldInner withTags(List tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ListContainerItemsInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ListContainerItemsInner.java new file mode 100644 index 00000000000..b478e56d009 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ListContainerItemsInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.implementation; + +import java.util.List; +import com.microsoft.azure.management.storage.ListContainerItem; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of blob containers. + */ +public class ListContainerItemsInner { + /** + * The list of blob containers. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the ListContainerItemsInner object itself. + */ + public ListContainerItemsInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ProxyResourceInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ProxyResourceInner.java new file mode 100644 index 00000000000..e6a68c927b7 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/ProxyResourceInner.java @@ -0,0 +1,18 @@ +/** + * 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.implementation; + +import com.microsoft.azure.Resource; + +/** + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + */ +public class ProxyResourceInner extends Resource { +} diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountInner.java index b30cd8aae8f..0b4736028e2 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountInner.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageAccountInner.java @@ -20,13 +20,12 @@ import com.microsoft.azure.management.storage.NetworkRuleSet; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; -import com.microsoft.azure.Resource; /** * The storage account. */ @JsonFlatten -public class StorageAccountInner extends Resource { +public class StorageAccountInner extends TrackedResourceInner { /** * Gets the SKU. */ diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageManagementClientImpl.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageManagementClientImpl.java index ce919779fbc..19a5057b26b 100644 --- a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageManagementClientImpl.java +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageManagementClientImpl.java @@ -28,11 +28,11 @@ public AzureClient getAzureClient() { return this.azureClient; } - /** Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + /** The ID of the target subscription. */ private String subscriptionId; /** - * Gets Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * Gets The ID of the target subscription. * * @return the subscriptionId value. */ @@ -41,7 +41,7 @@ public String subscriptionId() { } /** - * Sets Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the service client itself @@ -51,11 +51,11 @@ public StorageManagementClientImpl withSubscriptionId(String subscriptionId) { return this; } - /** Client Api Version. */ + /** The API version to use for this operation. */ private String apiVersion; /** - * Gets Client Api Version. + * Gets The API version to use for this operation. * * @return the apiVersion value. */ @@ -184,6 +184,19 @@ public UsagesInner usages() { return this.usages; } + /** + * The BlobContainersInner object to access its operations. + */ + private BlobContainersInner blobContainers; + + /** + * Gets the BlobContainersInner object to access its operations. + * @return the BlobContainersInner object. + */ + public BlobContainersInner blobContainers() { + return this.blobContainers; + } + /** * Initializes an instance of StorageManagementClient client. * @@ -215,7 +228,7 @@ public StorageManagementClientImpl(RestClient restClient) { } protected void initialize() { - this.apiVersion = "2017-10-01"; + this.apiVersion = "2018-02-01"; this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -223,6 +236,7 @@ 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.blobContainers = new BlobContainersInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } @@ -233,6 +247,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "StorageManagementClient", "2017-10-01"); + return String.format("%s (%s, %s)", super.userAgent(), "StorageManagementClient", "2018-02-01"); } } diff --git a/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/TrackedResourceInner.java b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/TrackedResourceInner.java new file mode 100644 index 00000000000..096cb19c1f5 --- /dev/null +++ b/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/TrackedResourceInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * The resource model definition for a ARM tracked top level resource. + */ +public class TrackedResourceInner extends Resource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The geo-location where the resource lives. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the TrackedResourceInner object itself. + */ + public TrackedResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location value. + * + * @param location the location value to set + * @return the TrackedResourceInner object itself. + */ + public TrackedResourceInner withLocation(String location) { + this.location = location; + return this; + } + +}