diff --git a/sdk/storage/mgmt-v2019_06_01/pom.xml b/sdk/storage/mgmt-v2019_06_01/pom.xml index d78ffdcaf3868..1ce26f37d8391 100644 --- a/sdk/storage/mgmt-v2019_06_01/pom.xml +++ b/sdk/storage/mgmt-v2019_06_01/pom.xml @@ -11,11 +11,11 @@ com.microsoft.azure azure-arm-parent - 1.3.0 + 1.1.0 ../../../pom.management.xml azure-mgmt-storage - 1.0.0-beta-5 + 1.0.0-beta jar Microsoft Azure SDK for Storage Management This package contains Microsoft Storage Management SDK. diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobRestoreRange.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobRestoreRange.java index 1569b651a761d..76f2206c4b09f 100644 --- a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobRestoreRange.java +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobRestoreRange.java @@ -15,19 +15,19 @@ */ public class BlobRestoreRange { /** - * Blob start range. Empty means account start. + * Blob start range. This is inclusive. Empty means account start. */ @JsonProperty(value = "startRange", required = true) private String startRange; /** - * Blob end range. Empty means account end. + * Blob end range. This is exclusive. Empty means account end. */ @JsonProperty(value = "endRange", required = true) private String endRange; /** - * Get blob start range. Empty means account start. + * Get blob start range. This is inclusive. Empty means account start. * * @return the startRange value */ @@ -36,7 +36,7 @@ public String startRange() { } /** - * Set blob start range. Empty means account start. + * Set blob start range. This is inclusive. Empty means account start. * * @param startRange the startRange value to set * @return the BlobRestoreRange object itself. @@ -47,7 +47,7 @@ public BlobRestoreRange withStartRange(String startRange) { } /** - * Get blob end range. Empty means account end. + * Get blob end range. This is exclusive. Empty means account end. * * @return the endRange value */ @@ -56,7 +56,7 @@ public String endRange() { } /** - * Set blob end range. Empty means account end. + * Set blob end range. This is exclusive. Empty means account end. * * @param endRange the endRange value to set * @return the BlobRestoreRange object itself. diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobServiceProperties.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobServiceProperties.java index ee76aa4206be5..0d77af847f630 100644 --- a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobServiceProperties.java +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/BlobServiceProperties.java @@ -16,7 +16,6 @@ import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; -import com.microsoft.azure.management.storage.v2019_06_01.implementation.SkuInner; import com.microsoft.azure.management.storage.v2019_06_01.implementation.StorageManager; /** diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/FileServiceProperties.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/FileServiceProperties.java index 80583259c4669..8bd2a2d904708 100644 --- a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/FileServiceProperties.java +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/FileServiceProperties.java @@ -16,8 +16,8 @@ import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; -import com.microsoft.azure.management.storage.v2019_06_01.implementation.SkuInner; import com.microsoft.azure.management.storage.v2019_06_01.implementation.StorageManager; +import java.util.List; /** * Type representing FileServiceProperties. diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicies.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicies.java new file mode 100644 index 0000000000000..c04477a338ba3 --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicies.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.storage.v2019_06_01.implementation.ObjectReplicationPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ObjectReplicationPolicies. + */ +public interface ObjectReplicationPolicies extends SupportsCreating, HasInner { + /** + * Get the object replication policy of the storage account by policy ID. + * + * @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 objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId); + + /** + * List the object replication policies associated with the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String accountName); + + /** + * Deletes the object replication policy associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId); + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicy.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicy.java new file mode 100644 index 0000000000000..d935176191d1a --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicy.java @@ -0,0 +1,163 @@ +/** + * 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.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.storage.v2019_06_01.implementation.ObjectReplicationPolicyInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storage.v2019_06_01.implementation.StorageManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing ObjectReplicationPolicy. + */ +public interface ObjectReplicationPolicy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the destinationAccount value. + */ + String destinationAccount(); + + /** + * @return the enabledTime value. + */ + DateTime enabledTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the policyId value. + */ + String policyId(); + + /** + * @return the rules value. + */ + List rules(); + + /** + * @return the sourceAccount value. + */ + String sourceAccount(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ObjectReplicationPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithStorageAccount, DefinitionStages.WithDestinationAccount, DefinitionStages.WithSourceAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of ObjectReplicationPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ObjectReplicationPolicy definition. + */ + interface Blank extends WithStorageAccount { + } + + /** + * The stage of the objectreplicationpolicy definition allowing to specify StorageAccount. + */ + interface WithStorageAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only + * @return the next definition stage + */ + WithDestinationAccount withExistingStorageAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the objectreplicationpolicy definition allowing to specify DestinationAccount. + */ + interface WithDestinationAccount { + /** + * Specifies destinationAccount. + * @param destinationAccount Required. Destination account name + * @return the next definition stage + */ + WithSourceAccount withDestinationAccount(String destinationAccount); + } + + /** + * The stage of the objectreplicationpolicy definition allowing to specify SourceAccount. + */ + interface WithSourceAccount { + /** + * Specifies sourceAccount. + * @param sourceAccount Required. Source account name + * @return the next definition stage + */ + WithCreate withSourceAccount(String sourceAccount); + } + + /** + * The stage of the objectreplicationpolicy definition allowing to specify Rules. + */ + interface WithRules { + /** + * Specifies rules. + * @param rules The storage account object replication rules + * @return the next definition stage + */ + WithCreate withRules(List rules); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithRules { + } + } + /** + * The template for a ObjectReplicationPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithRules { + } + + /** + * Grouping of ObjectReplicationPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the objectreplicationpolicy update allowing to specify Rules. + */ + interface WithRules { + /** + * Specifies rules. + * @param rules The storage account object replication rules + * @return the next update stage + */ + Update withRules(List rules); + } + + } +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicyFilter.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicyFilter.java new file mode 100644 index 0000000000000..97159ae9d3c89 --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicyFilter.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storage.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Filters limit replication to a subset of blobs within the storage account. A + * logical OR is performed on values in the filter. If multiple filters are + * defined, a logical AND is performed on all filters. + */ +public class ObjectReplicationPolicyFilter { + /** + * Optional. Filters the results to replicate only blobs whose names begin + * with the specified prefix. + */ + @JsonProperty(value = "prefixMatch") + private List prefixMatch; + + /** + * Blobs created after the time will be replicated to the destination. It + * must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: + * 2020-02-19T16:05:00Z. + */ + @JsonProperty(value = "minCreationTime") + private String minCreationTime; + + /** + * Get optional. Filters the results to replicate only blobs whose names begin with the specified prefix. + * + * @return the prefixMatch value + */ + public List prefixMatch() { + return this.prefixMatch; + } + + /** + * Set optional. Filters the results to replicate only blobs whose names begin with the specified prefix. + * + * @param prefixMatch the prefixMatch value to set + * @return the ObjectReplicationPolicyFilter object itself. + */ + public ObjectReplicationPolicyFilter withPrefixMatch(List prefixMatch) { + this.prefixMatch = prefixMatch; + return this; + } + + /** + * Get blobs created after the time will be replicated to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + * + * @return the minCreationTime value + */ + public String minCreationTime() { + return this.minCreationTime; + } + + /** + * Set blobs created after the time will be replicated to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. Example: 2020-02-19T16:05:00Z. + * + * @param minCreationTime the minCreationTime value to set + * @return the ObjectReplicationPolicyFilter object itself. + */ + public ObjectReplicationPolicyFilter withMinCreationTime(String minCreationTime) { + this.minCreationTime = minCreationTime; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicyRule.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicyRule.java new file mode 100644 index 0000000000000..1aba044b9b219 --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/ObjectReplicationPolicyRule.java @@ -0,0 +1,122 @@ +/** + * 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.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The replication policy rule between two containers. + */ +public class ObjectReplicationPolicyRule { + /** + * Rule Id is auto-generated for each new rule on destination account. It + * is required for put policy on source account. + */ + @JsonProperty(value = "ruleId") + private String ruleId; + + /** + * Required. Source container name. + */ + @JsonProperty(value = "sourceContainer", required = true) + private String sourceContainer; + + /** + * Required. Destination container name. + */ + @JsonProperty(value = "destinationContainer", required = true) + private String destinationContainer; + + /** + * Optional. An object that defines the filter set. + */ + @JsonProperty(value = "filters") + private ObjectReplicationPolicyFilter filters; + + /** + * Get rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. + * + * @return the ruleId value + */ + public String ruleId() { + return this.ruleId; + } + + /** + * Set rule Id is auto-generated for each new rule on destination account. It is required for put policy on source account. + * + * @param ruleId the ruleId value to set + * @return the ObjectReplicationPolicyRule object itself. + */ + public ObjectReplicationPolicyRule withRuleId(String ruleId) { + this.ruleId = ruleId; + return this; + } + + /** + * Get required. Source container name. + * + * @return the sourceContainer value + */ + public String sourceContainer() { + return this.sourceContainer; + } + + /** + * Set required. Source container name. + * + * @param sourceContainer the sourceContainer value to set + * @return the ObjectReplicationPolicyRule object itself. + */ + public ObjectReplicationPolicyRule withSourceContainer(String sourceContainer) { + this.sourceContainer = sourceContainer; + return this; + } + + /** + * Get required. Destination container name. + * + * @return the destinationContainer value + */ + public String destinationContainer() { + return this.destinationContainer; + } + + /** + * Set required. Destination container name. + * + * @param destinationContainer the destinationContainer value to set + * @return the ObjectReplicationPolicyRule object itself. + */ + public ObjectReplicationPolicyRule withDestinationContainer(String destinationContainer) { + this.destinationContainer = destinationContainer; + return this; + } + + /** + * Get optional. An object that defines the filter set. + * + * @return the filters value + */ + public ObjectReplicationPolicyFilter filters() { + return this.filters; + } + + /** + * Set optional. An object that defines the filter set. + * + * @param filters the filters value to set + * @return the ObjectReplicationPolicyRule object itself. + */ + public ObjectReplicationPolicyRule withFilters(ObjectReplicationPolicyFilter filters) { + this.filters = filters; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/RestorePolicyProperties.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/RestorePolicyProperties.java index 4c8f0cb6e149e..2aea2a0c4f1f4 100644 --- a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/RestorePolicyProperties.java +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/RestorePolicyProperties.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.storage.v2019_06_01; +import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -27,6 +28,12 @@ public class RestorePolicyProperties { @JsonProperty(value = "days") private Integer days; + /** + * Returns the date and time the restore policy was last enabled. + */ + @JsonProperty(value = "lastEnabledTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastEnabledTime; + /** * Get blob restore is enabled if set to true. * @@ -67,4 +74,13 @@ public RestorePolicyProperties withDays(Integer days) { return this; } + /** + * Get returns the date and time the restore policy was last enabled. + * + * @return the lastEnabledTime value + */ + public DateTime lastEnabledTime() { + return this.lastEnabledTime; + } + } diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPoliciesImpl.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPoliciesImpl.java new file mode 100644 index 0000000000000..174b959d00336 --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPoliciesImpl.java @@ -0,0 +1,85 @@ +/** + * 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.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicies; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicy; + +class ObjectReplicationPoliciesImpl extends WrapperImpl implements ObjectReplicationPolicies { + private final StorageManager manager; + + ObjectReplicationPoliciesImpl(StorageManager manager) { + super(manager.inner().objectReplicationPolicies()); + this.manager = manager; + } + + public StorageManager manager() { + return this.manager; + } + + @Override + public ObjectReplicationPolicyImpl define(String name) { + return wrapModel(name); + } + + private ObjectReplicationPolicyImpl wrapModel(ObjectReplicationPolicyInner inner) { + return new ObjectReplicationPolicyImpl(inner, manager()); + } + + private ObjectReplicationPolicyImpl wrapModel(String name) { + return new ObjectReplicationPolicyImpl(name, this.manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String accountName) { + ObjectReplicationPoliciesInner client = this.inner(); + return client.listAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ObjectReplicationPolicy call(ObjectReplicationPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + ObjectReplicationPoliciesInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, objectReplicationPolicyId) + .flatMap(new Func1>() { + @Override + public Observable call(ObjectReplicationPolicyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ObjectReplicationPolicy)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + ObjectReplicationPoliciesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, objectReplicationPolicyId).toCompletable(); + } + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPoliciesInner.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPoliciesInner.java new file mode 100644 index 0000000000000..5d7e83a3afe3d --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPoliciesInner.java @@ -0,0 +1,455 @@ +/** + * 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.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.storage.v2019_06_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ObjectReplicationPolicies. + */ +public class ObjectReplicationPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ObjectReplicationPoliciesService service; + /** The service client containing this operation class. */ + private StorageManagementClientImpl client; + + /** + * Initializes an instance of ObjectReplicationPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ObjectReplicationPoliciesInner(Retrofit retrofit, StorageManagementClientImpl client) { + this.service = retrofit.create(ObjectReplicationPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ObjectReplicationPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ObjectReplicationPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicies list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies") + 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.v2019_06_01.ObjectReplicationPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("objectReplicationPolicyId") String objectReplicationPolicyId, @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.v2019_06_01.ObjectReplicationPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("objectReplicationPolicyId") String objectReplicationPolicyId, @Query("api-version") String apiVersion, @Body ObjectReplicationPolicyInner properties, @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.v2019_06_01.ObjectReplicationPolicies delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Path("objectReplicationPolicyId") String objectReplicationPolicyId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List the object replication policies associated with the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ObjectReplicationPolicyInner> object if successful. + */ + public List list(String resourceGroupName, String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * List the object replication policies associated with the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * List the object replication policies associated with the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ObjectReplicationPolicyInner> object + */ + public Observable> listAsync(String resourceGroupName, String accountName) { + return listWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List the object replication policies associated with the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ObjectReplicationPolicyInner> 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> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the object replication policy of the storage account by policy ID. + * + * @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 objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ObjectReplicationPolicyInner object if successful. + */ + public ObjectReplicationPolicyInner get(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + return getWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId).toBlocking().single().body(); + } + + /** + * Get the object replication policy of the storage account by policy ID. + * + * @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 objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @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 objectReplicationPolicyId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId), serviceCallback); + } + + /** + * Get the object replication policy of the storage account by policy ID. + * + * @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 objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ObjectReplicationPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + return getWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId).map(new Func1, ObjectReplicationPolicyInner>() { + @Override + public ObjectReplicationPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the object replication policy of the storage account by policy ID. + * + * @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 objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ObjectReplicationPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + 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 (objectReplicationPolicyId == null) { + throw new IllegalArgumentException("Parameter objectReplicationPolicyId 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, this.client.subscriptionId(), objectReplicationPolicyId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update the object replication policy of the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @param properties The object replication policy set to a storage account. A unique policy ID will be created if absent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ObjectReplicationPolicyInner object if successful. + */ + public ObjectReplicationPolicyInner createOrUpdate(String resourceGroupName, String accountName, String objectReplicationPolicyId, ObjectReplicationPolicyInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId, properties).toBlocking().single().body(); + } + + /** + * Create or update the object replication policy of the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @param properties The object replication policy set to a storage account. A unique policy ID will be created if absent. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId, ObjectReplicationPolicyInner properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId, properties), serviceCallback); + } + + /** + * Create or update the object replication policy of the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @param properties The object replication policy set to a storage account. A unique policy ID will be created if absent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ObjectReplicationPolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId, ObjectReplicationPolicyInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId, properties).map(new Func1, ObjectReplicationPolicyInner>() { + @Override + public ObjectReplicationPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update the object replication policy of the storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @param properties The object replication policy set to a storage account. A unique policy ID will be created if absent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ObjectReplicationPolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId, ObjectReplicationPolicyInner properties) { + 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 (objectReplicationPolicyId == null) { + throw new IllegalArgumentException("Parameter objectReplicationPolicyId 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 (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + return service.createOrUpdate(resourceGroupName, accountName, this.client.subscriptionId(), objectReplicationPolicyId, this.client.apiVersion(), properties, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the object replication policy associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 objectReplicationPolicyId) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId).toBlocking().single().body(); + } + + /** + * Deletes the object replication policy associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @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 objectReplicationPolicyId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId), serviceCallback); + } + + /** + * Deletes the object replication policy associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, objectReplicationPolicyId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the object replication policy associated with the specified storage account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param objectReplicationPolicyId The ID of object replication policy or 'default' if the policy ID is unknown. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String objectReplicationPolicyId) { + 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 (objectReplicationPolicyId == null) { + throw new IllegalArgumentException("Parameter objectReplicationPolicyId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, accountName, this.client.subscriptionId(), objectReplicationPolicyId, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPolicyImpl.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPolicyImpl.java new file mode 100644 index 0000000000000..f49eb5e3acc9e --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPolicyImpl.java @@ -0,0 +1,140 @@ +/** + * 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.v2019_06_01.implementation; + +import com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicyRule; + +class ObjectReplicationPolicyImpl extends CreatableUpdatableImpl implements ObjectReplicationPolicy, ObjectReplicationPolicy.Definition, ObjectReplicationPolicy.Update { + private final StorageManager manager; + private String resourceGroupName; + private String accountName; + private String objectReplicationPolicyId; + + ObjectReplicationPolicyImpl(String name, StorageManager manager) { + super(name, new ObjectReplicationPolicyInner()); + this.manager = manager; + // Set resource name + this.objectReplicationPolicyId = name; + // + } + + ObjectReplicationPolicyImpl(ObjectReplicationPolicyInner inner, StorageManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.objectReplicationPolicyId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "storageAccounts"); + this.objectReplicationPolicyId = IdParsingUtils.getValueFromIdByName(inner.id(), "objectReplicationPolicies"); + // + } + + @Override + public StorageManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ObjectReplicationPoliciesInner client = this.manager().inner().objectReplicationPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.objectReplicationPolicyId, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ObjectReplicationPoliciesInner client = this.manager().inner().objectReplicationPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.objectReplicationPolicyId, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ObjectReplicationPoliciesInner client = this.manager().inner().objectReplicationPolicies(); + return client.getAsync(this.resourceGroupName, this.accountName, this.objectReplicationPolicyId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String destinationAccount() { + return this.inner().destinationAccount(); + } + + @Override + public DateTime enabledTime() { + return this.inner().enabledTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String policyId() { + return this.inner().policyId(); + } + + @Override + public List rules() { + return this.inner().rules(); + } + + @Override + public String sourceAccount() { + return this.inner().sourceAccount(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ObjectReplicationPolicyImpl withExistingStorageAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public ObjectReplicationPolicyImpl withDestinationAccount(String destinationAccount) { + this.inner().withDestinationAccount(destinationAccount); + return this; + } + + @Override + public ObjectReplicationPolicyImpl withSourceAccount(String sourceAccount) { + this.inner().withSourceAccount(sourceAccount); + return this; + } + + @Override + public ObjectReplicationPolicyImpl withRules(List rules) { + this.inner().withRules(rules); + return this; + } + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPolicyInner.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPolicyInner.java new file mode 100644 index 0000000000000..1c803234b7bf5 --- /dev/null +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/ObjectReplicationPolicyInner.java @@ -0,0 +1,132 @@ +/** + * 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.v2019_06_01.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicyRule; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The replication policy between two storage accounts. Multiple rules can be + * defined in one policy. + */ +@JsonFlatten +public class ObjectReplicationPolicyInner extends ProxyResource { + /** + * A unique id for object replication policy. + */ + @JsonProperty(value = "properties.policyId", access = JsonProperty.Access.WRITE_ONLY) + private String policyId; + + /** + * Indicates when the policy is enabled on the source account. + */ + @JsonProperty(value = "properties.enabledTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime enabledTime; + + /** + * Required. Source account name. + */ + @JsonProperty(value = "properties.sourceAccount", required = true) + private String sourceAccount; + + /** + * Required. Destination account name. + */ + @JsonProperty(value = "properties.destinationAccount", required = true) + private String destinationAccount; + + /** + * The storage account object replication rules. + */ + @JsonProperty(value = "properties.rules") + private List rules; + + /** + * Get a unique id for object replication policy. + * + * @return the policyId value + */ + public String policyId() { + return this.policyId; + } + + /** + * Get indicates when the policy is enabled on the source account. + * + * @return the enabledTime value + */ + public DateTime enabledTime() { + return this.enabledTime; + } + + /** + * Get required. Source account name. + * + * @return the sourceAccount value + */ + public String sourceAccount() { + return this.sourceAccount; + } + + /** + * Set required. Source account name. + * + * @param sourceAccount the sourceAccount value to set + * @return the ObjectReplicationPolicyInner object itself. + */ + public ObjectReplicationPolicyInner withSourceAccount(String sourceAccount) { + this.sourceAccount = sourceAccount; + return this; + } + + /** + * Get required. Destination account name. + * + * @return the destinationAccount value + */ + public String destinationAccount() { + return this.destinationAccount; + } + + /** + * Set required. Destination account name. + * + * @param destinationAccount the destinationAccount value to set + * @return the ObjectReplicationPolicyInner object itself. + */ + public ObjectReplicationPolicyInner withDestinationAccount(String destinationAccount) { + this.destinationAccount = destinationAccount; + return this; + } + + /** + * Get the storage account object replication rules. + * + * @return the rules value + */ + public List rules() { + return this.rules; + } + + /** + * Set the storage account object replication rules. + * + * @param rules the rules value to set + * @return the ObjectReplicationPolicyInner object itself. + */ + public ObjectReplicationPolicyInner withRules(List rules) { + this.rules = rules; + return this; + } + +} diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManagementClientImpl.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManagementClientImpl.java index de823744ceee0..518cd6f65496e 100644 --- a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManagementClientImpl.java +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManagementClientImpl.java @@ -225,6 +225,19 @@ public PrivateLinkResourcesInner privateLinkResources() { return this.privateLinkResources; } + /** + * The ObjectReplicationPoliciesInner object to access its operations. + */ + private ObjectReplicationPoliciesInner objectReplicationPolicies; + + /** + * Gets the ObjectReplicationPoliciesInner object to access its operations. + * @return the ObjectReplicationPoliciesInner object. + */ + public ObjectReplicationPoliciesInner objectReplicationPolicies() { + return this.objectReplicationPolicies; + } + /** * The EncryptionScopesInner object to access its operations. */ @@ -332,6 +345,7 @@ protected void initialize() { this.managementPolicies = new ManagementPoliciesInner(restClient().retrofit(), this); this.privateEndpointConnections = new PrivateEndpointConnectionsInner(restClient().retrofit(), this); this.privateLinkResources = new PrivateLinkResourcesInner(restClient().retrofit(), this); + this.objectReplicationPolicies = new ObjectReplicationPoliciesInner(restClient().retrofit(), this); this.encryptionScopes = new EncryptionScopesInner(restClient().retrofit(), this); this.blobServices = new BlobServicesInner(restClient().retrofit(), this); this.blobContainers = new BlobContainersInner(restClient().retrofit(), this); diff --git a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManager.java b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManager.java index b697756ccb6a7..0b8c11bad860b 100644 --- a/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManager.java +++ b/sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/StorageManager.java @@ -23,6 +23,7 @@ import com.microsoft.azure.management.storage.v2019_06_01.ManagementPolicies; import com.microsoft.azure.management.storage.v2019_06_01.PrivateEndpointConnections; import com.microsoft.azure.management.storage.v2019_06_01.PrivateLinkResources; +import com.microsoft.azure.management.storage.v2019_06_01.ObjectReplicationPolicies; import com.microsoft.azure.management.storage.v2019_06_01.EncryptionScopes; import com.microsoft.azure.management.storage.v2019_06_01.BlobServices; import com.microsoft.azure.management.storage.v2019_06_01.BlobContainers; @@ -42,6 +43,7 @@ public final class StorageManager extends ManagerCore