diff --git a/api-specs.json b/api-specs.json index 0ec62dc98a6..e0e60af689d 100644 --- a/api-specs.json +++ b/api-specs.json @@ -23,6 +23,12 @@ "package": "com.microsoft.azure.management.keyvault", "args": "--payload-flattening-threshold=1 --tag=package-2016-10" }, + "arm-keyvault-preview": { + "dir": "azure-mgmt-keyvault-preview", + "source": "specification/keyvault/resource-manager/readme.md", + "package": "com.microsoft.azure.management.keyvault", + "args": "--payload-flattening-threshold=1 --tag=package-2018-02" + }, "automation": { "dir": "azure-mgmt-automation", "source": "specification/automation/resource-manager/readme.md", diff --git a/azure-mgmt-keyvault-preview/pom.xml b/azure-mgmt-keyvault-preview/pom.xml new file mode 100644 index 00000000000..9a19e4e85b5 --- /dev/null +++ b/azure-mgmt-keyvault-preview/pom.xml @@ -0,0 +1,121 @@ + + + 4.0.0 + + com.microsoft.azure + azure-parent + 1.8.1-SNAPSHOT + ../pom.xml + + azure-mgmt-keyvault-preview + jar + Microsoft Azure SDK for KeyVault Management + This package contains Microsoft KeyVault Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-mgmt-resources + 1.8.1-SNAPSHOT + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicies.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicies.java new file mode 100644 index 00000000000..55839e55bde --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicies.java @@ -0,0 +1,29 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.keyvault.implementation.VaultAccessPolicyPropertiesInner; +import com.microsoft.azure.management.keyvault.implementation.VaultsInner; +import rx.Observable; +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; + +public interface AccessPolicies extends HasInner { + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param operationKind Name of the operation. Possible values include: 'add', 'replace', 'remove' + * @param properties Properties of the access policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAccessPolicyAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyPropertiesInner properties); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicyEntry.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicyEntry.java new file mode 100644 index 00000000000..b707731875f --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicyEntry.java @@ -0,0 +1,126 @@ +/** + * 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.keyvault; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An identity that have access to the key vault. All identities in the array + * must use the same tenant ID as the key vault's tenant ID. + */ +public class AccessPolicyEntry { + /** + * The Azure Active Directory tenant ID that should be used for + * authenticating requests to the key vault. + */ + @JsonProperty(value = "tenantId", required = true) + private UUID tenantId; + + /** + * The object ID of a user, service principal or security group in the + * Azure Active Directory tenant for the vault. The object ID must be + * unique for the list of access policies. + */ + @JsonProperty(value = "objectId", required = true) + private String objectId; + + /** + * Application ID of the client making request on behalf of a principal. + */ + @JsonProperty(value = "applicationId") + private UUID applicationId; + + /** + * Permissions the identity has for keys, secrets and certificates. + */ + @JsonProperty(value = "permissions", required = true) + private Permissions permissions; + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the objectId value. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId value. + * + * @param objectId the objectId value to set + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the applicationId value. + * + * @return the applicationId value + */ + public UUID applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId value. + * + * @param applicationId the applicationId value to set + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withApplicationId(UUID applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the permissions value. + * + * @return the permissions value + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions value. + * + * @param permissions the permissions value to set + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicyUpdateKind.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicyUpdateKind.java new file mode 100644 index 00000000000..a4fe2d7deee --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/AccessPolicyUpdateKind.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.keyvault; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AccessPolicyUpdateKind. + */ +public enum AccessPolicyUpdateKind { + /** Enum value add. */ + ADD("add"), + + /** Enum value replace. */ + REPLACE("replace"), + + /** Enum value remove. */ + REMOVE("remove"); + + /** The actual serialized value for a AccessPolicyUpdateKind instance. */ + private String value; + + AccessPolicyUpdateKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessPolicyUpdateKind instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessPolicyUpdateKind object, or null if unable to parse. + */ + @JsonCreator + public static AccessPolicyUpdateKind fromString(String value) { + AccessPolicyUpdateKind[] items = AccessPolicyUpdateKind.values(); + for (AccessPolicyUpdateKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Attributes.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Attributes.java new file mode 100644 index 00000000000..e324a4e2467 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Attributes.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object attributes managed by the KeyVault service. + */ +public class Attributes { + /** + * Determines whether the object is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Not before date in UTC. + */ + @JsonProperty(value = "nbf") + private Long notBefore; + + /** + * Expiry date in UTC. + */ + @JsonProperty(value = "exp") + private Long expires; + + /** + * Creation time in UTC. + */ + @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) + private Long created; + + /** + * Last updated time in UTC. + */ + @JsonProperty(value = "updated", access = JsonProperty.Access.WRITE_ONLY) + private Long updated; + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the Attributes object itself. + */ + public Attributes withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the notBefore value. + * + * @return the notBefore value + */ + public DateTime notBefore() { + if (this.notBefore == null) { + return null; + } + return new DateTime(this.notBefore * 1000L, DateTimeZone.UTC); + } + + /** + * Set the notBefore value. + * + * @param notBefore the notBefore value to set + * @return the Attributes object itself. + */ + public Attributes withNotBefore(DateTime notBefore) { + if (notBefore == null) { + this.notBefore = null; + } else { + this.notBefore = notBefore.toDateTime(DateTimeZone.UTC).getMillis() / 1000; + } + return this; + } + + /** + * Get the expires value. + * + * @return the expires value + */ + public DateTime expires() { + if (this.expires == null) { + return null; + } + return new DateTime(this.expires * 1000L, DateTimeZone.UTC); + } + + /** + * Set the expires value. + * + * @param expires the expires value to set + * @return the Attributes object itself. + */ + public Attributes withExpires(DateTime expires) { + if (expires == null) { + this.expires = null; + } else { + this.expires = expires.toDateTime(DateTimeZone.UTC).getMillis() / 1000; + } + return this; + } + + /** + * Get the created value. + * + * @return the created value + */ + public DateTime created() { + if (this.created == null) { + return null; + } + return new DateTime(this.created * 1000L, DateTimeZone.UTC); + } + + /** + * Get the updated value. + * + * @return the updated value + */ + public DateTime updated() { + if (this.updated == null) { + return null; + } + return new DateTime(this.updated * 1000L, DateTimeZone.UTC); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CertificatePermissions.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CertificatePermissions.java new file mode 100644 index 00000000000..7eece79273c --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CertificatePermissions.java @@ -0,0 +1,77 @@ +/** + * 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.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CertificatePermissions. + */ +public final class CertificatePermissions extends ExpandableStringEnum { + /** Static value get for CertificatePermissions. */ + public static final CertificatePermissions GET = fromString("get"); + + /** Static value list for CertificatePermissions. */ + public static final CertificatePermissions LIST = fromString("list"); + + /** Static value delete for CertificatePermissions. */ + public static final CertificatePermissions DELETE = fromString("delete"); + + /** Static value create for CertificatePermissions. */ + public static final CertificatePermissions CREATE = fromString("create"); + + /** Static value import for CertificatePermissions. */ + public static final CertificatePermissions IMPORT = fromString("import"); + + /** Static value update for CertificatePermissions. */ + public static final CertificatePermissions UPDATE = fromString("update"); + + /** Static value managecontacts for CertificatePermissions. */ + public static final CertificatePermissions MANAGECONTACTS = fromString("managecontacts"); + + /** Static value getissuers for CertificatePermissions. */ + public static final CertificatePermissions GETISSUERS = fromString("getissuers"); + + /** Static value listissuers for CertificatePermissions. */ + public static final CertificatePermissions LISTISSUERS = fromString("listissuers"); + + /** Static value setissuers for CertificatePermissions. */ + public static final CertificatePermissions SETISSUERS = fromString("setissuers"); + + /** Static value deleteissuers for CertificatePermissions. */ + public static final CertificatePermissions DELETEISSUERS = fromString("deleteissuers"); + + /** Static value manageissuers for CertificatePermissions. */ + public static final CertificatePermissions MANAGEISSUERS = fromString("manageissuers"); + + /** Static value recover for CertificatePermissions. */ + public static final CertificatePermissions RECOVER = fromString("recover"); + + /** Static value purge for CertificatePermissions. */ + public static final CertificatePermissions PURGE = fromString("purge"); + + /** + * Creates or finds a CertificatePermissions from its string representation. + * @param name a name to look for + * @return the corresponding CertificatePermissions + */ + @JsonCreator + public static CertificatePermissions fromString(String name) { + return fromString(name, CertificatePermissions.class); + } + + /** + * @return known CertificatePermissions values + */ + public static Collection values() { + return values(CertificatePermissions.class); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CheckNameAvailabilityResult.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CheckNameAvailabilityResult.java new file mode 100644 index 00000000000..f4b110514d9 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CheckNameAvailabilityResult.java @@ -0,0 +1,31 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import com.microsoft.azure.management.keyvault.implementation.CheckNameAvailabilityResultInner; +import com.microsoft.azure.management.keyvault.Reason; + +public interface CheckNameAvailabilityResult extends HasInner { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + Reason reason(); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CreateMode.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CreateMode.java new file mode 100644 index 00000000000..fa0ad208e9d --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/CreateMode.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.keyvault; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CreateMode. + */ +public enum CreateMode { + /** Enum value recover. */ + RECOVER("recover"), + + /** Enum value default. */ + DEFAULT("default"); + + /** The actual serialized value for a CreateMode instance. */ + private String value; + + CreateMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CreateMode instance. + * + * @param value the serialized value to parse. + * @return the parsed CreateMode object, or null if unable to parse. + */ + @JsonCreator + public static CreateMode fromString(String value) { + CreateMode[] items = CreateMode.values(); + for (CreateMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVault.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVault.java new file mode 100644 index 00000000000..dba007d2a9c --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVault.java @@ -0,0 +1,39 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import com.microsoft.azure.management.keyvault.implementation.DeletedVaultInner; +import com.microsoft.azure.management.resources.fluentcore.model.Indexable; +import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasManager; +import com.microsoft.azure.management.keyvault.implementation.KeyVaultManager; + +public interface DeletedVault extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + DeletedVaultProperties properties(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVaultProperties.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVaultProperties.java new file mode 100644 index 00000000000..d2e411f70dd --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVaultProperties.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.keyvault; + +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the deleted vault. + */ +public class DeletedVaultProperties { + /** + * The resource id of the original vault. + */ + @JsonProperty(value = "vaultId", access = JsonProperty.Access.WRITE_ONLY) + private String vaultId; + + /** + * The location of the original vault. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * The deleted date. + */ + @JsonProperty(value = "deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime deletionDate; + + /** + * The scheduled purged date. + */ + @JsonProperty(value = "scheduledPurgeDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime scheduledPurgeDate; + + /** + * Tags of the original vault. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the vaultId value. + * + * @return the vaultId value + */ + public String vaultId() { + return this.vaultId; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the deletionDate value. + * + * @return the deletionDate value + */ + public DateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the scheduledPurgeDate value. + * + * @return the scheduledPurgeDate value + */ + public DateTime scheduledPurgeDate() { + return this.scheduledPurgeDate; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVaults.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVaults.java new file mode 100644 index 00000000000..acce124654a --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/DeletedVaults.java @@ -0,0 +1,37 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.keyvault.implementation.VaultsInner; +import rx.Completable; +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import rx.Observable; + +public interface DeletedVaults extends HasInner { + + /** + * Gets the deleted Azure key vault. + * + * @param vaultName The name of the vault. + * @param location The location of the deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable GetByLocationAsync(String vaultName, String location); + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable purgeDeletedAsync(String vaultName, String location); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/IPRule.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/IPRule.java new file mode 100644 index 00000000000..4897b314ba8 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/IPRule.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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule governing the accesibility of a vault from a specific ip address or + * ip range. + */ +public class IPRule { + /** + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + * IP address) or '124.56.78.0/24' (all addresses that start with + * 124.56.78). + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the IPRule object itself. + */ + public IPRule withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java new file mode 100644 index 00000000000..2651ab4b3d2 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java @@ -0,0 +1,83 @@ +/** + * 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.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for KeyPermissions. + */ +public final class KeyPermissions extends ExpandableStringEnum { + /** Static value encrypt for KeyPermissions. */ + public static final KeyPermissions ENCRYPT = fromString("encrypt"); + + /** Static value decrypt for KeyPermissions. */ + public static final KeyPermissions DECRYPT = fromString("decrypt"); + + /** Static value wrapKey for KeyPermissions. */ + public static final KeyPermissions WRAP_KEY = fromString("wrapKey"); + + /** Static value unwrapKey for KeyPermissions. */ + public static final KeyPermissions UNWRAP_KEY = fromString("unwrapKey"); + + /** Static value sign for KeyPermissions. */ + public static final KeyPermissions SIGN = fromString("sign"); + + /** Static value verify for KeyPermissions. */ + public static final KeyPermissions VERIFY = fromString("verify"); + + /** Static value get for KeyPermissions. */ + public static final KeyPermissions GET = fromString("get"); + + /** Static value list for KeyPermissions. */ + public static final KeyPermissions LIST = fromString("list"); + + /** Static value create for KeyPermissions. */ + public static final KeyPermissions CREATE = fromString("create"); + + /** Static value update for KeyPermissions. */ + public static final KeyPermissions UPDATE = fromString("update"); + + /** Static value import for KeyPermissions. */ + public static final KeyPermissions IMPORT = fromString("import"); + + /** Static value delete for KeyPermissions. */ + public static final KeyPermissions DELETE = fromString("delete"); + + /** Static value backup for KeyPermissions. */ + public static final KeyPermissions BACKUP = fromString("backup"); + + /** Static value restore for KeyPermissions. */ + public static final KeyPermissions RESTORE = fromString("restore"); + + /** Static value recover for KeyPermissions. */ + public static final KeyPermissions RECOVER = fromString("recover"); + + /** Static value purge for KeyPermissions. */ + public static final KeyPermissions PURGE = fromString("purge"); + + /** + * Creates or finds a KeyPermissions from its string representation. + * @param name a name to look for + * @return the corresponding KeyPermissions + */ + @JsonCreator + public static KeyPermissions fromString(String name) { + return fromString(name, KeyPermissions.class); + } + + /** + * @return known KeyPermissions values + */ + public static Collection values() { + return values(KeyPermissions.class); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Locations.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Locations.java new file mode 100644 index 00000000000..865d207b494 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Locations.java @@ -0,0 +1,20 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.keyvault.implementation.VaultsInner; +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; + +public interface Locations extends HasInner { + + /** + * Entry point to manage Location DeletedVaults. + */ + DeletedVaults deletedVaults(); +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/LogSpecification.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/LogSpecification.java new file mode 100644 index 00000000000..37a5f9eaf52 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/LogSpecification.java @@ -0,0 +1,95 @@ +/** + * 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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Log specification of operation. + */ +public class LogSpecification { + /** + * Name of log specification. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display name of log specification. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Blob duration of specification. + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the LogSpecification object itself. + */ + public LogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName value. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName value. + * + * @param displayName the displayName value to set + * @return the LogSpecification object itself. + */ + public LogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the blobDuration value. + * + * @return the blobDuration value + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration value. + * + * @param blobDuration the blobDuration value to set + * @return the LogSpecification object itself. + */ + public LogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleAction.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleAction.java new file mode 100644 index 00000000000..9cec5e041a6 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleAction.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.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleAction. + */ +public final class NetworkRuleAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleAction. */ + public static final NetworkRuleAction ALLOW = fromString("Allow"); + + /** Static value Deny for NetworkRuleAction. */ + public static final NetworkRuleAction DENY = fromString("Deny"); + + /** + * Creates or finds a NetworkRuleAction from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleAction + */ + @JsonCreator + public static NetworkRuleAction fromString(String name) { + return fromString(name, NetworkRuleAction.class); + } + + /** + * @return known NetworkRuleAction values + */ + public static Collection values() { + return values(NetworkRuleAction.class); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleBypassOptions.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleBypassOptions.java new file mode 100644 index 00000000000..618cfb7a6d0 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleBypassOptions.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.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleBypassOptions. + */ +public final class NetworkRuleBypassOptions extends ExpandableStringEnum { + /** Static value AzureServices for NetworkRuleBypassOptions. */ + public static final NetworkRuleBypassOptions AZURE_SERVICES = fromString("AzureServices"); + + /** Static value None for NetworkRuleBypassOptions. */ + public static final NetworkRuleBypassOptions NONE = fromString("None"); + + /** + * Creates or finds a NetworkRuleBypassOptions from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleBypassOptions + */ + @JsonCreator + public static NetworkRuleBypassOptions fromString(String name) { + return fromString(name, NetworkRuleBypassOptions.class); + } + + /** + * @return known NetworkRuleBypassOptions values + */ + public static Collection values() { + return values(NetworkRuleBypassOptions.class); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleSet.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleSet.java new file mode 100644 index 00000000000..fa2482c3214 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleSet.java @@ -0,0 +1,126 @@ +/** + * 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.keyvault; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A set of rules governing the network accessibility of a vault. + */ +public class NetworkRuleSet { + /** + * Tells what traffic can bypass network rules. This can be 'AzureServices' + * or 'None'. If not specified the default is 'AzureServices'. Possible + * values include: 'AzureServices', 'None'. + */ + @JsonProperty(value = "bypass") + private NetworkRuleBypassOptions bypass; + + /** + * The default action when no rule from ipRules and from + * virtualNetworkRules match. This is only used after the bypass property + * has been evaluated. Possible values include: 'Allow', 'Deny'. + */ + @JsonProperty(value = "defaultAction") + private NetworkRuleAction defaultAction; + + /** + * The list of IP address rules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /** + * The list of virtual network rules. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /** + * Get the bypass value. + * + * @return the bypass value + */ + public NetworkRuleBypassOptions bypass() { + return this.bypass; + } + + /** + * Set the bypass value. + * + * @param bypass the bypass value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withBypass(NetworkRuleBypassOptions bypass) { + this.bypass = bypass; + return this; + } + + /** + * Get the defaultAction value. + * + * @return the defaultAction value + */ + public NetworkRuleAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction value. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withDefaultAction(NetworkRuleAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the ipRules value. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules value. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the virtualNetworkRules value. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules value. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Operation.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Operation.java new file mode 100644 index 00000000000..a63c2a5cf97 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Operation.java @@ -0,0 +1,35 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import com.microsoft.azure.management.keyvault.implementation.OperationInner; + +public interface Operation extends HasInner { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the serviceSpecification value. + */ + ServiceSpecification serviceSpecification(); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/OperationDisplay.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/OperationDisplay.java new file mode 100644 index 00000000000..675573d8ff2 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * 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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft Key Vault. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Decription of operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation value. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Operations.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Operations.java new file mode 100644 index 00000000000..d4e98c64b2c --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Operations.java @@ -0,0 +1,24 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.keyvault.implementation.OperationsInner; +import rx.Observable; +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; + +public interface Operations extends HasInner { + /** + * Lists all of the available Key Vault Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Permissions.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Permissions.java new file mode 100644 index 00000000000..34380b2eb62 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Permissions.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.keyvault; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Permissions the identity has for keys, secrets, certificates and storage. + */ +public class Permissions { + /** + * Permissions to keys. + */ + @JsonProperty(value = "keys") + private List keys; + + /** + * Permissions to secrets. + */ + @JsonProperty(value = "secrets") + private List secrets; + + /** + * Permissions to certificates. + */ + @JsonProperty(value = "certificates") + private List certificates; + + /** + * Permissions to storage accounts. + */ + @JsonProperty(value = "storage") + private List storage; + + /** + * Get the keys value. + * + * @return the keys value + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys value. + * + * @param keys the keys value to set + * @return the Permissions object itself. + */ + public Permissions withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Get the secrets value. + * + * @return the secrets value + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets value. + * + * @param secrets the secrets value to set + * @return the Permissions object itself. + */ + public Permissions withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Get the certificates value. + * + * @return the certificates value + */ + public List certificates() { + return this.certificates; + } + + /** + * Set the certificates value. + * + * @param certificates the certificates value to set + * @return the Permissions object itself. + */ + public Permissions withCertificates(List certificates) { + this.certificates = certificates; + return this; + } + + /** + * Get the storage value. + * + * @return the storage value + */ + public List storage() { + return this.storage; + } + + /** + * Set the storage value. + * + * @param storage the storage value to set + * @return the Permissions object itself. + */ + public Permissions withStorage(List storage) { + this.storage = storage; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Reason.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Reason.java new file mode 100644 index 00000000000..6b190a3ecfe --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Reason.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.keyvault; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Reason. + */ +public enum Reason { + /** Enum value AccountNameInvalid. */ + ACCOUNT_NAME_INVALID("AccountNameInvalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a Reason instance. */ + private String value; + + Reason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Reason instance. + * + * @param value the serialized value to parse. + * @return the parsed Reason object, or null if unable to parse. + */ + @JsonCreator + public static Reason fromString(String value) { + Reason[] items = Reason.values(); + for (Reason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Secret.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Secret.java new file mode 100644 index 00000000000..d196e104c7b --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Secret.java @@ -0,0 +1,139 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import com.microsoft.azure.management.keyvault.implementation.SecretInner; +import com.microsoft.azure.management.resources.fluentcore.model.Indexable; +import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; +import com.microsoft.azure.management.resources.fluentcore.model.Updatable; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasManager; +import com.microsoft.azure.management.keyvault.implementation.KeyVaultManager; +import java.util.Map; + +public interface Secret extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + SecretProperties properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Secret definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithVault, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of Secret definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Secret definition. + */ + interface Blank extends WithVault + { + } + + /** + * The stage of the definition allowing to specify Vault. + */ + interface WithVault { + /** + * Specifies resourceGroupName, vaultName. + */ + WithProperties withExistingVault(String resourceGroupName, String vaultName); + } + + /** + * The stage of the definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + */ + WithCreate withProperties(SecretProperties properties); + } + + /** + * The stage of the update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * 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.WithTags { + } + } + /** + * The template for a Secret update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithProperties, UpdateStages.WithTags { + } + + /** + * Grouping of Secret update stages. + */ + interface UpdateStages { + /** + * The stage of the {0} allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + */ + Update withProperties(SecretPatchProperties properties); + } + + /** + * The stage of the {0} allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretAttributes.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretAttributes.java new file mode 100644 index 00000000000..d59a614028d --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretAttributes.java @@ -0,0 +1,16 @@ +/** + * 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.keyvault; + + +/** + * The secret management attributes. + */ +public class SecretAttributes extends Attributes { +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretPatchProperties.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretPatchProperties.java new file mode 100644 index 00000000000..47efb3774fa --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretPatchProperties.java @@ -0,0 +1,95 @@ +/** + * 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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the secret. + */ +public class SecretPatchProperties { + /** + * The value of the secret. + */ + @JsonProperty(value = "value") + private String value; + + /** + * The content type of the secret. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /** + * The attributes of the secret. + */ + @JsonProperty(value = "attributes") + private SecretAttributes attributes; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the SecretPatchProperties object itself. + */ + public SecretPatchProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the contentType value. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType value. + * + * @param contentType the contentType value to set + * @return the SecretPatchProperties object itself. + */ + public SecretPatchProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the attributes value. + * + * @return the attributes value + */ + public SecretAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes value. + * + * @param attributes the attributes value to set + * @return the SecretPatchProperties object itself. + */ + public SecretPatchProperties withAttributes(SecretAttributes attributes) { + this.attributes = attributes; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretPermissions.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretPermissions.java new file mode 100644 index 00000000000..3d436d3b3f5 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretPermissions.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SecretPermissions. + */ +public final class SecretPermissions extends ExpandableStringEnum { + /** Static value get for SecretPermissions. */ + public static final SecretPermissions GET = fromString("get"); + + /** Static value list for SecretPermissions. */ + public static final SecretPermissions LIST = fromString("list"); + + /** Static value set for SecretPermissions. */ + public static final SecretPermissions SET = fromString("set"); + + /** Static value delete for SecretPermissions. */ + public static final SecretPermissions DELETE = fromString("delete"); + + /** Static value backup for SecretPermissions. */ + public static final SecretPermissions BACKUP = fromString("backup"); + + /** Static value restore for SecretPermissions. */ + public static final SecretPermissions RESTORE = fromString("restore"); + + /** Static value recover for SecretPermissions. */ + public static final SecretPermissions RECOVER = fromString("recover"); + + /** Static value purge for SecretPermissions. */ + public static final SecretPermissions PURGE = fromString("purge"); + + /** + * Creates or finds a SecretPermissions from its string representation. + * @param name a name to look for + * @return the corresponding SecretPermissions + */ + @JsonCreator + public static SecretPermissions fromString(String name) { + return fromString(name, SecretPermissions.class); + } + + /** + * @return known SecretPermissions values + */ + public static Collection values() { + return values(SecretPermissions.class); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretProperties.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretProperties.java new file mode 100644 index 00000000000..1f98306c185 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SecretProperties.java @@ -0,0 +1,128 @@ +/** + * 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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the secret. + */ +public class SecretProperties { + /** + * The value of the secret. NOTE: 'value' will never be returned from the + * service, as APIs using this model are is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for + * interaction with vault secrets. + */ + @JsonProperty(value = "value") + private String value; + + /** + * The content type of the secret. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /** + * The attributes of the secret. + */ + @JsonProperty(value = "attributes") + private SecretAttributes attributes; + + /** + * The URI to retrieve the current version of the secret. + */ + @JsonProperty(value = "secretUri", access = JsonProperty.Access.WRITE_ONLY) + private String secretUri; + + /** + * The URI to retrieve the specific version of the secret. + */ + @JsonProperty(value = "secretUriWithVersion", access = JsonProperty.Access.WRITE_ONLY) + private String secretUriWithVersion; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the SecretProperties object itself. + */ + public SecretProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the contentType value. + * + * @return the contentType value + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType value. + * + * @param contentType the contentType value to set + * @return the SecretProperties object itself. + */ + public SecretProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the attributes value. + * + * @return the attributes value + */ + public SecretAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes value. + * + * @param attributes the attributes value to set + * @return the SecretProperties object itself. + */ + public SecretProperties withAttributes(SecretAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get the secretUri value. + * + * @return the secretUri value + */ + public String secretUri() { + return this.secretUri; + } + + /** + * Get the secretUriWithVersion value. + * + * @return the secretUriWithVersion value + */ + public String secretUriWithVersion() { + return this.secretUriWithVersion; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Secrets.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Secrets.java new file mode 100644 index 00000000000..cb6dc65f4f3 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Secrets.java @@ -0,0 +1,38 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.keyvault.implementation.SecretsInner; +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import rx.Observable; + +public interface Secrets extends SupportsCreating, HasInner { + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable ListByVaultAsync(final String resourceGroupName, final String vaultName); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable GetByVaultAsync(String resourceGroupName, String vaultName, String secretName); +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/ServiceSpecification.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/ServiceSpecification.java new file mode 100644 index 00000000000..4fd419c6307 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/ServiceSpecification.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.keyvault; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * One property of operation, include log specifications. + */ +public class ServiceSpecification { + /** + * Log specifications of operation. + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /** + * Get the logSpecifications value. + * + * @return the logSpecifications value + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set the logSpecifications value. + * + * @param logSpecifications the logSpecifications value to set + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withLogSpecifications(List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Sku.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Sku.java new file mode 100644 index 00000000000..b1504e86ddd --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Sku.java @@ -0,0 +1,77 @@ +/** + * 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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU details. + */ +public class Sku { + /** + * SKU family name. + */ + @JsonProperty(value = "family", required = true) + private String family; + + /** + * SKU name to specify whether the key vault is a standard vault or a + * premium vault. Possible values include: 'standard', 'premium'. + */ + @JsonProperty(value = "name", required = true) + private SkuName name; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + family = "A"; + } + + /** + * Get the family value. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set the family value. + * + * @param family the family value to set + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SkuName.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SkuName.java new file mode 100644 index 00000000000..d31ee025f56 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/SkuName.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.keyvault; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuName. + */ +public enum SkuName { + /** Enum value standard. */ + STANDARD("standard"), + + /** Enum value premium. */ + PREMIUM("premium"); + + /** The actual serialized value for a SkuName instance. */ + private String value; + + SkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuName object, or null if unable to parse. + */ + @JsonCreator + public static SkuName fromString(String value) { + SkuName[] items = SkuName.values(); + for (SkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java new file mode 100644 index 00000000000..f0f1c5be173 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java @@ -0,0 +1,77 @@ +/** + * 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.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StoragePermissions. + */ +public final class StoragePermissions extends ExpandableStringEnum { + /** Static value get for StoragePermissions. */ + public static final StoragePermissions GET = fromString("get"); + + /** Static value list for StoragePermissions. */ + public static final StoragePermissions LIST = fromString("list"); + + /** Static value delete for StoragePermissions. */ + public static final StoragePermissions DELETE = fromString("delete"); + + /** Static value set for StoragePermissions. */ + public static final StoragePermissions SET = fromString("set"); + + /** Static value update for StoragePermissions. */ + public static final StoragePermissions UPDATE = fromString("update"); + + /** Static value regeneratekey for StoragePermissions. */ + public static final StoragePermissions REGENERATEKEY = fromString("regeneratekey"); + + /** Static value recover for StoragePermissions. */ + public static final StoragePermissions RECOVER = fromString("recover"); + + /** Static value purge for StoragePermissions. */ + public static final StoragePermissions PURGE = fromString("purge"); + + /** Static value backup for StoragePermissions. */ + public static final StoragePermissions BACKUP = fromString("backup"); + + /** Static value restore for StoragePermissions. */ + public static final StoragePermissions RESTORE = fromString("restore"); + + /** Static value setsas for StoragePermissions. */ + public static final StoragePermissions SETSAS = fromString("setsas"); + + /** Static value listsas for StoragePermissions. */ + public static final StoragePermissions LISTSAS = fromString("listsas"); + + /** Static value getsas for StoragePermissions. */ + public static final StoragePermissions GETSAS = fromString("getsas"); + + /** Static value deletesas for StoragePermissions. */ + public static final StoragePermissions DELETESAS = fromString("deletesas"); + + /** + * Creates or finds a StoragePermissions from its string representation. + * @param name a name to look for + * @return the corresponding StoragePermissions + */ + @JsonCreator + public static StoragePermissions fromString(String name) { + return fromString(name, StoragePermissions.class); + } + + /** + * @return known StoragePermissions values + */ + public static Collection values() { + return values(StoragePermissions.class); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Vault.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Vault.java new file mode 100644 index 00000000000..0ea5aba48ab --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Vault.java @@ -0,0 +1,92 @@ +/** + * 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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource; +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasResourceGroup; +import com.microsoft.azure.management.resources.fluentcore.model.Refreshable; +import com.microsoft.azure.management.resources.fluentcore.model.Updatable; +import com.microsoft.azure.management.resources.fluentcore.model.Appliable; +import com.microsoft.azure.management.resources.fluentcore.model.Creatable; +import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource; +import com.microsoft.azure.management.resources.fluentcore.arm.models.HasManager; +import com.microsoft.azure.management.keyvault.implementation.KeyVaultManager; +import com.microsoft.azure.management.keyvault.implementation.VaultInner; + +public interface Vault extends GroupableResource, HasInner, Resource, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the properties value. + */ + VaultProperties properties(); + + /** + * The entirety of the Vault definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of Vault definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Vault definition. + */ + interface Blank extends GroupableResource.DefinitionWithRegion + { + } + + /** + * The stage of the Vault definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResource.DefinitionStages.WithGroup + { + } + + /** + * The stage of the Vault definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + */ + WithCreate withProperties(VaultProperties properties); + } + + /** + * 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, Resource.DefinitionWithTags { + } + } + /** + * The template for a Vault update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithProperties { + } + + /** + * Grouping of Vault update stages. + */ + interface UpdateStages { + /** + * The stage of the Vault {0} allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + */ + Update withProperties(VaultPatchProperties properties); + } + + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultAccessPolicyParameters.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultAccessPolicyParameters.java new file mode 100644 index 00000000000..49dc393d82a --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultAccessPolicyParameters.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.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; +import com.microsoft.azure.management.keyvault.implementation.VaultAccessPolicyParametersInner; +import com.microsoft.azure.management.keyvault.implementation.VaultAccessPolicyPropertiesInner; + +public interface VaultAccessPolicyParameters extends HasInner { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + VaultAccessPolicyPropertiesInner properties(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultCheckNameAvailabilityParameters.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultCheckNameAvailabilityParameters.java new file mode 100644 index 00000000000..c6c2abc1f35 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultCheckNameAvailabilityParameters.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters used to check the availabity of the vault name. + */ +public class VaultCheckNameAvailabilityParameters { + /** + * The vault name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource, Microsoft.KeyVault/vaults. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of VaultCheckNameAvailabilityParameters class. + */ + public VaultCheckNameAvailabilityParameters() { + type = "Microsoft.KeyVault/vaults"; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the VaultCheckNameAvailabilityParameters object itself. + */ + public VaultCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the VaultCheckNameAvailabilityParameters object itself. + */ + public VaultCheckNameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultPatchProperties.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultPatchProperties.java new file mode 100644 index 00000000000..229f77e3235 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultPatchProperties.java @@ -0,0 +1,293 @@ +/** + * 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.keyvault; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the vault. + */ +public class VaultPatchProperties { + /** + * The Azure Active Directory tenant ID that should be used for + * authenticating requests to the key vault. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /** + * SKU details. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * An array of 0 to 16 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's + * tenant ID. + */ + @JsonProperty(value = "accessPolicies") + private List accessPolicies; + + /** + * Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + */ + @JsonProperty(value = "enabledForDeployment") + private Boolean enabledForDeployment; + + /** + * Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + */ + @JsonProperty(value = "enabledForDiskEncryption") + private Boolean enabledForDiskEncryption; + + /** + * Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + */ + @JsonProperty(value = "enabledForTemplateDeployment") + private Boolean enabledForTemplateDeployment; + + /** + * Property to specify whether the 'soft delete' functionality is enabled + * for this key vault. It does not accept false value. + */ + @JsonProperty(value = "enableSoftDelete") + private Boolean enableSoftDelete; + + /** + * The vault's create mode to indicate whether the vault need to be + * recovered or not. Possible values include: 'recover', 'default'. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /** + * Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge + * for this vault and its content - only the Key Vault service may initiate + * a hard, irrecoverable deletion. The setting is effective only if soft + * delete is also enabled. Enabling this functionality is irreversible - + * that is, the property does not accept false as its value. + */ + @JsonProperty(value = "enablePurgeProtection") + private Boolean enablePurgeProtection; + + /** + * A collection of rules governing the accessibility of the vault from + * specific network locations. + */ + @JsonProperty(value = "networkAcls") + private NetworkRuleSet networkAcls; + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the accessPolicies value. + * + * @return the accessPolicies value + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies value. + * + * @param accessPolicies the accessPolicies value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + + /** + * Get the enabledForDeployment value. + * + * @return the enabledForDeployment value + */ + public Boolean enabledForDeployment() { + return this.enabledForDeployment; + } + + /** + * Set the enabledForDeployment value. + * + * @param enabledForDeployment the enabledForDeployment value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnabledForDeployment(Boolean enabledForDeployment) { + this.enabledForDeployment = enabledForDeployment; + return this; + } + + /** + * Get the enabledForDiskEncryption value. + * + * @return the enabledForDiskEncryption value + */ + public Boolean enabledForDiskEncryption() { + return this.enabledForDiskEncryption; + } + + /** + * Set the enabledForDiskEncryption value. + * + * @param enabledForDiskEncryption the enabledForDiskEncryption value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnabledForDiskEncryption(Boolean enabledForDiskEncryption) { + this.enabledForDiskEncryption = enabledForDiskEncryption; + return this; + } + + /** + * Get the enabledForTemplateDeployment value. + * + * @return the enabledForTemplateDeployment value + */ + public Boolean enabledForTemplateDeployment() { + return this.enabledForTemplateDeployment; + } + + /** + * Set the enabledForTemplateDeployment value. + * + * @param enabledForTemplateDeployment the enabledForTemplateDeployment value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment) { + this.enabledForTemplateDeployment = enabledForTemplateDeployment; + return this; + } + + /** + * Get the enableSoftDelete value. + * + * @return the enableSoftDelete value + */ + public Boolean enableSoftDelete() { + return this.enableSoftDelete; + } + + /** + * Set the enableSoftDelete value. + * + * @param enableSoftDelete the enableSoftDelete value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnableSoftDelete(Boolean enableSoftDelete) { + this.enableSoftDelete = enableSoftDelete; + return this; + } + + /** + * Get the createMode value. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode value. + * + * @param createMode the createMode value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the enablePurgeProtection value. + * + * @return the enablePurgeProtection value + */ + public Boolean enablePurgeProtection() { + return this.enablePurgeProtection; + } + + /** + * Set the enablePurgeProtection value. + * + * @param enablePurgeProtection the enablePurgeProtection value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.enablePurgeProtection = enablePurgeProtection; + return this; + } + + /** + * Get the networkAcls value. + * + * @return the networkAcls value + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls value. + * + * @param networkAcls the networkAcls value to set + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultProperties.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultProperties.java new file mode 100644 index 00000000000..74eb887189d --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VaultProperties.java @@ -0,0 +1,319 @@ +/** + * 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.keyvault; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the vault. + */ +public class VaultProperties { + /** + * The Azure Active Directory tenant ID that should be used for + * authenticating requests to the key vault. + */ + @JsonProperty(value = "tenantId", required = true) + private UUID tenantId; + + /** + * SKU details. + */ + @JsonProperty(value = "sku", required = true) + private Sku sku; + + /** + * An array of 0 to 16 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's + * tenant ID. + */ + @JsonProperty(value = "accessPolicies") + private List accessPolicies; + + /** + * The URI of the vault for performing operations on keys and secrets. + */ + @JsonProperty(value = "vaultUri") + private String vaultUri; + + /** + * Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + */ + @JsonProperty(value = "enabledForDeployment") + private Boolean enabledForDeployment; + + /** + * Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + */ + @JsonProperty(value = "enabledForDiskEncryption") + private Boolean enabledForDiskEncryption; + + /** + * Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + */ + @JsonProperty(value = "enabledForTemplateDeployment") + private Boolean enabledForTemplateDeployment; + + /** + * Property to specify whether the 'soft delete' functionality is enabled + * for this key vault. It does not accept false value. + */ + @JsonProperty(value = "enableSoftDelete") + private Boolean enableSoftDelete; + + /** + * The vault's create mode to indicate whether the vault need to be + * recovered or not. Possible values include: 'recover', 'default'. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /** + * Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge + * for this vault and its content - only the Key Vault service may initiate + * a hard, irrecoverable deletion. The setting is effective only if soft + * delete is also enabled. Enabling this functionality is irreversible - + * that is, the property does not accept false as its value. + */ + @JsonProperty(value = "enablePurgeProtection") + private Boolean enablePurgeProtection; + + /** + * A collection of rules governing the accessibility of the vault from + * specific network locations. + */ + @JsonProperty(value = "networkAcls") + private NetworkRuleSet networkAcls; + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the accessPolicies value. + * + * @return the accessPolicies value + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies value. + * + * @param accessPolicies the accessPolicies value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + + /** + * Get the vaultUri value. + * + * @return the vaultUri value + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set the vaultUri value. + * + * @param vaultUri the vaultUri value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get the enabledForDeployment value. + * + * @return the enabledForDeployment value + */ + public Boolean enabledForDeployment() { + return this.enabledForDeployment; + } + + /** + * Set the enabledForDeployment value. + * + * @param enabledForDeployment the enabledForDeployment value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withEnabledForDeployment(Boolean enabledForDeployment) { + this.enabledForDeployment = enabledForDeployment; + return this; + } + + /** + * Get the enabledForDiskEncryption value. + * + * @return the enabledForDiskEncryption value + */ + public Boolean enabledForDiskEncryption() { + return this.enabledForDiskEncryption; + } + + /** + * Set the enabledForDiskEncryption value. + * + * @param enabledForDiskEncryption the enabledForDiskEncryption value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withEnabledForDiskEncryption(Boolean enabledForDiskEncryption) { + this.enabledForDiskEncryption = enabledForDiskEncryption; + return this; + } + + /** + * Get the enabledForTemplateDeployment value. + * + * @return the enabledForTemplateDeployment value + */ + public Boolean enabledForTemplateDeployment() { + return this.enabledForTemplateDeployment; + } + + /** + * Set the enabledForTemplateDeployment value. + * + * @param enabledForTemplateDeployment the enabledForTemplateDeployment value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment) { + this.enabledForTemplateDeployment = enabledForTemplateDeployment; + return this; + } + + /** + * Get the enableSoftDelete value. + * + * @return the enableSoftDelete value + */ + public Boolean enableSoftDelete() { + return this.enableSoftDelete; + } + + /** + * Set the enableSoftDelete value. + * + * @param enableSoftDelete the enableSoftDelete value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withEnableSoftDelete(Boolean enableSoftDelete) { + this.enableSoftDelete = enableSoftDelete; + return this; + } + + /** + * Get the createMode value. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode value. + * + * @param createMode the createMode value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the enablePurgeProtection value. + * + * @return the enablePurgeProtection value + */ + public Boolean enablePurgeProtection() { + return this.enablePurgeProtection; + } + + /** + * Set the enablePurgeProtection value. + * + * @param enablePurgeProtection the enablePurgeProtection value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.enablePurgeProtection = enablePurgeProtection; + return this; + } + + /** + * Get the networkAcls value. + * + * @return the networkAcls value + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls value. + * + * @param networkAcls the networkAcls value to set + * @return the VaultProperties object itself. + */ + public VaultProperties withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Vaults.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Vaults.java new file mode 100644 index 00000000000..53e8b196029 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/Vaults.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsBatchDeletion; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByResourceGroup; +import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; +import com.microsoft.azure.management.keyvault.implementation.VaultsInner; +import rx.Observable; +import com.microsoft.azure.management.resources.fluentcore.model.HasInner; + +public interface Vaults extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + + /** + * Entry point to manage Vault AccessPolicies. + */ + AccessPolicies accessPolicies(); + + /** + * Entry point to manage Vault Secrets. + */ + Secrets secrets(); + /** + * Gets information about the deleted vaults in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listDeletedAsync(); + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param name The vault name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VirtualNetworkRule.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VirtualNetworkRule.java new file mode 100644 index 00000000000..14123939478 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/VirtualNetworkRule.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.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule governing the accesibility of a vault from a specific virtual + * network. + */ +public class VirtualNetworkRule { + /** + * Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPoliciesImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPoliciesImpl.java new file mode 100644 index 00000000000..1ac0d29124b --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/AccessPoliciesImpl.java @@ -0,0 +1,42 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.AccessPolicyUpdateKind; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.AccessPolicies; +import com.microsoft.azure.management.keyvault.VaultAccessPolicyParameters; +import rx.Observable; +import rx.functions.Func1; + +public class AccessPoliciesImpl extends WrapperImpl implements AccessPolicies { + private final KeyVaultManager manager; + + AccessPoliciesImpl(KeyVaultManager manager) { + super(manager.inner().vaults()); + this.manager = manager; + } + + public KeyVaultManager manager() { + return this.manager; + } + + @Override + public Observable updateAccessPolicyAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyPropertiesInner properties) { + VaultsInner client = this.inner(); + return client.updateAccessPolicyAsync(resourceGroupName, vaultName, operationKind, properties) + .map(new Func1() { + @Override + public VaultAccessPolicyParameters call(VaultAccessPolicyParametersInner inner) { + return new VaultAccessPolicyParametersImpl(inner); + } + }); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/CheckNameAvailabilityResultImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 00000000000..103bb18a2f9 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.CheckNameAvailabilityResult; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.Reason; + +class CheckNameAvailabilityResultImpl extends WrapperImpl implements CheckNameAvailabilityResult { + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner inner) { + super(inner); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public Reason reason() { + return this.inner().reason(); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/CheckNameAvailabilityResultInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/CheckNameAvailabilityResultInner.java new file mode 100644 index 00000000000..87f8177c8da --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/CheckNameAvailabilityResultInner.java @@ -0,0 +1,67 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.Reason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The CheckNameAvailability operation response. + */ +public class CheckNameAvailabilityResultInner { + /** + * A boolean value that indicates whether the name is available for you to + * use. If true, the name is available. If false, the name has already been + * taken or is invalid and cannot be used. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /** + * The reason that a vault name could not be used. The Reason element is + * only returned if NameAvailable is false. Possible values include: + * 'AccountNameInvalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private Reason reason; + + /** + * An error message explaining the Reason value in more detail. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable value. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason value. + * + * @return the reason value + */ + public Reason reason() { + return this.reason; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultImpl.java new file mode 100644 index 00000000000..377f971208f --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultImpl.java @@ -0,0 +1,104 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.DeletedVault; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.IndexableRefreshableWrapperImpl; +import java.util.Arrays; +import java.util.Iterator; +import rx.Observable; +import com.microsoft.azure.management.keyvault.DeletedVaultProperties; + +class DeletedVaultImpl extends IndexableRefreshableWrapperImpl implements DeletedVault { + private final KeyVaultManager manager; + private String vaultName; + private String location; + DeletedVaultImpl(DeletedVaultInner inner, KeyVaultManager manager) { + super(null, inner); + this.manager = manager; + this.vaultName = GetValueFromIdByName(inner.id(), "deletedVaults"); + this.location = GetValueFromIdByName(inner.id(), "locations"); + } + + @Override + public KeyVaultManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + VaultsInner client = this.manager.inner().vaults(); + return client.getDeletedAsync(this.vaultName, this.location); + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DeletedVaultProperties properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + + private static String GetValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + private static String GetValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultInner.java new file mode 100644 index 00000000000..4c7c51da1e6 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultInner.java @@ -0,0 +1,89 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.DeletedVaultProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Deleted vault information with extended details. + */ +public class DeletedVaultInner { + /** + * The resource ID for the deleted key vault. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the key vault. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource type of the key vault. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Properties of the vault. + */ + @JsonProperty(value = "properties") + private DeletedVaultProperties properties; + + /** + * 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; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public DeletedVaultProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the DeletedVaultInner object itself. + */ + public DeletedVaultInner withProperties(DeletedVaultProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultsImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultsImpl.java new file mode 100644 index 00000000000..b9a3106e122 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/DeletedVaultsImpl.java @@ -0,0 +1,52 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.DeletedVaults; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.keyvault.DeletedVault; + +public class DeletedVaultsImpl extends WrapperImpl implements DeletedVaults { + private final KeyVaultManager manager; + + DeletedVaultsImpl(KeyVaultManager manager) { + super(manager.inner().vaults()); + this.manager = manager; + } + + public KeyVaultManager manager() { + return this.manager; + } + + private DeletedVaultImpl wrapModel(DeletedVaultInner inner) { + return new DeletedVaultImpl(inner, this.manager()); + } + + @Override + public Completable purgeDeletedAsync(String vaultName, String location) { + VaultsInner client = this.inner(); + return client.purgeDeletedAsync(vaultName, location).toCompletable(); + } + + @Override + public Observable GetByLocationAsync(String vaultName, String location) { + VaultsInner client = this.inner(); + return client.getDeletedAsync(vaultName, location) + .map(new Func1() { + @Override + public DeletedVault call(DeletedVaultInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManagementClientImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManagementClientImpl.java new file mode 100644 index 00000000000..c1184c2e4d2 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManagementClientImpl.java @@ -0,0 +1,224 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the KeyVaultManagementClientImpl class. + */ +public class KeyVaultManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public KeyVaultManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public KeyVaultManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public KeyVaultManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public KeyVaultManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The VaultsInner object to access its operations. + */ + private VaultsInner vaults; + + /** + * Gets the VaultsInner object to access its operations. + * @return the VaultsInner object. + */ + public VaultsInner vaults() { + return this.vaults; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SecretsInner object to access its operations. + */ + private SecretsInner secrets; + + /** + * Gets the SecretsInner object to access its operations. + * @return the SecretsInner object. + */ + public SecretsInner secrets() { + return this.secrets; + } + + /** + * Initializes an instance of KeyVaultManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public KeyVaultManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of KeyVaultManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public KeyVaultManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of KeyVaultManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public KeyVaultManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-02-14-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.vaults = new VaultsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.secrets = new SecretsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "KeyVaultManagementClient", "2018-02-14-preview"); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java new file mode 100644 index 00000000000..050fcd495e3 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/KeyVaultManager.java @@ -0,0 +1,144 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable; +import com.microsoft.azure.management.resources.fluentcore.arm.implementation.AzureConfigurableImpl; +import com.microsoft.azure.management.resources.fluentcore.arm.implementation.Manager; +import com.microsoft.azure.management.resources.fluentcore.utils.ProviderRegistrationInterceptor; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.keyvault.DeletedVaults; +import com.microsoft.azure.management.keyvault.Secrets; +import com.microsoft.azure.management.keyvault.AccessPolicies; +import com.microsoft.azure.management.keyvault.Locations; +import com.microsoft.azure.management.keyvault.Operations; +import com.microsoft.azure.management.keyvault.Vaults; + +/** + * Entry point to Azure KeyVault resource management. + */ +@Beta(SinceVersion.V1_2_0) +public final class KeyVaultManager extends Manager { + private DeletedVaults deletedVaults; + private Secrets secrets; + private AccessPolicies accessPolicies; + private Locations locations; + private Operations operations; + private Vaults vaults; + /** + * Get a Configurable instance that can be used to create KeyVaultManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new KeyVaultManager.ConfigurableImpl(); + } + /** + * Creates an instance of KeyVaultManager that exposes KeyVault resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the KeyVaultManager + */ + public static KeyVaultManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new KeyVaultManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .withInterceptor(new ProviderRegistrationInterceptor(credentials)) + .build(), subscriptionId); + } + /** + * Creates an instance of KeyVaultManager that exposes KeyVault resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the KeyVaultManager + */ + public static KeyVaultManager authenticate(RestClient restClient, String subscriptionId) { + return new KeyVaultManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of KeyVaultManager that exposes KeyVault management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing KeyVault management API entry points that work across subscriptions + */ + KeyVaultManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + public DeletedVaults deletedVaults() { + if (this.deletedVaults == null) { + this.deletedVaults = new DeletedVaultsImpl(this); + } + return this.deletedVaults; + } + + public Secrets secrets() { + if (this.secrets == null) { + this.secrets = new SecretsImpl(this); + } + return this.secrets; + } + + public AccessPolicies accessPolicies() { + if (this.accessPolicies == null) { + this.accessPolicies = new AccessPoliciesImpl(this); + } + return this.accessPolicies; + } + + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(this); + } + return this.locations; + } + + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + public Vaults vaults() { + if (this.vaults == null) { + this.vaults = new VaultsImpl(this); + } + return this.vaults; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableImpl implements Configurable { + public KeyVaultManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return KeyVaultManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private KeyVaultManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new KeyVaultManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/LocationsImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/LocationsImpl.java new file mode 100644 index 00000000000..0b9d72ea636 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/LocationsImpl.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.keyvault.implementation; + +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.Locations; +import com.microsoft.azure.management.keyvault.DeletedVaults; + +public class LocationsImpl extends WrapperImpl implements Locations { + private final KeyVaultManager manager; + + LocationsImpl(KeyVaultManager manager) { + super(manager.inner().vaults()); + this.manager = manager; + } + + @Override + public DeletedVaults deletedVaults() { + DeletedVaults accessor = this.manager().deletedVaults(); + return accessor; + } + + public KeyVaultManager manager() { + return this.manager; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationImpl.java new file mode 100644 index 00000000000..50a7f6270f8 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationImpl.java @@ -0,0 +1,42 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.Operation; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.OperationDisplay; +import com.microsoft.azure.management.keyvault.ServiceSpecification; + +class OperationImpl extends WrapperImpl implements Operation { + + OperationImpl(OperationInner inner) { + super(inner); + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public ServiceSpecification serviceSpecification() { + return this.inner().serviceSpecification(); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationInner.java new file mode 100644 index 00000000000..c06d26512b4 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationInner.java @@ -0,0 +1,125 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.OperationDisplay; +import com.microsoft.azure.management.keyvault.ServiceSpecification; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Key Vault REST API operation definition. + */ +@JsonFlatten +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * The origin of operations. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * One property of operation, include metric specifications. + */ + @JsonProperty(value = "properties.serviceSpecification") + private ServiceSpecification serviceSpecification; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin value. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin value. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the serviceSpecification value. + * + * @return the serviceSpecification value + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification value. + * + * @param serviceSpecification the serviceSpecification value to set + * @return the OperationInner object itself. + */ + public OperationInner withServiceSpecification(ServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationsImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationsImpl.java new file mode 100644 index 00000000000..c56fcb68a8c --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationsImpl.java @@ -0,0 +1,67 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.Operations; +import com.microsoft.azure.management.keyvault.Operation; +import rx.Observable; +import rx.functions.Func1; + +public class OperationsImpl extends WrapperImpl implements Operations { + private final KeyVaultManager manager; + + OperationsImpl(KeyVaultManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public KeyVaultManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return ListNextInnerPageAsync(page.nextPageLink()); + } + }) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner); + } + }); + } + + private Observable> ListNextInnerPageAsync(String nextLink) { + if (nextLink == null) { + Observable.empty(); + } + OperationsInner client = this.inner(); + return client.listNextAsync(nextLink) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return Observable.just(page).concatWith(ListNextInnerPageAsync(page.nextPageLink())); + } + }); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationsInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationsInner.java new file mode 100644 index 00000000000..d5c94696285 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private KeyVaultManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, KeyVaultManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Operations list" }) + @GET("providers/Microsoft.KeyVault/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Key Vault Rest API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/PageImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/PageImpl.java new file mode 100644 index 00000000000..c2a22e98a7a --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretCreateOrUpdateParametersInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretCreateOrUpdateParametersInner.java new file mode 100644 index 00000000000..4683b5e4b06 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretCreateOrUpdateParametersInner.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.keyvault.implementation; + +import java.util.Map; +import com.microsoft.azure.management.keyvault.SecretProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for creating or updating a secret. + */ +public class SecretCreateOrUpdateParametersInner { + /** + * The tags that will be assigned to the secret. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Properties of the secret. + */ + @JsonProperty(value = "properties", required = true) + private SecretProperties properties; + + /** + * 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 SecretCreateOrUpdateParametersInner object itself. + */ + public SecretCreateOrUpdateParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public SecretProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the SecretCreateOrUpdateParametersInner object itself. + */ + public SecretCreateOrUpdateParametersInner withProperties(SecretProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretImpl.java new file mode 100644 index 00000000000..1efc7df0720 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretImpl.java @@ -0,0 +1,173 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.Secret; +import com.microsoft.azure.management.keyvault.SecretPatchProperties; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.CreatableUpdatableImpl; +import java.util.Arrays; +import java.util.Iterator; +import rx.Observable; +import com.microsoft.azure.management.keyvault.SecretProperties; +import java.util.Map; + +class SecretImpl extends CreatableUpdatableImpl implements Secret, Secret.Definition, Secret.Update { + private final KeyVaultManager manager; + private String resourceGroupName; + private String vaultName; + private String secretName; + private SecretCreateOrUpdateParametersInner createParameter; + private SecretPatchParametersInner updateParameter; + SecretImpl(String name, KeyVaultManager manager) { + super(name, new SecretInner()); + this.manager = manager; + this.secretName = name; + this.createParameter = new SecretCreateOrUpdateParametersInner(); + this.updateParameter = new SecretPatchParametersInner(); + } + SecretImpl(String name, SecretInner inner, KeyVaultManager manager) { + super(name, inner); + this.manager = manager; + this.resourceGroupName = GetValueFromIdByName(inner.id(), "resourceGroups"); + this.vaultName = GetValueFromIdByName(inner.id(), "vaults"); + this.secretName = GetValueFromIdByName(inner.id(), "secrets"); + } + + @Override + public KeyVaultManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SecretsInner client = this.manager.inner().secrets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.vaultName, this.secretName, this.createParameter) + .map(innerToFluentMap(this)); + } + @Override + public Observable updateResourceAsync() { + SecretsInner client = this.manager.inner().secrets(); + return client.updateAsync(this.resourceGroupName, this.vaultName, this.secretName, this.updateParameter) + .map(innerToFluentMap(this)); + } + @Override + protected Observable getInnerAsync() { + SecretsInner client = this.manager.inner().secrets(); + return client.getAsync(this.resourceGroupName, this.vaultName, this.secretName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SecretProperties properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + + @Override + public SecretImpl withExistingVault(String resourceGroupName, String vaultName) { + this.resourceGroupName = resourceGroupName; + this.vaultName = vaultName; + return this; + } + + @Override + public SecretImpl withProperties(SecretProperties properties) { + this.createParameter.withProperties(properties); + return this; + } + + @Override + public SecretImpl withProperties(SecretPatchProperties properties) { + this.updateParameter.withProperties(properties); + return this; + } + + @Override + public SecretImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameter.withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + private static String GetValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + private static String GetValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretInner.java new file mode 100644 index 00000000000..5dcc03cde12 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretInner.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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.SecretProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * Resource information with extended details. + */ +public class SecretInner extends Resource { + /** + * Properties of the secret. + */ + @JsonProperty(value = "properties", required = true) + private SecretProperties properties; + + /** + * Get the properties value. + * + * @return the properties value + */ + public SecretProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the SecretInner object itself. + */ + public SecretInner withProperties(SecretProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretPatchParametersInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretPatchParametersInner.java new file mode 100644 index 00000000000..4c5d9699926 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretPatchParametersInner.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.keyvault.implementation; + +import java.util.Map; +import com.microsoft.azure.management.keyvault.SecretPatchProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for patching a secret. + */ +public class SecretPatchParametersInner { + /** + * The tags that will be assigned to the secret. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Properties of the secret. + */ + @JsonProperty(value = "properties") + private SecretPatchProperties properties; + + /** + * 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 SecretPatchParametersInner object itself. + */ + public SecretPatchParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public SecretPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the SecretPatchParametersInner object itself. + */ + public SecretPatchParametersInner withProperties(SecretPatchProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretsImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretsImpl.java new file mode 100644 index 00000000000..e7919079974 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretsImpl.java @@ -0,0 +1,88 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; +import com.microsoft.azure.management.keyvault.Secrets; +import com.microsoft.azure.management.keyvault.Secret; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; + +public class SecretsImpl extends WrapperImpl implements Secrets { + private final KeyVaultManager manager; + + SecretsImpl(KeyVaultManager manager) { + super(manager.inner().secrets()); + this.manager = manager; + } + + public KeyVaultManager manager() { + return this.manager; + } + + @Override + public SecretImpl define(String name) { + return new SecretImpl(name, this.manager()); + } + + private SecretImpl wrapModel(SecretInner inner) { + return new SecretImpl(inner.name(), inner, this.manager()); + } + + private Observable> ListByVaultNextInnerPageAsync(String nextLink) { + if (nextLink == null) { + Observable.empty(); + } + SecretsInner client = this.inner(); + return client.listNextAsync(nextLink) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return Observable.just(page).concatWith(ListByVaultNextInnerPageAsync(page.nextPageLink())); + } + }); + } + @Override + public Observable ListByVaultAsync(final String resourceGroupName, final String vaultName) { + SecretsInner client = this.inner(); + return client.listAsync(resourceGroupName, vaultName) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return ListByVaultNextInnerPageAsync(page.nextPageLink()); + } + }) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Secret call(SecretInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable GetByVaultAsync(String resourceGroupName, String vaultName, String secretName) { + SecretsInner client = this.inner(); + return client.getAsync(resourceGroupName, vaultName, secretName) + .map(new Func1() { + @Override + public Secret call(SecretInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretsInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretsInner.java new file mode 100644 index 00000000000..5b9fec40c02 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/SecretsInner.java @@ -0,0 +1,739 @@ +/** + * 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.keyvault.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Secrets. + */ +public class SecretsInner { + /** The Retrofit service to perform REST calls. */ + private SecretsService service; + /** The service client containing this operation class. */ + private KeyVaultManagementClientImpl client; + + /** + * Initializes an instance of SecretsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SecretsInner(Retrofit retrofit, KeyVaultManagementClientImpl client) { + this.service = retrofit.create(SecretsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Secrets to be + * used by Retrofit to perform actually REST calls. + */ + interface SecretsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Secrets createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("secretName") String secretName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body SecretCreateOrUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Secrets update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("secretName") String secretName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body SecretPatchParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Secrets get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("secretName") String secretName, @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.keyvault.Secrets list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.keyvault.Secrets listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to create or update the secret + * @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 SecretInner object if successful. + */ + public SecretInner createOrUpdate(String resourceGroupName, String vaultName, String secretName, SecretCreateOrUpdateParametersInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, secretName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to create or update the secret + * @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 vaultName, String secretName, SecretCreateOrUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, secretName, parameters), serviceCallback); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to create or update the secret + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String vaultName, String secretName, SecretCreateOrUpdateParametersInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, secretName, parameters).map(new Func1, SecretInner>() { + @Override + public SecretInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to create or update the secret + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String vaultName, String secretName, SecretCreateOrUpdateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (secretName == null) { + throw new IllegalArgumentException("Parameter secretName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, vaultName, secretName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to patch the secret + * @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 SecretInner object if successful. + */ + public SecretInner update(String resourceGroupName, String vaultName, String secretName, SecretPatchParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, vaultName, secretName, parameters).toBlocking().single().body(); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to patch the secret + * @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 vaultName, String secretName, SecretPatchParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, vaultName, secretName, parameters), serviceCallback); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to patch the secret + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable updateAsync(String resourceGroupName, String vaultName, String secretName, SecretPatchParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, vaultName, secretName, parameters).map(new Func1, SecretInner>() { + @Override + public SecretInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param secretName Name of the secret + * @param parameters Parameters to patch the secret + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String vaultName, String secretName, SecretPatchParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (secretName == null) { + throw new IllegalArgumentException("Parameter secretName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, vaultName, secretName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 SecretInner object if successful. + */ + public SecretInner get(String resourceGroupName, String vaultName, String secretName) { + return getWithServiceResponseAsync(resourceGroupName, vaultName, secretName).toBlocking().single().body(); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 vaultName, String secretName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, vaultName, secretName), serviceCallback); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable getAsync(String resourceGroupName, String vaultName, String secretName) { + return getWithServiceResponseAsync(resourceGroupName, vaultName, secretName).map(new Func1, SecretInner>() { + @Override + public SecretInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String vaultName, String secretName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (secretName == null) { + throw new IllegalArgumentException("Parameter secretName 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, vaultName, secretName, 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); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SecretInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String vaultName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, vaultName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String vaultName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, vaultName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String vaultName) { + return listWithServiceResponseAsync(resourceGroupName, vaultName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String vaultName) { + return listSinglePageAsync(resourceGroupName, vaultName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SecretInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String vaultName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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 Integer top = null; + return service.list(resourceGroupName, vaultName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SecretInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String vaultName, final Integer top) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, vaultName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param top Maximum number of results to return. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String vaultName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, vaultName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String vaultName, final Integer top) { + return listWithServiceResponseAsync(resourceGroupName, vaultName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String vaultName, final Integer top) { + return listSinglePageAsync(resourceGroupName, vaultName, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + ServiceResponse> * @param resourceGroupName The name of the Resource Group to which the vault belongs. + ServiceResponse> * @param vaultName The name of the vault. + ServiceResponse> * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SecretInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String vaultName, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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, vaultName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SecretInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SecretInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyParametersImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyParametersImpl.java new file mode 100644 index 00000000000..c6d398474a0 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyParametersImpl.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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.VaultAccessPolicyParameters; +import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl; + +class VaultAccessPolicyParametersImpl extends WrapperImpl implements VaultAccessPolicyParameters { + + VaultAccessPolicyParametersImpl(VaultAccessPolicyParametersInner inner) { + super(inner); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public VaultAccessPolicyPropertiesInner properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyParametersInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyParametersInner.java new file mode 100644 index 00000000000..45940bc84f4 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyParametersInner.java @@ -0,0 +1,103 @@ +/** + * 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.keyvault.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for updating the access policy in a vault. + */ +public class VaultAccessPolicyParametersInner { + /** + * The resource id of the access policy. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The resource name of the access policy. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource name of the access policy. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The resource type of the the access policy. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Properties of the access policy. + */ + @JsonProperty(value = "properties", required = true) + private VaultAccessPolicyPropertiesInner properties; + + /** + * 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; + } + + /** + * Get the location value. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public VaultAccessPolicyPropertiesInner properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the VaultAccessPolicyParametersInner object itself. + */ + public VaultAccessPolicyParametersInner withProperties(VaultAccessPolicyPropertiesInner properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyPropertiesInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyPropertiesInner.java new file mode 100644 index 00000000000..b78b9a3b84a --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultAccessPolicyPropertiesInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault.implementation; + +import java.util.List; +import com.microsoft.azure.management.keyvault.AccessPolicyEntry; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the vault access policy. + */ +public class VaultAccessPolicyPropertiesInner { + /** + * An array of 0 to 16 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's + * tenant ID. + */ + @JsonProperty(value = "accessPolicies", required = true) + private List accessPolicies; + + /** + * Get the accessPolicies value. + * + * @return the accessPolicies value + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies value. + * + * @param accessPolicies the accessPolicies value to set + * @return the VaultAccessPolicyPropertiesInner object itself. + */ + public VaultAccessPolicyPropertiesInner withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultCreateOrUpdateParametersInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultCreateOrUpdateParametersInner.java new file mode 100644 index 00000000000..a5faa27a5e3 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultCreateOrUpdateParametersInner.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault.implementation; + +import java.util.Map; +import com.microsoft.azure.management.keyvault.VaultProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for creating or updating a vault. + */ +public class VaultCreateOrUpdateParametersInner { + /** + * The supported Azure location where the key vault should be created. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The tags that will be assigned to the key vault. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Properties of the vault. + */ + @JsonProperty(value = "properties", required = true) + private VaultProperties properties; + + /** + * 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 VaultCreateOrUpdateParametersInner object itself. + */ + public VaultCreateOrUpdateParametersInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * 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 VaultCreateOrUpdateParametersInner object itself. + */ + public VaultCreateOrUpdateParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public VaultProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the VaultCreateOrUpdateParametersInner object itself. + */ + public VaultCreateOrUpdateParametersInner withProperties(VaultProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultImpl.java new file mode 100644 index 00000000000..1a489536a13 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultImpl.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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.VaultProperties; +import com.microsoft.azure.management.keyvault.VaultPatchProperties; +import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableResourceImpl; +import com.microsoft.azure.management.keyvault.Vault; +import rx.Observable; + +class VaultImpl extends GroupableResourceImpl implements Vault, Vault.Definition, Vault.Update { + private VaultPatchParametersInner updateParameter; + private VaultCreateOrUpdateParametersInner createParameter; + VaultImpl(String name, VaultInner inner, KeyVaultManager manager) + { + super(name, inner, manager); + this.updateParameter = new VaultPatchParametersInner(); + this.createParameter = new VaultCreateOrUpdateParametersInner(); + } + + @Override + public VaultProperties properties() { + return this.inner().properties(); + } + + @Override + public VaultImpl withProperties(VaultProperties properties) { + this.createParameter.withProperties(properties); + return this; + } + + @Override + public VaultImpl withProperties(VaultPatchProperties properties) { + this.updateParameter.withProperties(properties); + return this; + } + + @Override + public Observable createResourceAsync() { + final VaultsInner client = this.manager().inner().vaults(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.createParameter) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + final VaultsInner client = this.manager().inner().vaults(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + final VaultsInner client = this.manager().inner().vaults(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultInner.java new file mode 100644 index 00000000000..0ce301710f6 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultInner.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.keyvault.implementation; + +import com.microsoft.azure.management.keyvault.VaultProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Resource; + +/** + * Resource information with extended details. + */ +public class VaultInner extends Resource { + /** + * Properties of the vault. + */ + @JsonProperty(value = "properties", required = true) + private VaultProperties properties; + + /** + * Get the properties value. + * + * @return the properties value + */ + public VaultProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the VaultInner object itself. + */ + public VaultInner withProperties(VaultProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultPatchParametersInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultPatchParametersInner.java new file mode 100644 index 00000000000..66886a748bb --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultPatchParametersInner.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.keyvault.implementation; + +import java.util.Map; +import com.microsoft.azure.management.keyvault.VaultPatchProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for creating or updating a vault. + */ +public class VaultPatchParametersInner { + /** + * The tags that will be assigned to the key vault. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Properties of the vault. + */ + @JsonProperty(value = "properties") + private VaultPatchProperties properties; + + /** + * 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 VaultPatchParametersInner object itself. + */ + public VaultPatchParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public VaultPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the VaultPatchParametersInner object itself. + */ + public VaultPatchParametersInner withProperties(VaultPatchProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultsImpl.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultsImpl.java new file mode 100644 index 00000000000..ef9f92f843b --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultsImpl.java @@ -0,0 +1,242 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl; +import com.microsoft.azure.management.keyvault.Vaults; +import com.microsoft.azure.management.keyvault.Vault; +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.keyvault.DeletedVault; +import com.microsoft.azure.management.keyvault.CheckNameAvailabilityResult; +import rx.functions.Func1; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils; +import com.microsoft.azure.management.resources.fluentcore.utils.RXMapper; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.keyvault.AccessPolicies; +import com.microsoft.azure.management.keyvault.Secrets; + +public class VaultsImpl extends GroupableResourcesImpl implements Vaults { + protected VaultsImpl(KeyVaultManager manager) { + super(manager.inner().vaults(), manager); + } + + @Override + public AccessPolicies accessPolicies() { + AccessPolicies accessor = this.manager().accessPolicies(); + return accessor; + } + + @Override + public Secrets secrets() { + Secrets accessor = this.manager().secrets(); + return accessor; + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + VaultsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + VaultsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + VaultsInner client = this.inner(); + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtils.groupFromResourceId(id); + final String name = ResourceUtils.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + VaultsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + private Observable> ListByResourceGroupNextInnerPageAsync(String nextLink) { + if (nextLink == null) { + Observable.empty(); + } + VaultsInner client = this.inner(); + return client.listByResourceGroupNextAsync(nextLink) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return Observable.just(page).concatWith(ListByResourceGroupNextInnerPageAsync(page.nextPageLink())); + } + }); + } + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + VaultsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return ListByResourceGroupNextInnerPageAsync(page.nextPageLink()); + } + }) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Vault call(VaultInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + VaultsInner client = this.inner(); + return this.wrapList(client.listBySubscription()); + } + + private Observable> ListNextInnerPageAsync(String nextLink) { + if (nextLink == null) { + Observable.empty(); + } + VaultsInner client = this.inner(); + return client.listBySubscriptionNextAsync(nextLink) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return Observable.just(page).concatWith(ListNextInnerPageAsync(page.nextPageLink())); + } + }); + } + @Override + public Observable listAsync() { + VaultsInner client = this.inner(); + return client.listBySubscriptionAsync() + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return ListNextInnerPageAsync(page.nextPageLink()); + } + }) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Vault call(VaultInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public VaultImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable listDeletedAsync() { + VaultsInner client = this.inner(); + return client.listDeletedAsync() + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return ListNextDeletedInnerPageAsync(page.nextPageLink()); + } + }) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DeletedVault call(DeletedVaultInner inner) { + return new DeletedVaultImpl(inner, manager()); + } + }); + } + + private Observable> ListNextDeletedInnerPageAsync(String nextLink) { + if (nextLink == null) { + Observable.empty(); + } + VaultsInner client = this.inner(); + return client.listDeletedNextAsync(nextLink) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Page page) { + return Observable.just(page).concatWith(ListNextDeletedInnerPageAsync(page.nextPageLink())); + } + }); + } + + @Override + public Observable checkNameAvailabilityAsync(String name) { + VaultsInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityResult call(CheckNameAvailabilityResultInner inner) { + return new CheckNameAvailabilityResultImpl(inner); + } + }); + } + + @Override + protected VaultImpl wrapModel(VaultInner inner) { + return new VaultImpl(inner.name(), inner, this.manager()); + } + + @Override + protected VaultImpl wrapModel(String name) { + return new VaultImpl(name, new VaultInner(), this.manager()); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultsInner.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultsInner.java new file mode 100644 index 00000000000..be222638347 --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/VaultsInner.java @@ -0,0 +1,2212 @@ +/** + * 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.keyvault.implementation; + +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.keyvault.AccessPolicyUpdateKind; +import com.microsoft.azure.management.keyvault.VaultCheckNameAvailabilityParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Resource; +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.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Vaults. + */ +public class VaultsInner implements InnerSupportsGet, InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private VaultsService service; + /** The service client containing this operation class. */ + private KeyVaultManagementClientImpl client; + + /** + * Initializes an instance of VaultsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VaultsInner(Retrofit retrofit, KeyVaultManagementClientImpl client) { + this.service = retrofit.create(VaultsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Vaults to be + * used by Retrofit to perform actually REST calls. + */ + interface VaultsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body VaultCreateOrUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body VaultCreateOrUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body VaultPatchParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @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.keyvault.Vaults getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @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.keyvault.Vaults updateAccessPolicy" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") + Observable> updateAccessPolicy(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("operationKind") AccessPolicyUpdateKind operationKind, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VaultAccessPolicyParametersInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.keyvault.Vaults listBySubscription" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") + Observable> listBySubscription(@Path("subscriptionId") String subscriptionId, @Query("$top") Integer top, @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.keyvault.Vaults listDeleted" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") + Observable> listDeleted(@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.keyvault.Vaults getDeleted" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") + Observable> getDeleted(@Path("vaultName") String vaultName, @Path("location") String location, @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.keyvault.Vaults purgeDeleted" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") + Observable> purgeDeleted(@Path("vaultName") String vaultName, @Path("location") String location, @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.keyvault.Vaults beginPurgeDeleted" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") + Observable> beginPurgeDeleted(@Path("vaultName") String vaultName, @Path("location") String location, @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.keyvault.Vaults list" }) + @GET("subscriptions/{subscriptionId}/resources") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @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.keyvault.Vaults checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VaultCheckNameAvailabilityParameters vaultName, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @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.keyvault.Vaults listBySubscriptionNext" }) + @GET + Observable> listBySubscriptionNext(@Url String nextUrl, @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.keyvault.Vaults listDeletedNext" }) + @GET + Observable> listDeletedNext(@Url String nextUrl, @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.keyvault.Vaults listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @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 VaultInner object if successful. + */ + public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @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 vaultName, VaultCreateOrUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters), serviceCallback); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1, VaultInner>() { + @Override + public VaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, vaultName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @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 VaultInner object if successful. + */ + public VaultInner beginCreateOrUpdate(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters), serviceCallback); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1, VaultInner>() { + @Override + public VaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, vaultName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to patch the vault + * @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 VaultInner object if successful. + */ + public VaultInner update(String resourceGroupName, String vaultName, VaultPatchParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().single().body(); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to patch the vault + * @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 vaultName, VaultPatchParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, vaultName, parameters), serviceCallback); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to patch the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable updateAsync(String resourceGroupName, String vaultName, VaultPatchParametersInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1, VaultInner>() { + @Override + public VaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to patch the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String vaultName, VaultPatchParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, vaultName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault to delete + * @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 vaultName) { + deleteWithServiceResponseAsync(resourceGroupName, vaultName).toBlocking().single().body(); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault to delete + * @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 vaultName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, vaultName), serviceCallback); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault to delete + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String vaultName) { + return deleteWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault to delete + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String vaultName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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, vaultName, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @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 VaultInner object if successful. + */ + public VaultInner getByResourceGroup(String resourceGroupName, String vaultName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName).toBlocking().single().body(); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String vaultName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName), serviceCallback); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String vaultName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName).map(new Func1, VaultInner>() { + @Override + public VaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName The name of the vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String vaultName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName 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.getByResourceGroup(resourceGroupName, vaultName, 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 = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param operationKind Name of the operation. Possible values include: 'add', 'replace', 'remove' + * @param properties Properties of the access policy + * @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 VaultAccessPolicyParametersInner object if successful. + */ + public VaultAccessPolicyParametersInner updateAccessPolicy(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyPropertiesInner properties) { + return updateAccessPolicyWithServiceResponseAsync(resourceGroupName, vaultName, operationKind, properties).toBlocking().single().body(); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param operationKind Name of the operation. Possible values include: 'add', 'replace', 'remove' + * @param properties Properties of the access policy + * @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 updateAccessPolicyAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyPropertiesInner properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAccessPolicyWithServiceResponseAsync(resourceGroupName, vaultName, operationKind, properties), serviceCallback); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param operationKind Name of the operation. Possible values include: 'add', 'replace', 'remove' + * @param properties Properties of the access policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultAccessPolicyParametersInner object + */ + public Observable updateAccessPolicyAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyPropertiesInner properties) { + return updateAccessPolicyWithServiceResponseAsync(resourceGroupName, vaultName, operationKind, properties).map(new Func1, VaultAccessPolicyParametersInner>() { + @Override + public VaultAccessPolicyParametersInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param vaultName Name of the vault + * @param operationKind Name of the operation. Possible values include: 'add', 'replace', 'remove' + * @param properties Properties of the access policy + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultAccessPolicyParametersInner object + */ + public Observable> updateAccessPolicyWithServiceResponseAsync(String resourceGroupName, String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyPropertiesInner properties) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (operationKind == null) { + throw new IllegalArgumentException("Parameter operationKind 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 (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + VaultAccessPolicyParametersInner parameters = new VaultAccessPolicyParametersInner(); + parameters.withProperties(properties); + return service.updateAccessPolicy(resourceGroupName, vaultName, operationKind, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAccessPolicyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateAccessPolicyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VaultInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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 Integer top = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VaultInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final Integer top) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param top Maximum number of results to return. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final Integer top) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param resourceGroupName The name of the Resource Group to which the vault belongs. + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final Integer top) { + return listByResourceGroupSinglePageAsync(resourceGroupName, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + ServiceResponse> * @param resourceGroupName The name of the Resource Group to which the vault belongs. + ServiceResponse> * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VaultInner> object if successful. + */ + public PagedList listBySubscription() { + ServiceResponse> response = listBySubscriptionSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBySubscriptionAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable> listBySubscriptionAsync() { + return listBySubscriptionWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable>> listBySubscriptionWithServiceResponseAsync() { + return listBySubscriptionSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBySubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionSinglePageAsync() { + 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 Integer top = null; + return service.listBySubscription(this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VaultInner> object if successful. + */ + public PagedList listBySubscription(final Integer top) { + ServiceResponse> response = listBySubscriptionSinglePageAsync(top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @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> listBySubscriptionAsync(final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionSinglePageAsync(top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable> listBySubscriptionAsync(final Integer top) { + return listBySubscriptionWithServiceResponseAsync(top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable>> listBySubscriptionWithServiceResponseAsync(final Integer top) { + return listBySubscriptionSinglePageAsync(top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBySubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + ServiceResponse> * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionSinglePageAsync(final Integer top) { + 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.listBySubscription(this.client.subscriptionId(), top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySubscriptionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeletedVaultInner> object if successful. + */ + public PagedList listDeleted() { + ServiceResponse> response = listDeletedSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeletedNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listDeletedAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeletedSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeletedNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeletedVaultInner> object + */ + public Observable> listDeletedAsync() { + return listDeletedWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeletedVaultInner> object + */ + public Observable>> listDeletedWithServiceResponseAsync() { + return listDeletedSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listDeletedNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeletedVaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeletedSinglePageAsync() { + 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.listDeleted(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 = listDeletedDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeletedDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the deleted Azure key vault. + * + * @param vaultName The name of the vault. + * @param location The location of the deleted vault. + * @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 DeletedVaultInner object if successful. + */ + public DeletedVaultInner getDeleted(String vaultName, String location) { + return getDeletedWithServiceResponseAsync(vaultName, location).toBlocking().single().body(); + } + + /** + * Gets the deleted Azure key vault. + * + * @param vaultName The name of the vault. + * @param location The location of the deleted vault. + * @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 getDeletedAsync(String vaultName, String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getDeletedWithServiceResponseAsync(vaultName, location), serviceCallback); + } + + /** + * Gets the deleted Azure key vault. + * + * @param vaultName The name of the vault. + * @param location The location of the deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeletedVaultInner object + */ + public Observable getDeletedAsync(String vaultName, String location) { + return getDeletedWithServiceResponseAsync(vaultName, location).map(new Func1, DeletedVaultInner>() { + @Override + public DeletedVaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the deleted Azure key vault. + * + * @param vaultName The name of the vault. + * @param location The location of the deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DeletedVaultInner object + */ + public Observable> getDeletedWithServiceResponseAsync(String vaultName, String location) { + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location 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.getDeleted(vaultName, location, 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 = getDeletedDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDeletedDelegate(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); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @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 purgeDeleted(String vaultName, String location) { + purgeDeletedWithServiceResponseAsync(vaultName, location).toBlocking().last().body(); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @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 purgeDeletedAsync(String vaultName, String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(purgeDeletedWithServiceResponseAsync(vaultName, location), serviceCallback); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable purgeDeletedAsync(String vaultName, String location) { + return purgeDeletedWithServiceResponseAsync(vaultName, location).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> purgeDeletedWithServiceResponseAsync(String vaultName, String location) { + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location 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."); + } + Observable> observable = service.purgeDeleted(vaultName, location, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @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 beginPurgeDeleted(String vaultName, String location) { + beginPurgeDeletedWithServiceResponseAsync(vaultName, location).toBlocking().single().body(); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @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 beginPurgeDeletedAsync(String vaultName, String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPurgeDeletedWithServiceResponseAsync(vaultName, location), serviceCallback); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginPurgeDeletedAsync(String vaultName, String location) { + return beginPurgeDeletedWithServiceResponseAsync(vaultName, location).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param vaultName The name of the soft-deleted vault. + * @param location The location of the soft-deleted vault. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginPurgeDeletedWithServiceResponseAsync(String vaultName, String location) { + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location 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.beginPurgeDeleted(vaultName, location, 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 = beginPurgeDeletedDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPurgeDeletedDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<Resource> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Resource> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Resource> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<Resource> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String filter = "resourceType eq 'Microsoft.KeyVault/vaults'"; + final String apiVersion = "2015-11-01"; + final Integer top = null; + return service.list(this.client.subscriptionId(), filter, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<Resource> object if successful. + */ + public PagedList list(final Integer top) { + ServiceResponse> response = listSinglePageAsync(top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Resource> object + */ + public Observable> listAsync(final Integer top) { + return listWithServiceResponseAsync(top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Resource> object + */ + public Observable>> listWithServiceResponseAsync(final Integer top) { + return listSinglePageAsync(top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + ServiceResponse> * @param top Maximum number of results to return. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<Resource> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final Integer top) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String filter = "resourceType eq 'Microsoft.KeyVault/vaults'"; + final String apiVersion = "2015-11-01"; + return service.list(this.client.subscriptionId(), filter, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param name The vault name. + * @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 CheckNameAvailabilityResultInner object if successful. + */ + public CheckNameAvailabilityResultInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param name The vault name. + * @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 checkNameAvailabilityAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param name The vault name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityResultInner>() { + @Override + public CheckNameAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param name The vault name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityResultInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + VaultCheckNameAvailabilityParameters vaultName = new VaultCheckNameAvailabilityParameters(); + vaultName.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vaultName, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(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); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VaultInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VaultInner> object if successful. + */ + public PagedList listBySubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBySubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBySubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable> listBySubscriptionNextAsync(final String nextPageLink) { + return listBySubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VaultInner> object + */ + public Observable>> listBySubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listBySubscriptionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBySubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBySubscriptionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBySubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySubscriptionNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DeletedVaultInner> object if successful. + */ + public PagedList listDeletedNext(final String nextPageLink) { + ServiceResponse> response = listDeletedNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listDeletedNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listDeletedNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listDeletedNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listDeletedNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeletedVaultInner> object + */ + public Observable> listDeletedNextAsync(final String nextPageLink) { + return listDeletedNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DeletedVaultInner> object + */ + public Observable>> listDeletedNextWithServiceResponseAsync(final String nextPageLink) { + return listDeletedNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listDeletedNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DeletedVaultInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listDeletedNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listDeletedNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDeletedNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDeletedNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<Resource> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Resource> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<Resource> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<Resource> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/package-info.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/package-info.java new file mode 100644 index 00000000000..84763cd550e --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for KeyVaultManagementClient. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.microsoft.azure.management.keyvault.implementation; diff --git a/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/package-info.java b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/package-info.java new file mode 100644 index 00000000000..1f051f3fc6d --- /dev/null +++ b/azure-mgmt-keyvault-preview/src/main/java/com/microsoft/azure/management/keyvault/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for KeyVaultManagementClient. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.microsoft.azure.management.keyvault; diff --git a/pom.xml b/pom.xml index e2b6e56003a..52fc3eeb34a 100644 --- a/pom.xml +++ b/pom.xml @@ -424,6 +424,7 @@ ./azure-mgmt-graph-rbac ./azure-mgmt-insights ./azure-mgmt-keyvault + ./azure-mgmt-keyvault-preview ./azure-mgmt-logic ./azure-mgmt-locks ./azure-mgmt-machinelearning