diff --git a/searchmanagementclient/resource-manager/v2015_02_28/pom.xml b/searchmanagementclient/resource-manager/v2015_02_28/pom.xml new file mode 100644 index 0000000000000..71c91c2ff5c63 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.searchmanagementclient.v2015_02_28 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-search + 1.0.0-beta + jar + Microsoft Azure SDK for Search Management + This package contains Microsoft Search 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-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + 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/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/AdminKeyResult.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/AdminKeyResult.java new file mode 100644 index 0000000000000..0d629d196ecb7 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/AdminKeyResult.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.SearchManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.AdminKeyResultInner; + +/** + * Type representing AdminKeyResult. + */ +public interface AdminKeyResult extends HasInner, HasManager { + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/AdminKeys.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/AdminKeys.java new file mode 100644 index 0000000000000..d698a6759f32a --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/AdminKeys.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.searchmanagementclient.v2015_02_28; + +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.AdminKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AdminKeys. + */ +public interface AdminKeys extends HasInner { + /** + * Returns the primary and secondary API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list admin keys. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String serviceName); + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/ListQueryKeysResult.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/ListQueryKeysResult.java new file mode 100644 index 0000000000000..bf6aea12e9e3c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/ListQueryKeysResult.java @@ -0,0 +1,27 @@ +/** + * 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.searchmanagementclient.v2015_02_28; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.SearchManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.ListQueryKeysResultInner; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.QueryKeyInner; +import java.util.List; + +/** + * Type representing ListQueryKeysResult. + */ +public interface ListQueryKeysResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/ProvisioningState.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/ProvisioningState.java new file mode 100644 index 0000000000000..8952d9a6d1ae9 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/ProvisioningState.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.searchmanagementclient.v2015_02_28; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningState. + */ +public enum ProvisioningState { + /** Enum value succeeded. */ + SUCCEEDED("succeeded"), + + /** Enum value provisioning. */ + PROVISIONING("provisioning"), + + /** Enum value failed. */ + FAILED("failed"); + + /** The actual serialized value for a ProvisioningState instance. */ + private String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/QueryKeys.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/QueryKeys.java new file mode 100644 index 0000000000000..4bf60f7d5aee1 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/QueryKeys.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.searchmanagementclient.v2015_02_28; + +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.QueryKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing QueryKeys. + */ +public interface QueryKeys extends HasInner { + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list query keys. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String serviceName); + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceCreateOrUpdateParameters.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceCreateOrUpdateParameters.java new file mode 100644 index 0000000000000..611d7aab6b9b3 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceCreateOrUpdateParameters.java @@ -0,0 +1,96 @@ +/** + * 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.searchmanagementclient.v2015_02_28; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties that describe an Azure Search service. + */ +public class SearchServiceCreateOrUpdateParameters { + /** + * The geographic location of the Search service. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Tags to help categorize the Search service in the Azure Portal. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Properties of the Search service. + */ + @JsonProperty(value = "properties") + private SearchServiceProperties properties; + + /** + * Get the geographic location of the Search service. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geographic location of the Search service. + * + * @param location the location value to set + * @return the SearchServiceCreateOrUpdateParameters object itself. + */ + public SearchServiceCreateOrUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get tags to help categorize the Search service in the Azure Portal. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set tags to help categorize the Search service in the Azure Portal. + * + * @param tags the tags value to set + * @return the SearchServiceCreateOrUpdateParameters object itself. + */ + public SearchServiceCreateOrUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get properties of the Search service. + * + * @return the properties value + */ + public SearchServiceProperties properties() { + return this.properties; + } + + /** + * Set properties of the Search service. + * + * @param properties the properties value to set + * @return the SearchServiceCreateOrUpdateParameters object itself. + */ + public SearchServiceCreateOrUpdateParameters withProperties(SearchServiceProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceProperties.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceProperties.java new file mode 100644 index 0000000000000..86deaa7fc6032 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceProperties.java @@ -0,0 +1,98 @@ +/** + * 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.searchmanagementclient.v2015_02_28; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines properties of an Azure Search service that can be modified. + */ +public class SearchServiceProperties { + /** + * The SKU of the Search Service, which determines price tier and capacity + * limits. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The number of replicas in the Search service. If specified, it must be a + * value between 1 and 6 inclusive. + */ + @JsonProperty(value = "replicaCount") + private Integer replicaCount; + + /** + * The number of partitions in the Search service; if specified, it can be + * 1, 2, 3, 4, 6, or 12. + */ + @JsonProperty(value = "partitionCount") + private Integer partitionCount; + + /** + * Get the SKU of the Search Service, which determines price tier and capacity limits. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the Search Service, which determines price tier and capacity limits. + * + * @param sku the sku value to set + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the number of replicas in the Search service. If specified, it must be a value between 1 and 6 inclusive. + * + * @return the replicaCount value + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the number of replicas in the Search service. If specified, it must be a value between 1 and 6 inclusive. + * + * @param replicaCount the replicaCount value to set + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. + * + * @return the partitionCount value + */ + public Integer partitionCount() { + return this.partitionCount; + } + + /** + * Set the number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. + * + * @param partitionCount the partitionCount value to set + * @return the SearchServiceProperties object itself. + */ + public SearchServiceProperties withPartitionCount(Integer partitionCount) { + this.partitionCount = partitionCount; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceReadableProperties.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceReadableProperties.java new file mode 100644 index 0000000000000..f0dcad677650c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceReadableProperties.java @@ -0,0 +1,145 @@ +/** + * 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.searchmanagementclient.v2015_02_28; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines all the properties of an Azure Search service. + */ +public class SearchServiceReadableProperties { + /** + * The status of the Search service. Possible values include: 'running', + * 'provisioning', 'deleting', 'degraded', 'disabled', 'error'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private SearchServiceStatus status; + + /** + * The details of the Search service status. + */ + @JsonProperty(value = "statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /** + * The state of the last provisioning operation performed on the Search + * service. Possible values include: 'succeeded', 'provisioning', 'failed'. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The SKU of the Search Service, which determines price tier and capacity + * limits. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The number of replicas in the Search service. If specified, it must be a + * value between 1 and 6 inclusive. + */ + @JsonProperty(value = "replicaCount") + private Integer replicaCount; + + /** + * The number of partitions in the Search service; if specified, it can be + * 1, 2, 3, 4, 6, or 12. + */ + @JsonProperty(value = "partitionCount") + private Integer partitionCount; + + /** + * Get the status of the Search service. Possible values include: 'running', 'provisioning', 'deleting', 'degraded', 'disabled', 'error'. + * + * @return the status value + */ + public SearchServiceStatus status() { + return this.status; + } + + /** + * Get the details of the Search service status. + * + * @return the statusDetails value + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the state of the last provisioning operation performed on the Search service. Possible values include: 'succeeded', 'provisioning', 'failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the SKU of the Search Service, which determines price tier and capacity limits. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the Search Service, which determines price tier and capacity limits. + * + * @param sku the sku value to set + * @return the SearchServiceReadableProperties object itself. + */ + public SearchServiceReadableProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the number of replicas in the Search service. If specified, it must be a value between 1 and 6 inclusive. + * + * @return the replicaCount value + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the number of replicas in the Search service. If specified, it must be a value between 1 and 6 inclusive. + * + * @param replicaCount the replicaCount value to set + * @return the SearchServiceReadableProperties object itself. + */ + public SearchServiceReadableProperties withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. + * + * @return the partitionCount value + */ + public Integer partitionCount() { + return this.partitionCount; + } + + /** + * Set the number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. + * + * @param partitionCount the partitionCount value to set + * @return the SearchServiceReadableProperties object itself. + */ + public SearchServiceReadableProperties withPartitionCount(Integer partitionCount) { + this.partitionCount = partitionCount; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceResource.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceResource.java new file mode 100644 index 0000000000000..360b28d88fb29 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceResource.java @@ -0,0 +1,169 @@ +/** + * 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.searchmanagementclient.v2015_02_28; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.SearchServiceResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.SearchManager; +import java.util.Map; + +/** + * Type representing SearchServiceResource. + */ +public interface SearchServiceResource extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + SearchServiceReadableProperties properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * The entirety of the SearchServiceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithCreate { + } + + /** + * Grouping of SearchServiceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SearchServiceResource definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the searchserviceresource definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group within the current subscription + * @return the next definition stage + */ + WithCreate withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the searchserviceresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The geographic location of the Search service + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the searchserviceresource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Properties of the Search service + * @return the next definition stage + */ + WithCreate withProperties(SearchServiceProperties properties); + } + + /** + * The stage of the searchserviceresource definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Tags to help categorize the Search service in the Azure Portal + * @return the next definition stage + */ + 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.WithLocation, DefinitionStages.WithProperties, DefinitionStages.WithTags { + } + } + /** + * The template for a SearchServiceResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithProperties, UpdateStages.WithTags { + } + + /** + * Grouping of SearchServiceResource update stages. + */ + interface UpdateStages { + /** + * The stage of the searchserviceresource update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The geographic location of the Search service + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the searchserviceresource update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Properties of the Search service + * @return the next update stage + */ + Update withProperties(SearchServiceProperties properties); + } + + /** + * The stage of the searchserviceresource update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Tags to help categorize the Search service in the Azure Portal + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceStatus.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceStatus.java new file mode 100644 index 0000000000000..d31380c155ef3 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SearchServiceStatus.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SearchServiceStatus. + */ +public enum SearchServiceStatus { + /** Enum value running. */ + RUNNING("running"), + + /** Enum value provisioning. */ + PROVISIONING("provisioning"), + + /** Enum value deleting. */ + DELETING("deleting"), + + /** Enum value degraded. */ + DEGRADED("degraded"), + + /** Enum value disabled. */ + DISABLED("disabled"), + + /** Enum value error. */ + ERROR("error"); + + /** The actual serialized value for a SearchServiceStatus instance. */ + private String value; + + SearchServiceStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SearchServiceStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SearchServiceStatus object, or null if unable to parse. + */ + @JsonCreator + public static SearchServiceStatus fromString(String value) { + SearchServiceStatus[] items = SearchServiceStatus.values(); + for (SearchServiceStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/Services.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/Services.java new file mode 100644 index 0000000000000..8c162f9bb4b27 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/Services.java @@ -0,0 +1,22 @@ +/** + * 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.searchmanagementclient.v2015_02_28; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation.ServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Services. + */ +public interface Services extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsListingByResourceGroup, HasInner { +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/Sku.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/Sku.java new file mode 100644 index 0000000000000..5054c730f8353 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/Sku.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.searchmanagementclient.v2015_02_28; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the SKU of an Azure Search Service, which determines price tier and + * capacity limits. + */ +public class Sku { + /** + * The SKU of the Search service. Possible values include: 'free', + * 'standard', 'standard2'. + */ + @JsonProperty(value = "name") + private SkuType name; + + /** + * Get the SKU of the Search service. Possible values include: 'free', 'standard', 'standard2'. + * + * @return the name value + */ + public SkuType name() { + return this.name; + } + + /** + * Set the SKU of the Search service. Possible values include: 'free', 'standard', 'standard2'. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuType name) { + this.name = name; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SkuType.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SkuType.java new file mode 100644 index 0000000000000..c22cbb1c67d45 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/SkuType.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.searchmanagementclient.v2015_02_28; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuType. + */ +public enum SkuType { + /** Enum value free. */ + FREE("free"), + + /** Enum value standard. */ + STANDARD("standard"), + + /** Enum value standard2. */ + STANDARD2("standard2"); + + /** The actual serialized value for a SkuType instance. */ + private String value; + + SkuType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuType instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuType object, or null if unable to parse. + */ + @JsonCreator + public static SkuType fromString(String value) { + SkuType[] items = SkuType.values(); + for (SkuType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeyResultImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeyResultImpl.java new file mode 100644 index 0000000000000..e0251beb034e8 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeyResultImpl.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.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.AdminKeyResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AdminKeyResultImpl extends WrapperImpl implements AdminKeyResult { + private final SearchManager manager; + AdminKeyResultImpl(AdminKeyResultInner inner, SearchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SearchManager manager() { + return this.manager; + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeyResultInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeyResultInner.java new file mode 100644 index 0000000000000..c703f15e89165 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeyResultInner.java @@ -0,0 +1,48 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response containing the primary and secondary API keys for a given Azure + * Search service. + */ +public class AdminKeyResultInner { + /** + * The primary API key of the Search service. + */ + @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryKey; + + /** + * The secondary API key of the Search service. + */ + @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryKey; + + /** + * Get the primary API key of the Search service. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Get the secondary API key of the Search service. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeysImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeysImpl.java new file mode 100644 index 0000000000000..ab00024f4d19c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeysImpl.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. + * abc + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.AdminKeys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.AdminKeyResult; + +class AdminKeysImpl extends WrapperImpl implements AdminKeys { + private final SearchManager manager; + + AdminKeysImpl(SearchManager manager) { + super(manager.inner().adminKeys()); + this.manager = manager; + } + + public SearchManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String resourceGroupName, String serviceName) { + AdminKeysInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public AdminKeyResult call(AdminKeyResultInner inner) { + return new AdminKeyResultImpl(inner, manager()); + } + }); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeysInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeysInner.java new file mode 100644 index 0000000000000..84ad1de38f885 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/AdminKeysInner.java @@ -0,0 +1,146 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AdminKeys. + */ +public class AdminKeysInner { + /** The Retrofit service to perform REST calls. */ + private AdminKeysService service; + /** The service client containing this operation class. */ + private SearchManagementClientImpl client; + + /** + * Initializes an instance of AdminKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AdminKeysInner(Retrofit retrofit, SearchManagementClientImpl client) { + this.service = retrofit.create(AdminKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for AdminKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface AdminKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_02_28.AdminKeys list" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}/listAdminKeys") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns the primary and secondary API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list admin keys. + * @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 AdminKeyResultInner object if successful. + */ + public AdminKeyResultInner list(String resourceGroupName, String serviceName) { + return listWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Returns the primary and secondary API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list admin keys. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Returns the primary and secondary API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list admin keys. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable listAsync(String resourceGroupName, String serviceName) { + return listWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, AdminKeyResultInner>() { + @Override + public AdminKeyResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the primary and secondary API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list admin keys. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable> listWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName 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, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/IdParsingUtils.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..171b85afe2108 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public 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; + } + + public 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/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ListQueryKeysResultImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ListQueryKeysResultImpl.java new file mode 100644 index 0000000000000..b840879e713ab --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ListQueryKeysResultImpl.java @@ -0,0 +1,32 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.ListQueryKeysResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class ListQueryKeysResultImpl extends WrapperImpl implements ListQueryKeysResult { + private final SearchManager manager; + ListQueryKeysResultImpl(ListQueryKeysResultInner inner, SearchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SearchManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ListQueryKeysResultInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ListQueryKeysResultInner.java new file mode 100644 index 0000000000000..faaeffef192ba --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ListQueryKeysResultInner.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.searchmanagementclient.v2015_02_28.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response containing the query API keys for a given Azure Search service. + */ +public class ListQueryKeysResultInner { + /** + * The query keys for the Azure Search service. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the query keys for the Azure Search service. + * + * @return the value value + */ + public List value() { + return this.value; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/PageImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/PageImpl.java new file mode 100644 index 0000000000000..e497f555e39a8 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/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.searchmanagementclient.v2015_02_28.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("") + 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/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeyInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeyInner.java new file mode 100644 index 0000000000000..721351e5e3a55 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeyInner.java @@ -0,0 +1,48 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an API key for a given Azure Search service that has permissions + * for query operations only. + */ +public class QueryKeyInner { + /** + * The name of the query API key; may be empty. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The value of the query API key. + */ + @JsonProperty(value = "key", access = JsonProperty.Access.WRITE_ONLY) + private String key; + + /** + * Get the name of the query API key; may be empty. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the value of the query API key. + * + * @return the key value + */ + public String key() { + return this.key; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeysImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeysImpl.java new file mode 100644 index 0000000000000..bd6816c054d4e --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeysImpl.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. + * abc + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.QueryKeys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.ListQueryKeysResult; + +class QueryKeysImpl extends WrapperImpl implements QueryKeys { + private final SearchManager manager; + + QueryKeysImpl(SearchManager manager) { + super(manager.inner().queryKeys()); + this.manager = manager; + } + + public SearchManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String resourceGroupName, String serviceName) { + QueryKeysInner client = this.inner(); + return client.listAsync(resourceGroupName, serviceName) + .map(new Func1() { + @Override + public ListQueryKeysResult call(ListQueryKeysResultInner inner) { + return new ListQueryKeysResultImpl(inner, manager()); + } + }); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeysInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeysInner.java new file mode 100644 index 0000000000000..638b94863ca06 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/QueryKeysInner.java @@ -0,0 +1,146 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in QueryKeys. + */ +public class QueryKeysInner { + /** The Retrofit service to perform REST calls. */ + private QueryKeysService service; + /** The service client containing this operation class. */ + private SearchManagementClientImpl client; + + /** + * Initializes an instance of QueryKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueryKeysInner(Retrofit retrofit, SearchManagementClientImpl client) { + this.service = retrofit.create(QueryKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for QueryKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface QueryKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_02_28.QueryKeys list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}/listQueryKeys") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list query keys. + * @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 ListQueryKeysResultInner object if successful. + */ + public ListQueryKeysResultInner list(String resourceGroupName, String serviceName) { + return listWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list query keys. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceGroupName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list query keys. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ListQueryKeysResultInner object + */ + public Observable listAsync(String resourceGroupName, String serviceName) { + return listWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, ListQueryKeysResultInner>() { + @Override + public ListQueryKeysResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service for which to list query keys. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ListQueryKeysResultInner object + */ + public Observable> listWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName 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, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchManagementClientImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchManagementClientImpl.java new file mode 100644 index 0000000000000..e103a87c322f9 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchManagementClientImpl.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.searchmanagementclient.v2015_02_28.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 SearchManagementClientImpl class. + */ +public class SearchManagementClientImpl 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; + } + + /** Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets 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 Gets 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 SearchManagementClientImpl 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; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SearchManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * 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 SearchManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SearchManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The AdminKeysInner object to access its operations. + */ + private AdminKeysInner adminKeys; + + /** + * Gets the AdminKeysInner object to access its operations. + * @return the AdminKeysInner object. + */ + public AdminKeysInner adminKeys() { + return this.adminKeys; + } + + /** + * The QueryKeysInner object to access its operations. + */ + private QueryKeysInner queryKeys; + + /** + * Gets the QueryKeysInner object to access its operations. + * @return the QueryKeysInner object. + */ + public QueryKeysInner queryKeys() { + return this.queryKeys; + } + + /** + * The ServicesInner object to access its operations. + */ + private ServicesInner services; + + /** + * Gets the ServicesInner object to access its operations. + * @return the ServicesInner object. + */ + public ServicesInner services() { + return this.services; + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SearchManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SearchManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SearchManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-02-28"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.adminKeys = new AdminKeysInner(restClient().retrofit(), this); + this.queryKeys = new QueryKeysInner(restClient().retrofit(), this); + this.services = new ServicesInner(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, auto-generated)", super.userAgent(), "SearchManagementClient", "2015-02-28"); + } +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchManager.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchManager.java new file mode 100644 index 0000000000000..eb3dce9feec82 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchManager.java @@ -0,0 +1,123 @@ +/** + * 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.searchmanagementclient.v2015_02_28.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.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.AdminKeys; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.QueryKeys; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.Services; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Search resource management. + */ +public final class SearchManager extends ManagerCore { + private AdminKeys adminKeys; + private QueryKeys queryKeys; + private Services services; + /** + * Get a Configurable instance that can be used to create SearchManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SearchManager.ConfigurableImpl(); + } + /** + * Creates an instance of SearchManager that exposes Search resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SearchManager + */ + public static SearchManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SearchManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SearchManager that exposes Search resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SearchManager + */ + public static SearchManager authenticate(RestClient restClient, String subscriptionId) { + return new SearchManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SearchManager that exposes Search management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Search management API entry points that work across subscriptions + */ + SearchManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage AdminKeys. + */ + public AdminKeys adminKeys() { + if (this.adminKeys == null) { + this.adminKeys = new AdminKeysImpl(this); + } + return this.adminKeys; + } + + /** + * @return Entry point to manage QueryKeys. + */ + public QueryKeys queryKeys() { + if (this.queryKeys == null) { + this.queryKeys = new QueryKeysImpl(this); + } + return this.queryKeys; + } + + /** + * @return Entry point to manage Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(this); + } + return this.services; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SearchManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SearchManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SearchManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SearchManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchServiceResourceImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchServiceResourceImpl.java new file mode 100644 index 0000000000000..5eb4f45329669 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchServiceResourceImpl.java @@ -0,0 +1,145 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceCreateOrUpdateParameters; +import java.util.Map; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceReadableProperties; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceProperties; +import rx.functions.Func1; + +class SearchServiceResourceImpl extends CreatableUpdatableImpl implements SearchServiceResource, SearchServiceResource.Definition, SearchServiceResource.Update { + private String resourceGroupName; + private String serviceName; + private SearchServiceCreateOrUpdateParameters createOrUpdateParameter; + private final SearchManager manager; + + SearchServiceResourceImpl(String name, SearchManager manager) { + super(name, new SearchServiceResourceInner()); + this.manager = manager; + // Set resource name + this.serviceName = name; + // + this.createOrUpdateParameter = new SearchServiceCreateOrUpdateParameters(); + } + + SearchServiceResourceImpl(SearchServiceResourceInner inner, SearchManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.serviceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.serviceName = IdParsingUtils.getValueFromIdByName(inner.id(), "searchServices"); + // set other parameters for create and update + this.createOrUpdateParameter = new SearchServiceCreateOrUpdateParameters(); + } + + @Override + public SearchManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServicesInner client = this.manager().inner().services(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SearchServiceResourceInner call(SearchServiceResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServicesInner client = this.manager().inner().services(); + return client.createOrUpdateAsync(this.resourceGroupName, this.serviceName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SearchServiceResourceInner call(SearchServiceResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServicesInner client = this.manager().inner().services(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SearchServiceCreateOrUpdateParameters(); + } + + @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 SearchServiceReadableProperties properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public SearchServiceResourceImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public SearchServiceResourceImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SearchServiceResourceImpl withProperties(SearchServiceProperties properties) { + this.createOrUpdateParameter.withProperties(properties); + return this; + } + + @Override + public SearchServiceResourceImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchServiceResourceInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchServiceResourceInner.java new file mode 100644 index 0000000000000..4e57e4ba885c8 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/SearchServiceResourceInner.java @@ -0,0 +1,127 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation; + +import java.util.Map; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceReadableProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an Azure Search service and its current state. + */ +public class SearchServiceResourceInner { + /** + * The resource Id of the Azure Search service. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the Search service. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The geographic location of the Search service. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Tags to help categorize the Search service in the Azure Portal. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Properties of the Search service. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private SearchServiceReadableProperties properties; + + /** + * Get the resource Id of the Azure Search service. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name of the Search service. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Search service. + * + * @param name the name value to set + * @return the SearchServiceResourceInner object itself. + */ + public SearchServiceResourceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the geographic location of the Search service. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the geographic location of the Search service. + * + * @param location the location value to set + * @return the SearchServiceResourceInner object itself. + */ + public SearchServiceResourceInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get tags to help categorize the Search service in the Azure Portal. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set tags to help categorize the Search service in the Azure Portal. + * + * @param tags the tags value to set + * @return the SearchServiceResourceInner object itself. + */ + public SearchServiceResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get properties of the Search service. + * + * @return the properties value + */ + public SearchServiceReadableProperties properties() { + return this.properties; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ServicesImpl.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ServicesImpl.java new file mode 100644 index 0000000000000..9ec11a308b56c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ServicesImpl.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.Services; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceResource; + +class ServicesImpl extends WrapperImpl implements Services { + private PagedListConverter converter; + private final SearchManager manager; + + ServicesImpl(SearchManager manager) { + super(manager.inner().services()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(SearchServiceResourceInner inner) { + return Observable.just((SearchServiceResource) wrapModel(inner)); + } + }; + } + + public SearchManager manager() { + return this.manager; + } + + @Override + public SearchServiceResourceImpl define(String name) { + return wrapModel(name); + } + + private SearchServiceResourceImpl wrapModel(SearchServiceResourceInner inner) { + return new SearchServiceResourceImpl(inner, manager()); + } + + private SearchServiceResourceImpl wrapModel(String name) { + return new SearchServiceResourceImpl(name, this.manager()); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ServicesInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ServicesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public SearchServiceResource call(SearchServiceResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.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 void deleteByResourceGroup(String resourceGroupName, String name) { + this.deleteByResourceGroupAsync(resourceGroupName, name).await(); + } + + @Override + public Completable deleteByResourceGroupAsync(String resourceGroupName, String name) { + return this.inner().deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public ServiceFuture deleteByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback serviceCallback) { + return ServiceFuture.fromBody(deleteByResourceGroupAsync(resourceGroupName, name), serviceCallback); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ServicesInner.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ServicesInner.java new file mode 100644 index 0000000000000..f7986aebace0c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/ServicesInner.java @@ -0,0 +1,347 @@ +/** + * 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.searchmanagementclient.v2015_02_28.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.searchmanagementclient.v2015_02_28.SearchServiceCreateOrUpdateParameters; +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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Services. + */ +public class ServicesInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private ServicesService service; + /** The service client containing this operation class. */ + private SearchManagementClientImpl client; + + /** + * Initializes an instance of ServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServicesInner(Retrofit retrofit, SearchManagementClientImpl client) { + this.service = retrofit.create(ServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Services to be + * used by Retrofit to perform actually REST calls. + */ + interface ServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_02_28.Services createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @Path("subscriptionId") String subscriptionId, @Body SearchServiceCreateOrUpdateParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_02_28.Services delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serviceName") String serviceName, @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.searchmanagementclient.v2015_02_28.Services listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service to create or update. + * @param parameters The properties to set or update on the Search service. + * @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 SearchServiceResourceInner object if successful. + */ + public SearchServiceResourceInner createOrUpdate(String resourceGroupName, String serviceName, SearchServiceCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service to create or update. + * @param parameters The properties to set or update on the Search service. + * @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 serviceName, SearchServiceCreateOrUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters), serviceCallback); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service to create or update. + * @param parameters The properties to set or update on the Search service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serviceName, SearchServiceCreateOrUpdateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serviceName, parameters).map(new Func1, SearchServiceResourceInner>() { + @Override + public SearchServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service to create or update. + * @param parameters The properties to set or update on the Search service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serviceName, SearchServiceCreateOrUpdateParameters parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, serviceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), 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); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service 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 serviceName) { + deleteWithServiceResponseAsync(resourceGroupName, serviceName).toBlocking().single().body(); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service 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 serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serviceName), serviceCallback); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serviceName) { + return deleteWithServiceResponseAsync(resourceGroupName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceName The name of the Search service to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serviceName == null) { + throw new IllegalArgumentException("Parameter serviceName 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, serviceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Returns a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Returns a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @return the observable to the List<SearchServiceResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Returns a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. + * @return the observable to the List<SearchServiceResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(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."); + } + return service.listByResourceGroup(resourceGroupName, 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 = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> 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); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/package-info.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/implementation/package-info.java new file mode 100644 index 0000000000000..4277f898193e4 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/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 SearchManagementClient. + * Client that can be used to manage Azure Search services and API keys. + */ +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28.implementation; diff --git a/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/package-info.java b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/package-info.java new file mode 100644 index 0000000000000..b135497580d2d --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_02_28/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_02_28/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 SearchManagementClient. + * Client that can be used to manage Azure Search services and API keys. + */ +package com.microsoft.azure.management.searchmanagementclient.v2015_02_28; diff --git a/searchmanagementclient/resource-manager/v2015_08_19/pom.xml b/searchmanagementclient/resource-manager/v2015_08_19/pom.xml new file mode 100644 index 0000000000000..20fe654ac40dc --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.searchmanagementclient.v2015_08_19 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-search + 1.0.0-beta + jar + Microsoft Azure SDK for Search Management + This package contains Microsoft Search 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-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + 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/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeyKind.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeyKind.java new file mode 100644 index 0000000000000..9240607e368b7 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeyKind.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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AdminKeyKind. + */ +public enum AdminKeyKind { + /** Enum value primary. */ + PRIMARY("primary"), + + /** Enum value secondary. */ + SECONDARY("secondary"); + + /** The actual serialized value for a AdminKeyKind instance. */ + private String value; + + AdminKeyKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdminKeyKind instance. + * + * @param value the serialized value to parse. + * @return the parsed AdminKeyKind object, or null if unable to parse. + */ + @JsonCreator + public static AdminKeyKind fromString(String value) { + AdminKeyKind[] items = AdminKeyKind.values(); + for (AdminKeyKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeyResult.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeyResult.java new file mode 100644 index 0000000000000..5fb4fcf7ca283 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeyResult.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.SearchManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.AdminKeyResultInner; + +/** + * Type representing AdminKeyResult. + */ +public interface AdminKeyResult extends HasInner, HasManager { + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeys.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeys.java new file mode 100644 index 0000000000000..b909dff787557 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/AdminKeys.java @@ -0,0 +1,40 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.AdminKeysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AdminKeys. + */ +public interface AdminKeys extends HasInner { + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String searchServiceName); + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/CheckNameAvailabilityInput.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/CheckNameAvailabilityInput.java new file mode 100644 index 0000000000000..30c69f8982bad --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/CheckNameAvailabilityInput.java @@ -0,0 +1,81 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input of check name availability API. + */ +public class CheckNameAvailabilityInput { + /** + * The Search service name to validate. Search service names must only + * contain lowercase letters, digits or dashes, cannot use dash as the + * first two or last one characters, cannot contain consecutive dashes, and + * must be between 2 and 60 characters in length. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of the resource whose name is to be validated. This value must + * always be 'searchServices'. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of CheckNameAvailabilityInput class. + * @param name the Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + */ + public CheckNameAvailabilityInput() { + type = "searchServices"; + } + + /** + * Get the Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * + * @param name the name value to set + * @return the CheckNameAvailabilityInput object itself. + */ + public CheckNameAvailabilityInput withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of the resource whose name is to be validated. This value must always be 'searchServices'. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the resource whose name is to be validated. This value must always be 'searchServices'. + * + * @param type the type value to set + * @return the CheckNameAvailabilityInput object itself. + */ + public CheckNameAvailabilityInput withType(String type) { + this.type = type; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/CheckNameAvailabilityOutput.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/CheckNameAvailabilityOutput.java new file mode 100644 index 0000000000000..e933ca85adfe1 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/CheckNameAvailabilityOutput.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.searchmanagementclient.v2015_08_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.SearchManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.CheckNameAvailabilityOutputInner; + +/** + * Type representing CheckNameAvailabilityOutput. + */ +public interface CheckNameAvailabilityOutput extends HasInner, HasManager { + /** + * @return the isNameAvailable value. + */ + Boolean isNameAvailable(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the reason value. + */ + UnavailableNameReason reason(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/HostingMode.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/HostingMode.java new file mode 100644 index 0000000000000..6e5b2989afd9d --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/HostingMode.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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for HostingMode. + */ +public enum HostingMode { + /** Enum value default. */ + DEFAULT("default"), + + /** Enum value highDensity. */ + HIGH_DENSITY("highDensity"); + + /** The actual serialized value for a HostingMode instance. */ + private String value; + + HostingMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a HostingMode instance. + * + * @param value the serialized value to parse. + * @return the parsed HostingMode object, or null if unable to parse. + */ + @JsonCreator + public static HostingMode fromString(String value) { + HostingMode[] items = HostingMode.values(); + for (HostingMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Identity.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Identity.java new file mode 100644 index 0000000000000..d393dd262d674 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Identity.java @@ -0,0 +1,73 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'None', 'SystemAssigned'. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /** + * Get the principal ID of resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of resource. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'None', 'SystemAssigned'. + * + * @return the type value + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'None', 'SystemAssigned'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/IdentityType.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/IdentityType.java new file mode 100644 index 0000000000000..fd3e8c3436ed9 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/IdentityType.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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IdentityType. + */ +public enum IdentityType { + /** Enum value None. */ + NONE("None"), + + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a IdentityType instance. */ + private String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Operation.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Operation.java new file mode 100644 index 0000000000000..96e1ce086226d --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.SearchManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/OperationDisplay.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/OperationDisplay.java new file mode 100644 index 0000000000000..21f6fa4ab13f6 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/OperationDisplay.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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes the operation. + */ +public class OperationDisplay { + /** + * The friendly name of the resource provider. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * The operation type: read, write, delete, listKeys/action, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The friendly name of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the friendly name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the operation type: read, write, delete, listKeys/action, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the friendly name of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Operations.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Operations.java new file mode 100644 index 0000000000000..f523d462f1391 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Operations.java @@ -0,0 +1,27 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/ProvisioningState.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/ProvisioningState.java new file mode 100644 index 0000000000000..0805bfebe087a --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/ProvisioningState.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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ProvisioningState. + */ +public enum ProvisioningState { + /** Enum value succeeded. */ + SUCCEEDED("succeeded"), + + /** Enum value provisioning. */ + PROVISIONING("provisioning"), + + /** Enum value failed. */ + FAILED("failed"); + + /** The actual serialized value for a ProvisioningState instance. */ + private String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/QueryKey.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/QueryKey.java new file mode 100644 index 0000000000000..b3b76cf28797e --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/QueryKey.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.QueryKeyInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.SearchManager; + +/** + * Type representing QueryKey. + */ +public interface QueryKey extends HasInner, HasManager { + /** + * @return the key value. + */ + String keyVal(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/QueryKeys.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/QueryKeys.java new file mode 100644 index 0000000000000..4d615fcb12b66 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/QueryKeys.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.searchmanagementclient.v2015_08_19; + +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.QueryKeysInner; +import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; + +/** + * Type representing QueryKeys. + */ +public interface QueryKeys extends HasInner { + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBySearchServiceAsync(String resourceGroupName, String searchServiceName); + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String resourceGroupName, String searchServiceName, String name); + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String searchServiceName, String key); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchManagementRequestOptions.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchManagementRequestOptions.java new file mode 100644 index 0000000000000..4391d40869b1c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchManagementRequestOptions.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.searchmanagementclient.v2015_08_19; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for a set of operations. + */ +public class SearchManagementRequestOptions { + /** + * A client-generated GUID value that identifies this request. If + * specified, this will be included in response information as a way to + * track the request. + */ + @JsonProperty(value = "") + private UUID clientRequestId; + + /** + * Get a client-generated GUID value that identifies this request. If specified, this will be included in response information as a way to track the request. + * + * @return the clientRequestId value + */ + public UUID clientRequestId() { + return this.clientRequestId; + } + + /** + * Set a client-generated GUID value that identifies this request. If specified, this will be included in response information as a way to track the request. + * + * @param clientRequestId the clientRequestId value to set + * @return the SearchManagementRequestOptions object itself. + */ + public SearchManagementRequestOptions withClientRequestId(UUID clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchService.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchService.java new file mode 100644 index 0000000000000..f1c983db9c6fe --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchService.java @@ -0,0 +1,253 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.SearchManager; +import java.util.UUID; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.SearchServiceInner; + +/** + * Type representing SearchService. + */ +public interface SearchService extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the hostingMode value. + */ + HostingMode hostingMode(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the partitionCount value. + */ + Integer partitionCount(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the replicaCount value. + */ + Integer replicaCount(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the status value. + */ + SearchServiceStatus status(); + + /** + * @return the statusDetails value. + */ + String statusDetails(); + + /** + * The entirety of the SearchService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithSearchManagementRequestOptions, DefinitionStages.WithCreate { + } + + /** + * Grouping of SearchService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SearchService definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the SearchService definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the searchservice definition allowing to specify SearchManagementRequestOptions. + */ + interface WithSearchManagementRequestOptions { + /** + * Specifies searchManagementRequestOptions. + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the next definition stage +*/ + WithCreate withSearchManagementRequestOptions(SearchManagementRequestOptions searchManagementRequestOptions); + } + + /** + * The stage of the searchservice definition allowing to specify HostingMode. + */ + interface WithHostingMode { + /** + * Specifies hostingMode. + * @param hostingMode Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: 'default', 'highDensity' + * @return the next definition stage + */ + WithCreate withHostingMode(HostingMode hostingMode); + } + + /** + * The stage of the searchservice definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the resource + * @return the next definition stage + */ + WithCreate withIdentity(Identity identity); + } + + /** + * The stage of the searchservice definition allowing to specify PartitionCount. + */ + interface WithPartitionCount { + /** + * Specifies partitionCount. + * @param partitionCount The number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3 + * @return the next definition stage + */ + WithCreate withPartitionCount(Integer partitionCount); + } + + /** + * The stage of the searchservice definition allowing to specify ReplicaCount. + */ + interface WithReplicaCount { + /** + * Specifies replicaCount. + * @param replicaCount The number of replicas in the Search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU + * @return the next definition stage + */ + WithCreate withReplicaCount(Integer replicaCount); + } + + /** + * The stage of the searchservice definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service + * @return the next definition stage + */ + WithCreate withSku(Sku sku); + } + + /** + * 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, DefinitionStages.WithHostingMode, DefinitionStages.WithIdentity, DefinitionStages.WithPartitionCount, DefinitionStages.WithReplicaCount, DefinitionStages.WithSku { + } + } + /** + * The template for a SearchService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSearchManagementRequestOptions, UpdateStages.WithHostingMode, UpdateStages.WithIdentity, UpdateStages.WithPartitionCount, UpdateStages.WithReplicaCount, UpdateStages.WithSku { + } + + /** + * Grouping of SearchService update stages. + */ + interface UpdateStages { + /** + * The stage of the searchservice update allowing to specify SearchManagementRequestOptions. + */ + interface WithSearchManagementRequestOptions { + /** + * Specifies searchManagementRequestOptions. + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the next update stage + */ + Update withSearchManagementRequestOptions(SearchManagementRequestOptions searchManagementRequestOptions); + } + + /** + * The stage of the searchservice update allowing to specify HostingMode. + */ + interface WithHostingMode { + /** + * Specifies hostingMode. + * @param hostingMode Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: 'default', 'highDensity' + * @return the next update stage + */ + Update withHostingMode(HostingMode hostingMode); + } + + /** + * The stage of the searchservice update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the resource + * @return the next update stage + */ + Update withIdentity(Identity identity); + } + + /** + * The stage of the searchservice update allowing to specify PartitionCount. + */ + interface WithPartitionCount { + /** + * Specifies partitionCount. + * @param partitionCount The number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3 + * @return the next update stage + */ + Update withPartitionCount(Integer partitionCount); + } + + /** + * The stage of the searchservice update allowing to specify ReplicaCount. + */ + interface WithReplicaCount { + /** + * Specifies replicaCount. + * @param replicaCount The number of replicas in the Search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU + * @return the next update stage + */ + Update withReplicaCount(Integer replicaCount); + } + + /** + * The stage of the searchservice update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service + * @return the next update stage + */ + Update withSku(Sku sku); + } + + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchServiceStatus.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchServiceStatus.java new file mode 100644 index 0000000000000..ece918127c4bd --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SearchServiceStatus.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SearchServiceStatus. + */ +public enum SearchServiceStatus { + /** Enum value running. */ + RUNNING("running"), + + /** Enum value provisioning. */ + PROVISIONING("provisioning"), + + /** Enum value deleting. */ + DELETING("deleting"), + + /** Enum value degraded. */ + DEGRADED("degraded"), + + /** Enum value disabled. */ + DISABLED("disabled"), + + /** Enum value error. */ + ERROR("error"); + + /** The actual serialized value for a SearchServiceStatus instance. */ + private String value; + + SearchServiceStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SearchServiceStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SearchServiceStatus object, or null if unable to parse. + */ + @JsonCreator + public static SearchServiceStatus fromString(String value) { + SearchServiceStatus[] items = SearchServiceStatus.values(); + for (SearchServiceStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java new file mode 100644 index 0000000000000..bfec1f068a1c1 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Services.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation.ServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Services. + */ +public interface Services extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String name); + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Sku.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Sku.java new file mode 100644 index 0000000000000..09b8f256f22a6 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/Sku.java @@ -0,0 +1,51 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the SKU of an Azure Search Service, which determines price tier and + * capacity limits. + */ +public class Sku { + /** + * The SKU of the Search service. Valid values include: 'free': Shared + * service. 'basic': Dedicated service with up to 3 replicas. 'standard': + * Dedicated service with up to 12 partitions and 12 replicas. 'standard2': + * Similar to standard, but with more capacity per search unit. + * 'standard3': Offers maximum capacity per search unit with up to 12 + * partitions and 12 replicas (or up to 3 partitions with more indexes if + * you also set the hostingMode property to 'highDensity'). Possible values + * include: 'free', 'basic', 'standard', 'standard2', 'standard3'. + */ + @JsonProperty(value = "name") + private SkuName name; + + /** + * Get the SKU of the Search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': Offers maximum capacity per search unit with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). Possible values include: 'free', 'basic', 'standard', 'standard2', 'standard3'. + * + * @return the name value + */ + public SkuName name() { + return this.name; + } + + /** + * Set the SKU of the Search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': Offers maximum capacity per search unit with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). Possible values include: 'free', 'basic', 'standard', 'standard2', 'standard3'. + * + * @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/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SkuName.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SkuName.java new file mode 100644 index 0000000000000..bc9e880c3d0bb --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/SkuName.java @@ -0,0 +1,62 @@ +/** + * 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.searchmanagementclient.v2015_08_19; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SkuName. + */ +public enum SkuName { + /** Enum value free. */ + FREE("free"), + + /** Enum value basic. */ + BASIC("basic"), + + /** Enum value standard. */ + STANDARD("standard"), + + /** Enum value standard2. */ + STANDARD2("standard2"), + + /** Enum value standard3. */ + STANDARD3("standard3"); + + /** 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/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/UnavailableNameReason.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/UnavailableNameReason.java new file mode 100644 index 0000000000000..9387be237be58 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/UnavailableNameReason.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.searchmanagementclient.v2015_08_19; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnavailableNameReason. + */ +public final class UnavailableNameReason extends ExpandableStringEnum { + /** Static value Invalid for UnavailableNameReason. */ + public static final UnavailableNameReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for UnavailableNameReason. */ + public static final UnavailableNameReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a UnavailableNameReason from its string representation. + * @param name a name to look for + * @return the corresponding UnavailableNameReason + */ + @JsonCreator + public static UnavailableNameReason fromString(String name) { + return fromString(name, UnavailableNameReason.class); + } + + /** + * @return known UnavailableNameReason values + */ + public static Collection values() { + return values(UnavailableNameReason.class); + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeyResultImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeyResultImpl.java new file mode 100644 index 0000000000000..2e7a0ccaa745e --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeyResultImpl.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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeyResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class AdminKeyResultImpl extends WrapperImpl implements AdminKeyResult { + private final SearchManager manager; + AdminKeyResultImpl(AdminKeyResultInner inner, SearchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SearchManager manager() { + return this.manager; + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeyResultInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeyResultInner.java new file mode 100644 index 0000000000000..eba3eff1e56fc --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeyResultInner.java @@ -0,0 +1,48 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response containing the primary and secondary admin API keys for a given + * Azure Search service. + */ +public class AdminKeyResultInner { + /** + * The primary admin API key of the Search service. + */ + @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryKey; + + /** + * The secondary admin API key of the Search service. + */ + @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryKey; + + /** + * Get the primary admin API key of the Search service. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Get the secondary admin API key of the Search service. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeysImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeysImpl.java new file mode 100644 index 0000000000000..a53f8d37a51af --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeysImpl.java @@ -0,0 +1,55 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeyResult; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeyKind; + +class AdminKeysImpl extends WrapperImpl implements AdminKeys { + private final SearchManager manager; + + AdminKeysImpl(SearchManager manager) { + super(manager.inner().adminKeys()); + this.manager = manager; + } + + public SearchManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String searchServiceName) { + AdminKeysInner client = this.inner(); + return client.getAsync(resourceGroupName, searchServiceName) + .map(new Func1() { + @Override + public AdminKeyResult call(AdminKeyResultInner inner) { + return new AdminKeyResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + AdminKeysInner client = this.inner(); + return client.regenerateAsync(resourceGroupName, searchServiceName, keyKind) + .map(new Func1() { + @Override + public AdminKeyResult call(AdminKeyResultInner inner) { + return new AdminKeyResultImpl(inner, manager()); + } + }); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeysInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeysInner.java new file mode 100644 index 0000000000000..5d64107c1a42f --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/AdminKeysInner.java @@ -0,0 +1,434 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeyKind; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchManagementRequestOptions; +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.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AdminKeys. + */ +public class AdminKeysInner { + /** The Retrofit service to perform REST calls. */ + private AdminKeysService service; + /** The service client containing this operation class. */ + private SearchManagementClientImpl client; + + /** + * Initializes an instance of AdminKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AdminKeysInner(Retrofit retrofit, SearchManagementClientImpl client) { + this.service = retrofit.create(AdminKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for AdminKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface AdminKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeys get" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeys regenerate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}") + Observable> regenerate(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("keyKind") AdminKeyKind keyKind, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 AdminKeyResultInner object if successful. + */ + public AdminKeyResultInner get(String resourceGroupName, String searchServiceName) { + return getWithServiceResponseAsync(resourceGroupName, searchServiceName).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 searchServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, searchServiceName), serviceCallback); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable getAsync(String resourceGroupName, String searchServiceName) { + return getWithServiceResponseAsync(resourceGroupName, searchServiceName).map(new Func1, AdminKeyResultInner>() { + @Override + public AdminKeyResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String searchServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.get(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + } + }); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the 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 AdminKeyResultInner object if successful. + */ + public AdminKeyResultInner get(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return getWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions), serviceCallback); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable getAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return getWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).map(new Func1, AdminKeyResultInner>() { + @Override + public AdminKeyResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the primary and secondary admin API keys for the specified Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.get(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @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 AdminKeyResultInner object if successful. + */ + public AdminKeyResultInner regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + return regenerateWithServiceResponseAsync(resourceGroupName, searchServiceName, keyKind).toBlocking().single().body(); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @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 regenerateAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateWithServiceResponseAsync(resourceGroupName, searchServiceName, keyKind), serviceCallback); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable regenerateAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + return regenerateWithServiceResponseAsync(resourceGroupName, searchServiceName, keyKind).map(new Func1, AdminKeyResultInner>() { + @Override + public AdminKeyResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable> regenerateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.regenerate(resourceGroupName, searchServiceName, keyKind, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @param searchManagementRequestOptions Additional parameters for the 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 AdminKeyResultInner object if successful. + */ + public AdminKeyResultInner regenerate(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind, SearchManagementRequestOptions searchManagementRequestOptions) { + return regenerateWithServiceResponseAsync(resourceGroupName, searchServiceName, keyKind, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 regenerateAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateWithServiceResponseAsync(resourceGroupName, searchServiceName, keyKind, searchManagementRequestOptions), serviceCallback); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable regenerateAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind, SearchManagementRequestOptions searchManagementRequestOptions) { + return regenerateWithServiceResponseAsync(resourceGroupName, searchServiceName, keyKind, searchManagementRequestOptions).map(new Func1, AdminKeyResultInner>() { + @Override + public AdminKeyResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param keyKind Specifies which key to regenerate. Valid values include 'primary' and 'secondary'. Possible values include: 'primary', 'secondary' + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AdminKeyResultInner object + */ + public Observable> regenerateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, AdminKeyKind keyKind, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.regenerate(resourceGroupName, searchServiceName, keyKind, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/CheckNameAvailabilityOutputImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/CheckNameAvailabilityOutputImpl.java new file mode 100644 index 0000000000000..4eaa11c55295d --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/CheckNameAvailabilityOutputImpl.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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.CheckNameAvailabilityOutput; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.UnavailableNameReason; + +class CheckNameAvailabilityOutputImpl extends WrapperImpl implements CheckNameAvailabilityOutput { + private final SearchManager manager; + CheckNameAvailabilityOutputImpl(CheckNameAvailabilityOutputInner inner, SearchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SearchManager manager() { + return this.manager; + } + + @Override + public Boolean isNameAvailable() { + return this.inner().isNameAvailable(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public UnavailableNameReason reason() { + return this.inner().reason(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/CheckNameAvailabilityOutputInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/CheckNameAvailabilityOutputInner.java new file mode 100644 index 0000000000000..2af2bcb06b4ed --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/CheckNameAvailabilityOutputInner.java @@ -0,0 +1,69 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.UnavailableNameReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Output of check name availability API. + */ +public class CheckNameAvailabilityOutputInner { + /** + * A value indicating whether the name is available. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isNameAvailable; + + /** + * The reason why the name is not available. 'Invalid' indicates the name + * provided does not match the naming requirements (incorrect length, + * unsupported characters, etc.). 'AlreadyExists' indicates that the name + * is already in use and is therefore unavailable. Possible values include: + * 'Invalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private UnavailableNameReason reason; + + /** + * A message that explains why the name is invalid and provides resource + * naming requirements. Available only if 'Invalid' is returned in the + * 'reason' property. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get a value indicating whether the name is available. + * + * @return the isNameAvailable value + */ + public Boolean isNameAvailable() { + return this.isNameAvailable; + } + + /** + * Get the reason why the name is not available. 'Invalid' indicates the name provided does not match the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public UnavailableNameReason reason() { + return this.reason; + } + + /** + * Get a message that explains why the name is invalid and provides resource naming requirements. Available only if 'Invalid' is returned in the 'reason' property. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/IdParsingUtils.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..f8d1bc97a9b05 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public 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; + } + + public 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/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationImpl.java new file mode 100644 index 0000000000000..76967523a96b8 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationImpl.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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final SearchManager manager; + OperationImpl(OperationInner inner, SearchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SearchManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationInner.java new file mode 100644 index 0000000000000..56e68223412b7 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationInner.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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a REST API operation. + */ +public class OperationInner { + /** + * The name of the operation. This name is of the form + * {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that describes the operation. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** + * Get the name of the operation. This name is of the form {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that describes the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationsImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..4425b381498a0 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationsImpl.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. + * abc + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Operations; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final SearchManager manager; + + OperationsImpl(SearchManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public SearchManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationsInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationsInner.java new file mode 100644 index 0000000000000..3bea5954506ae --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/OperationsInner.java @@ -0,0 +1,134 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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.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 SearchManagementClientImpl 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, SearchManagementClientImpl 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.searchmanagementclient.v2015_08_19.Operations list" }) + @GET("providers/Microsoft.Search/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @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 List<OperationInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @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 ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Search provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws 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/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/PageImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/PageImpl.java new file mode 100644 index 0000000000000..f3b2da0b37f3b --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/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.searchmanagementclient.v2015_08_19.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("") + 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/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeyImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeyImpl.java new file mode 100644 index 0000000000000..ad17db68c5425 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeyImpl.java @@ -0,0 +1,40 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKey; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class QueryKeyImpl extends WrapperImpl implements QueryKey { + private final SearchManager manager; + + QueryKeyImpl(QueryKeyInner inner, SearchManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SearchManager manager() { + return this.manager; + } + + + + @Override + public String keyVal() { + return this.inner().key(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeyInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeyInner.java new file mode 100644 index 0000000000000..46df6e3a9483d --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeyInner.java @@ -0,0 +1,48 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes an API key for a given Azure Search service that has permissions + * for query operations only. + */ +public class QueryKeyInner { + /** + * The name of the query API key; may be empty. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The value of the query API key. + */ + @JsonProperty(value = "key", access = JsonProperty.Access.WRITE_ONLY) + private String key; + + /** + * Get the name of the query API key; may be empty. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the value of the query API key. + * + * @return the key value + */ + public String key() { + return this.key; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeysImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeysImpl.java new file mode 100644 index 0000000000000..88722d305a14f --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeysImpl.java @@ -0,0 +1,72 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKeys; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKey; +import rx.Completable; + +class QueryKeysImpl extends WrapperImpl implements QueryKeys { + private final SearchManager manager; + + QueryKeysImpl(SearchManager manager) { + super(manager.inner().queryKeys()); + this.manager = manager; + } + + public SearchManager manager() { + return this.manager; + } + + private QueryKeyImpl wrapModel(QueryKeyInner inner) { + return new QueryKeyImpl(inner, manager()); + } + + @Override + public Observable listBySearchServiceAsync(String resourceGroupName, String searchServiceName) { + QueryKeysInner client = this.inner(); + return client.listBySearchServiceAsync(resourceGroupName, searchServiceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public QueryKey call(QueryKeyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable createAsync(String resourceGroupName, String searchServiceName, String name) { + QueryKeysInner client = this.inner(); + return client.createAsync(resourceGroupName, searchServiceName, name) + .map(new Func1() { + @Override + public QueryKey call(QueryKeyInner inner) { + return new QueryKeyImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String searchServiceName, String key) { + QueryKeysInner client = this.inner(); + return client.deleteAsync(resourceGroupName, searchServiceName, key).toCompletable(); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeysInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeysInner.java new file mode 100644 index 0000000000000..679c4f521a886 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/QueryKeysInner.java @@ -0,0 +1,640 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchManagementRequestOptions; +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 java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in QueryKeys. + */ +public class QueryKeysInner { + /** The Retrofit service to perform REST calls. */ + private QueryKeysService service; + /** The service client containing this operation class. */ + private SearchManagementClientImpl client; + + /** + * Initializes an instance of QueryKeysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public QueryKeysInner(Retrofit retrofit, SearchManagementClientImpl client) { + this.service = retrofit.create(QueryKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for QueryKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface QueryKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKeys create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKeys listBySearchService" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys") + Observable> listBySearchService(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKeys delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("key") String key, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @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 QueryKeyInner object if successful. + */ + public QueryKeyInner create(String resourceGroupName, String searchServiceName, String name) { + return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name).toBlocking().single().body(); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String searchServiceName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, searchServiceName, name), serviceCallback); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryKeyInner object + */ + public Observable createAsync(String resourceGroupName, String searchServiceName, String name) { + return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name).map(new Func1, QueryKeyInner>() { + @Override + public QueryKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryKeyInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String name) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.create(resourceGroupName, searchServiceName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param searchManagementRequestOptions Additional parameters for the 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 QueryKeyInner object if successful. + */ + public QueryKeyInner create(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptions searchManagementRequestOptions) { + return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param searchManagementRequestOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, searchServiceName, name, searchManagementRequestOptions), serviceCallback); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryKeyInner object + */ + public Observable createAsync(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptions searchManagementRequestOptions) { + return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name, searchManagementRequestOptions).map(new Func1, QueryKeyInner>() { + @Override + public QueryKeyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Generates a new query key for the specified Search service. You can create up to 50 query keys per service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param name The name of the new query API key. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryKeyInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.create(resourceGroupName, searchServiceName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 List<QueryKeyInner> object if successful. + */ + public List listBySearchService(String resourceGroupName, String searchServiceName) { + return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName).toBlocking().single().body(); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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> listBySearchServiceAsync(String resourceGroupName, String searchServiceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName), serviceCallback); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryKeyInner> object + */ + public Observable> listBySearchServiceAsync(String resourceGroupName, String searchServiceName) { + return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryKeyInner> object + */ + public Observable>> listBySearchServiceWithServiceResponseAsync(String resourceGroupName, String searchServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.listBySearchService(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySearchServiceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the 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 List<QueryKeyInner> object if successful. + */ + public List listBySearchService(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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> listBySearchServiceAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions), serviceCallback); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryKeyInner> object + */ + public Observable> listBySearchServiceAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the list of query API keys for the given Azure Search service. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<QueryKeyInner> object + */ + public Observable>> listBySearchServiceWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.listBySearchService(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBySearchServiceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBySearchServiceDelegate(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); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by 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 + */ + public void delete(String resourceGroupName, String searchServiceName, String key) { + deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key).toBlocking().single().body(); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by 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 deleteAsync(String resourceGroupName, String searchServiceName, String key, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key), serviceCallback); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String searchServiceName, String key) { + return deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String key) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (key == null) { + throw new IllegalArgumentException("Parameter key 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.delete(resourceGroupName, searchServiceName, key, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + } + }); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param searchManagementRequestOptions Additional parameters for the 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 + */ + public void delete(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptions searchManagementRequestOptions) { + deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, String key, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key, searchManagementRequestOptions), serviceCallback); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptions searchManagementRequestOptions) { + return deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key, searchManagementRequestOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param key The query key to be deleted. Query keys are identified by value, not by name. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (key == null) { + throw new IllegalArgumentException("Parameter key is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.delete(resourceGroupName, searchServiceName, key, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchManagementClientImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchManagementClientImpl.java new file mode 100644 index 0000000000000..ec978b7d7fb66 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * 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.searchmanagementclient.v2015_08_19.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 SearchManagementClientImpl class. + */ +public class SearchManagementClientImpl 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; + } + + /** The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. */ + private String subscriptionId; + + /** + * Gets The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public SearchManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for each request. The current version is 2015-08-19. */ + private String apiVersion; + + /** + * Gets The API version to use for each request. The current version is 2015-08-19. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SearchManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * 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 SearchManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SearchManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * 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 AdminKeysInner object to access its operations. + */ + private AdminKeysInner adminKeys; + + /** + * Gets the AdminKeysInner object to access its operations. + * @return the AdminKeysInner object. + */ + public AdminKeysInner adminKeys() { + return this.adminKeys; + } + + /** + * The QueryKeysInner object to access its operations. + */ + private QueryKeysInner queryKeys; + + /** + * Gets the QueryKeysInner object to access its operations. + * @return the QueryKeysInner object. + */ + public QueryKeysInner queryKeys() { + return this.queryKeys; + } + + /** + * The ServicesInner object to access its operations. + */ + private ServicesInner services; + + /** + * Gets the ServicesInner object to access its operations. + * @return the ServicesInner object. + */ + public ServicesInner services() { + return this.services; + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SearchManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SearchManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SearchManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SearchManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-08-19"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.adminKeys = new AdminKeysInner(restClient().retrofit(), this); + this.queryKeys = new QueryKeysInner(restClient().retrofit(), this); + this.services = new ServicesInner(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, auto-generated)", super.userAgent(), "SearchManagementClient", "2015-08-19"); + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchManager.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchManager.java new file mode 100644 index 0000000000000..ba898f44fa506 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchManager.java @@ -0,0 +1,135 @@ +/** + * 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.searchmanagementclient.v2015_08_19.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.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Operations; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.AdminKeys; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.QueryKeys; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Search resource management. + */ +public final class SearchManager extends ManagerCore { + private Operations operations; + private AdminKeys adminKeys; + private QueryKeys queryKeys; + private Services services; + /** + * Get a Configurable instance that can be used to create SearchManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SearchManager.ConfigurableImpl(); + } + /** + * Creates an instance of SearchManager that exposes Search resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SearchManager + */ + public static SearchManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SearchManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of SearchManager that exposes Search resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SearchManager + */ + public static SearchManager authenticate(RestClient restClient, String subscriptionId) { + return new SearchManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SearchManager that exposes Search management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Search management API entry points that work across subscriptions + */ + SearchManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage AdminKeys. + */ + public AdminKeys adminKeys() { + if (this.adminKeys == null) { + this.adminKeys = new AdminKeysImpl(this); + } + return this.adminKeys; + } + + /** + * @return Entry point to manage QueryKeys. + */ + public QueryKeys queryKeys() { + if (this.queryKeys == null) { + this.queryKeys = new QueryKeysImpl(this); + } + return this.queryKeys; + } + + /** + * @return Entry point to manage Services. + */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(this); + } + return this.services; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SearchManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SearchManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SearchManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SearchManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchServiceImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchServiceImpl.java new file mode 100644 index 0000000000000..e93f30c55254c --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchServiceImpl.java @@ -0,0 +1,156 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchService; +import rx.Observable; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchManagementRequestOptions; +import java.util.UUID; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Identity; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.HostingMode; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchServiceStatus; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.ProvisioningState; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Sku; +import rx.functions.Func1; + +class SearchServiceImpl extends GroupableResourceCoreImpl implements SearchService, SearchService.Definition, SearchService.Update { + private SearchManagementRequestOptions csearchManagementRequestOptions; + private SearchManagementRequestOptions usearchManagementRequestOptions; + SearchServiceImpl(String name, SearchServiceInner inner, SearchManager manager) { + super(name, inner, manager); + this.csearchManagementRequestOptions = new SearchManagementRequestOptions(); + this.usearchManagementRequestOptions = new SearchManagementRequestOptions(); + } + + @Override + public Observable createResourceAsync() { + ServicesInner client = this.manager().inner().services(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner(), this.csearchManagementRequestOptions) + .map(new Func1() { + @Override + public SearchServiceInner call(SearchServiceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServicesInner client = this.manager().inner().services(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner(), this.usearchManagementRequestOptions) + .map(new Func1() { + @Override + public SearchServiceInner call(SearchServiceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServicesInner client = this.manager().inner().services(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.csearchManagementRequestOptions = new SearchManagementRequestOptions(); + this.usearchManagementRequestOptions = new SearchManagementRequestOptions(); + } + + @Override + public HostingMode hostingMode() { + return this.inner().hostingMode(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public Integer partitionCount() { + return this.inner().partitionCount(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Integer replicaCount() { + return this.inner().replicaCount(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public SearchServiceStatus status() { + return this.inner().status(); + } + + @Override + public String statusDetails() { + return this.inner().statusDetails(); + } + + @Override + public SearchServiceImpl withSearchManagementRequestOptions(SearchManagementRequestOptions searchManagementRequestOptions) { + if (isInCreateMode()) { + this.csearchManagementRequestOptions = searchManagementRequestOptions; + } else { + this.usearchManagementRequestOptions = searchManagementRequestOptions; + } + return this; + } + + @Override + public SearchServiceImpl withHostingMode(HostingMode hostingMode) { + this.inner().withHostingMode(hostingMode); + return this; + } + + @Override + public SearchServiceImpl withIdentity(Identity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public SearchServiceImpl withPartitionCount(Integer partitionCount) { + this.inner().withPartitionCount(partitionCount); + return this; + } + + @Override + public SearchServiceImpl withReplicaCount(Integer replicaCount) { + this.inner().withReplicaCount(replicaCount); + return this; + } + + @Override + public SearchServiceImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchServiceInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchServiceInner.java new file mode 100644 index 0000000000000..581e8336deeb4 --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/SearchServiceInner.java @@ -0,0 +1,237 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.HostingMode; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchServiceStatus; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.ProvisioningState; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Sku; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Describes an Azure Search service and its current state. + */ +@JsonFlatten +@SkipParentValidation +public class SearchServiceInner extends Resource { + /** + * The number of replicas in the Search service. If specified, it must be a + * value between 1 and 12 inclusive for standard SKUs or between 1 and 3 + * inclusive for basic SKU. + */ + @JsonProperty(value = "properties.replicaCount") + private Integer replicaCount; + + /** + * The number of partitions in the Search service; if specified, it can be + * 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard + * SKUs. For 'standard3' services with hostingMode set to 'highDensity', + * the allowed values are between 1 and 3. + */ + @JsonProperty(value = "properties.partitionCount") + private Integer partitionCount; + + /** + * Applicable only for the standard3 SKU. You can set this property to + * enable up to 3 high density partitions that allow up to 1000 indexes, + * which is much higher than the maximum indexes allowed for any other SKU. + * For the standard3 SKU, the value is either 'default' or 'highDensity'. + * For all other SKUs, this value must be 'default'. Possible values + * include: 'default', 'highDensity'. + */ + @JsonProperty(value = "properties.hostingMode") + private HostingMode hostingMode; + + /** + * The status of the Search service. Possible values include: 'running': + * The Search service is running and no provisioning operations are + * underway. 'provisioning': The Search service is being provisioned or + * scaled up or down. 'deleting': The Search service is being deleted. + * 'degraded': The Search service is degraded. This can occur when the + * underlying search units are not healthy. The Search service is most + * likely operational, but performance might be slow and some requests + * might be dropped. 'disabled': The Search service is disabled. In this + * state, the service will reject all API requests. 'error': The Search + * service is in an error state. If your service is in the degraded, + * disabled, or error states, it means the Azure Search team is actively + * investigating the underlying issue. Dedicated services in these states + * are still chargeable based on the number of search units provisioned. + * Possible values include: 'running', 'provisioning', 'deleting', + * 'degraded', 'disabled', 'error'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private SearchServiceStatus status; + + /** + * The details of the Search service status. + */ + @JsonProperty(value = "properties.statusDetails", access = JsonProperty.Access.WRITE_ONLY) + private String statusDetails; + + /** + * The state of the last provisioning operation performed on the Search + * service. Provisioning is an intermediate state that occurs while service + * capacity is being established. After capacity is set up, + * provisioningState changes to either 'succeeded' or 'failed'. Client + * applications can poll provisioning status (the recommended polling + * interval is from 30 seconds to one minute) by using the Get Search + * Service operation to see when an operation is completed. If you are + * using the free service, this value tends to come back as 'succeeded' + * directly in the call to Create Search service. This is because the free + * service uses capacity that is already set up. Possible values include: + * 'succeeded', 'provisioning', 'failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The SKU of the Search Service, which determines price tier and capacity + * limits. This property is required when creating a new Search Service. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the number of replicas in the Search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @return the replicaCount value + */ + public Integer replicaCount() { + return this.replicaCount; + } + + /** + * Set the number of replicas in the Search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + * + * @param replicaCount the replicaCount value to set + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + * + * @return the partitionCount value + */ + public Integer partitionCount() { + return this.partitionCount; + } + + /** + * Set the number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + * + * @param partitionCount the partitionCount value to set + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withPartitionCount(Integer partitionCount) { + this.partitionCount = partitionCount; + return this; + } + + /** + * Get applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: 'default', 'highDensity'. + * + * @return the hostingMode value + */ + public HostingMode hostingMode() { + return this.hostingMode; + } + + /** + * Set applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: 'default', 'highDensity'. + * + * @param hostingMode the hostingMode value to set + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withHostingMode(HostingMode hostingMode) { + this.hostingMode = hostingMode; + return this; + } + + /** + * Get the status of the Search service. Possible values include: 'running': The Search service is running and no provisioning operations are underway. 'provisioning': The Search service is being provisioned or scaled up or down. 'deleting': The Search service is being deleted. 'degraded': The Search service is degraded. This can occur when the underlying search units are not healthy. The Search service is most likely operational, but performance might be slow and some requests might be dropped. 'disabled': The Search service is disabled. In this state, the service will reject all API requests. 'error': The Search service is in an error state. If your service is in the degraded, disabled, or error states, it means the Azure Search team is actively investigating the underlying issue. Dedicated services in these states are still chargeable based on the number of search units provisioned. Possible values include: 'running', 'provisioning', 'deleting', 'degraded', 'disabled', 'error'. + * + * @return the status value + */ + public SearchServiceStatus status() { + return this.status; + } + + /** + * Get the details of the Search service status. + * + * @return the statusDetails value + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the state of the last provisioning operation performed on the Search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as 'succeeded' directly in the call to Create Search service. This is because the free service uses capacity that is already set up. Possible values include: 'succeeded', 'provisioning', 'failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service. + * + * @param sku the sku value to set + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the identity of the resource. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity of the resource. + * + * @param identity the identity value to set + * @return the SearchServiceInner object itself. + */ + public SearchServiceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java new file mode 100644 index 0000000000000..df6f410e5bd3b --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesImpl.java @@ -0,0 +1,151 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchService; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.CheckNameAvailabilityOutput; + +class ServicesImpl extends GroupableResourcesCoreImpl implements Services { + protected ServicesImpl(SearchManager manager) { + super(manager.inner().services(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ServicesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.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) { + ServicesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ServicesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public SearchService call(SearchServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ServicesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ServicesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public SearchService call(SearchServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public SearchServiceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable checkNameAvailabilityAsync(String name) { + ServicesInner client = this.inner(); + return client.checkNameAvailabilityAsync(name) + .map(new Func1() { + @Override + public CheckNameAvailabilityOutput call(CheckNameAvailabilityOutputInner inner) { + return new CheckNameAvailabilityOutputImpl(inner, manager()); + } + }); + } + + @Override + protected SearchServiceImpl wrapModel(SearchServiceInner inner) { + return new SearchServiceImpl(inner.name(), inner, manager()); + } + + @Override + protected SearchServiceImpl wrapModel(String name) { + return new SearchServiceImpl(name, new SearchServiceInner(), this.manager()); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java new file mode 100644 index 0000000000000..f42279671768d --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/ServicesInner.java @@ -0,0 +1,1516 @@ +/** + * 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.searchmanagementclient.v2015_08_19.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.CheckNameAvailabilityInput; +import com.microsoft.azure.management.searchmanagementclient.v2015_08_19.SearchManagementRequestOptions; +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 java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Services. + */ +public class ServicesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ServicesService service; + /** The service client containing this operation class. */ + private SearchManagementClientImpl client; + + /** + * Initializes an instance of ServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServicesInner(Retrofit retrofit, SearchManagementClientImpl client) { + this.service = retrofit.create(ServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Services to be + * used by Retrofit to perform actually REST calls. + */ + interface ServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Body SearchServiceInner service, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Body SearchServiceInner service, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Body SearchServiceInner service, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.searchmanagementclient.v2015_08_19.Services checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Body CheckNameAvailabilityInput checkNameAvailabilityInput, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @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 SearchServiceInner object if successful. + */ + public SearchServiceInner createOrUpdate(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service).toBlocking().last().body(); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @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 searchServiceName, SearchServiceInner service, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service), serviceCallback); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 (service == null) { + throw new IllegalArgumentException("Parameter service is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(service); + final SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + Observable> observable = service.createOrUpdate(resourceGroupName, searchServiceName, this.client.subscriptionId(), service, this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the 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 SearchServiceInner object if successful. + */ + public SearchServiceInner createOrUpdate(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions).toBlocking().last().body(); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions), serviceCallback); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 (service == null) { + throw new IllegalArgumentException("Parameter service is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(service); + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + Observable> observable = service.createOrUpdate(resourceGroupName, searchServiceName, this.client.subscriptionId(), service, this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @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 SearchServiceInner object if successful. + */ + public SearchServiceInner beginCreateOrUpdate(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service).toBlocking().single().body(); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @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 searchServiceName, SearchServiceInner service, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service), serviceCallback); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 (service == null) { + throw new IllegalArgumentException("Parameter service is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(service); + final SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.beginCreateOrUpdate(resourceGroupName, searchServiceName, this.client.subscriptionId(), service, this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + } + }); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the 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 SearchServiceInner object if successful. + */ + public SearchServiceInner beginCreateOrUpdate(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions), serviceCallback); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a Search service in the given resource group. If the Search service already exists, all properties will be updated with the given values. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created. + * @param service The definition of the Search service to create or update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 (service == null) { + throw new IllegalArgumentException("Parameter service is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(service); + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.beginCreateOrUpdate(resourceGroupName, searchServiceName, this.client.subscriptionId(), service, this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @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 SearchServiceInner object if successful. + */ + public SearchServiceInner update(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + return updateWithServiceResponseAsync(resourceGroupName, searchServiceName, service).toBlocking().single().body(); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @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 searchServiceName, SearchServiceInner service, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, searchServiceName, service), serviceCallback); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable updateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + return updateWithServiceResponseAsync(resourceGroupName, searchServiceName, service).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 (service == null) { + throw new IllegalArgumentException("Parameter service is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(service); + final SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.update(resourceGroupName, searchServiceName, this.client.subscriptionId(), service, this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @param searchManagementRequestOptions Additional parameters for the 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 SearchServiceInner object if successful. + */ + public SearchServiceInner update(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + return updateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions), serviceCallback); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable updateAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + return updateWithServiceResponseAsync(resourceGroupName, searchServiceName, service, searchManagementRequestOptions).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing Search service in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service to update. + * @param service The definition of the Search service to update. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchServiceInner service, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 (service == null) { + throw new IllegalArgumentException("Parameter service is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(service); + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.update(resourceGroupName, searchServiceName, this.client.subscriptionId(), service, this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 SearchServiceInner object if successful. + */ + public SearchServiceInner getByResourceGroup(String resourceGroupName, String searchServiceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, searchServiceName).toBlocking().single().body(); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 searchServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, searchServiceName), serviceCallback); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String searchServiceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, searchServiceName).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String searchServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.getByResourceGroup(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + } + }); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the 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 SearchServiceInner object if successful. + */ + public SearchServiceInner getByResourceGroup(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions), serviceCallback); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).map(new Func1, SearchServiceInner>() { + @Override + public SearchServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Search service with the given name in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchServiceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.getByResourceGroup(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 searchServiceName) { + deleteWithServiceResponseAsync(resourceGroupName, searchServiceName).toBlocking().single().body(); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @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 searchServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, searchServiceName), serviceCallback); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String searchServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, searchServiceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName 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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.delete(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, 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); + } + } + }); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the 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 + */ + public void delete(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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 searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions), serviceCallback); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + return deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Search service in the given resource group, along with its associated resources. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchServiceName The name of the Azure Search service associated with the specified resource group. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptions searchManagementRequestOptions) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (searchServiceName == null) { + throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.delete(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @return the observable to the List<SearchServiceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @return the observable to the List<SearchServiceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(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 SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName, SearchManagementRequestOptions searchManagementRequestOptions) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName, searchManagementRequestOptions).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchManagementRequestOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName, searchManagementRequestOptions), serviceCallback); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the observable to the List<SearchServiceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName, SearchManagementRequestOptions searchManagementRequestOptions) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, searchManagementRequestOptions).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of all Search services in the given resource group. + * + * @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the observable to the List<SearchServiceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName, SearchManagementRequestOptions searchManagementRequestOptions) { + 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."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> 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); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @return the observable to the List<SearchServiceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @return the observable to the List<SearchServiceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the PagedList object if successful. + */ + public PagedList list(SearchManagementRequestOptions searchManagementRequestOptions) { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync(searchManagementRequestOptions).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(searchManagementRequestOptions), serviceCallback); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the observable to the List<SearchServiceInner> object + */ + public Observable> listAsync(SearchManagementRequestOptions searchManagementRequestOptions) { + return listWithServiceResponseAsync(searchManagementRequestOptions).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of all Search services in the given subscription. + * + * @param searchManagementRequestOptions Additional parameters for the operation + * @return the observable to the List<SearchServiceInner> object + */ + public Observable>> listWithServiceResponseAsync(SearchManagementRequestOptions searchManagementRequestOptions) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @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 CheckNameAvailabilityOutputInner object if successful. + */ + public CheckNameAvailabilityOutputInner checkNameAvailability(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @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 whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityOutputInner object + */ + public Observable checkNameAvailabilityAsync(String name) { + return checkNameAvailabilityWithServiceResponseAsync(name).map(new Func1, CheckNameAvailabilityOutputInner>() { + @Override + public CheckNameAvailabilityOutputInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityOutputInner 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."); + } + final SearchManagementRequestOptions searchManagementRequestOptions = null; + UUID clientRequestId = null; + CheckNameAvailabilityInput checkNameAvailabilityInput = new CheckNameAvailabilityInput(); + checkNameAvailabilityInput.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, checkNameAvailabilityInput, 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); + } + } + }); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @param searchManagementRequestOptions Additional parameters for the 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 CheckNameAvailabilityOutputInner object if successful. + */ + public CheckNameAvailabilityOutputInner checkNameAvailability(String name, SearchManagementRequestOptions searchManagementRequestOptions) { + return checkNameAvailabilityWithServiceResponseAsync(name, searchManagementRequestOptions).toBlocking().single().body(); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @param searchManagementRequestOptions Additional parameters for the operation + * @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, SearchManagementRequestOptions searchManagementRequestOptions, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(name, searchManagementRequestOptions), serviceCallback); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityOutputInner object + */ + public Observable checkNameAvailabilityAsync(String name, SearchManagementRequestOptions searchManagementRequestOptions) { + return checkNameAvailabilityWithServiceResponseAsync(name, searchManagementRequestOptions).map(new Func1, CheckNameAvailabilityOutputInner>() { + @Override + public CheckNameAvailabilityOutputInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks whether or not the given Search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). + * + * @param name The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. + * @param searchManagementRequestOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameAvailabilityOutputInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String name, SearchManagementRequestOptions searchManagementRequestOptions) { + 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."); + } + Validator.validate(searchManagementRequestOptions); + UUID clientRequestId = null; + if (searchManagementRequestOptions != null) { + clientRequestId = searchManagementRequestOptions.clientRequestId(); + } + CheckNameAvailabilityInput checkNameAvailabilityInput = new CheckNameAvailabilityInput(); + checkNameAvailabilityInput.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, checkNameAvailabilityInput, 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); + } + +} diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/package-info.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/implementation/package-info.java new file mode 100644 index 0000000000000..f03f8b26de3ab --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/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 SearchManagementClient. + * Client that can be used to manage Azure Search services and API keys. + */ +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19.implementation; diff --git a/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/package-info.java b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/package-info.java new file mode 100644 index 0000000000000..523ab93e5aabe --- /dev/null +++ b/searchmanagementclient/resource-manager/v2015_08_19/src/main/java/com/microsoft/azure/management/searchmanagementclient/v2015_08_19/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 SearchManagementClient. + * Client that can be used to manage Azure Search services and API keys. + */ +package com.microsoft.azure.management.searchmanagementclient.v2015_08_19;