vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+196
View File
@@ -0,0 +1,196 @@
package search
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/satori/uuid"
"net/http"
)
// AdminKeysClient is the client that can be used to manage Azure Search
// services and API keys.
type AdminKeysClient struct {
ManagementClient
}
// NewAdminKeysClient creates an instance of the AdminKeysClient client.
func NewAdminKeysClient(subscriptionID string) AdminKeysClient {
return NewAdminKeysClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewAdminKeysClientWithBaseURI creates an instance of the AdminKeysClient
// client.
func NewAdminKeysClientWithBaseURI(baseURI string, subscriptionID string) AdminKeysClient {
return AdminKeysClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get gets the primary and secondary admin API keys for the specified Azure
// Search service.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. clientRequestID is 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.
func (client AdminKeysClient) Get(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result AdminKeyResult, err error) {
req, err := client.GetPreparer(resourceGroupName, searchServiceName, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client AdminKeysClient) GetPreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client AdminKeysClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client AdminKeysClient) GetResponder(resp *http.Response) (result AdminKeyResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Regenerate regenerates either the primary or secondary admin API key. You
// can only regenerate one key at a time.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. keyKind is specifies which key
// to regenerate. Valid values include 'primary' and 'secondary'.
// clientRequestID is 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.
func (client AdminKeysClient) Regenerate(resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, clientRequestID *uuid.UUID) (result AdminKeyResult, err error) {
req, err := client.RegeneratePreparer(resourceGroupName, searchServiceName, keyKind, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", nil, "Failure preparing request")
return
}
resp, err := client.RegenerateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", resp, "Failure sending request")
return
}
result, err = client.RegenerateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.AdminKeysClient", "Regenerate", resp, "Failure responding to request")
}
return
}
// RegeneratePreparer prepares the Regenerate request.
func (client AdminKeysClient) RegeneratePreparer(resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"keyKind": autorest.Encode("path", keyKind),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// RegenerateSender sends the Regenerate request. The method will close the
// http.Response Body if it receives an error.
func (client AdminKeysClient) RegenerateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RegenerateResponder handles the response to the Regenerate request. The method always
// closes the http.Response Body.
func (client AdminKeysClient) RegenerateResponder(resp *http.Response) (result AdminKeyResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+53
View File
@@ -0,0 +1,53 @@
// Package search implements the Azure ARM Search service API version
// 2015-08-19.
//
// Client that can be used to manage Azure Search services and API keys.
package search
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Search
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Search.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
+200
View File
@@ -0,0 +1,200 @@
package search
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
// AdminKeyKind enumerates the values for admin key kind.
type AdminKeyKind string
const (
// Primary specifies the primary state for admin key kind.
Primary AdminKeyKind = "primary"
// Secondary specifies the secondary state for admin key kind.
Secondary AdminKeyKind = "secondary"
)
// HostingMode enumerates the values for hosting mode.
type HostingMode string
const (
// Default specifies the default state for hosting mode.
Default HostingMode = "default"
// HighDensity specifies the high density state for hosting mode.
HighDensity HostingMode = "highDensity"
)
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Failed specifies the failed state for provisioning state.
Failed ProvisioningState = "failed"
// Provisioning specifies the provisioning state for provisioning state.
Provisioning ProvisioningState = "provisioning"
// Succeeded specifies the succeeded state for provisioning state.
Succeeded ProvisioningState = "succeeded"
)
// ServiceStatus enumerates the values for service status.
type ServiceStatus string
const (
// ServiceStatusDegraded specifies the service status degraded state for
// service status.
ServiceStatusDegraded ServiceStatus = "degraded"
// ServiceStatusDeleting specifies the service status deleting state for
// service status.
ServiceStatusDeleting ServiceStatus = "deleting"
// ServiceStatusDisabled specifies the service status disabled state for
// service status.
ServiceStatusDisabled ServiceStatus = "disabled"
// ServiceStatusError specifies the service status error state for service
// status.
ServiceStatusError ServiceStatus = "error"
// ServiceStatusProvisioning specifies the service status provisioning
// state for service status.
ServiceStatusProvisioning ServiceStatus = "provisioning"
// ServiceStatusRunning specifies the service status running state for
// service status.
ServiceStatusRunning ServiceStatus = "running"
)
// SkuName enumerates the values for sku name.
type SkuName string
const (
// Basic specifies the basic state for sku name.
Basic SkuName = "basic"
// Free specifies the free state for sku name.
Free SkuName = "free"
// Standard specifies the standard state for sku name.
Standard SkuName = "standard"
// Standard2 specifies the standard 2 state for sku name.
Standard2 SkuName = "standard2"
// Standard3 specifies the standard 3 state for sku name.
Standard3 SkuName = "standard3"
)
// UnavailableNameReason enumerates the values for unavailable name reason.
type UnavailableNameReason string
const (
// AlreadyExists specifies the already exists state for unavailable name
// reason.
AlreadyExists UnavailableNameReason = "AlreadyExists"
// Invalid specifies the invalid state for unavailable name reason.
Invalid UnavailableNameReason = "Invalid"
)
// AdminKeyResult is response containing the primary and secondary admin API
// keys for a given Azure Search service.
type AdminKeyResult struct {
autorest.Response `json:"-"`
PrimaryKey *string `json:"primaryKey,omitempty"`
SecondaryKey *string `json:"secondaryKey,omitempty"`
}
// CheckNameAvailabilityInput is input of check name availability API.
type CheckNameAvailabilityInput struct {
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
}
// CheckNameAvailabilityOutput is output of check name availability API.
type CheckNameAvailabilityOutput struct {
autorest.Response `json:"-"`
IsNameAvailable *bool `json:"nameAvailable,omitempty"`
Reason UnavailableNameReason `json:"reason,omitempty"`
Message *string `json:"message,omitempty"`
}
// CloudError is contains information about an API error.
type CloudError struct {
Error *CloudErrorBody `json:"error,omitempty"`
}
// CloudErrorBody is describes a particular API error with an error code and a
// message.
type CloudErrorBody struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Target *string `json:"target,omitempty"`
Details *[]CloudErrorBody `json:"details,omitempty"`
}
// ListQueryKeysResult is response containing the query API keys for a given
// Azure Search service.
type ListQueryKeysResult struct {
autorest.Response `json:"-"`
Value *[]QueryKey `json:"value,omitempty"`
}
// QueryKey is describes an API key for a given Azure Search service that has
// permissions for query operations only.
type QueryKey struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// Resource is base type for all Azure resources.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// Service is describes an Azure Search service and its current state.
type Service struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*ServiceProperties `json:"properties,omitempty"`
Sku *Sku `json:"sku,omitempty"`
}
// ServiceListResult is response containing a list of Azure Search services.
type ServiceListResult struct {
autorest.Response `json:"-"`
Value *[]Service `json:"value,omitempty"`
}
// ServiceProperties is properties of the Search service.
type ServiceProperties struct {
ReplicaCount *int32 `json:"replicaCount,omitempty"`
PartitionCount *int32 `json:"partitionCount,omitempty"`
HostingMode HostingMode `json:"hostingMode,omitempty"`
Status ServiceStatus `json:"status,omitempty"`
StatusDetails *string `json:"statusDetails,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// Sku is defines the SKU of an Azure Search Service, which determines price
// tier and capacity limits.
type Sku struct {
Name SkuName `json:"name,omitempty"`
}
+272
View File
@@ -0,0 +1,272 @@
package search
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/satori/uuid"
"net/http"
)
// QueryKeysClient is the client that can be used to manage Azure Search
// services and API keys.
type QueryKeysClient struct {
ManagementClient
}
// NewQueryKeysClient creates an instance of the QueryKeysClient client.
func NewQueryKeysClient(subscriptionID string) QueryKeysClient {
return NewQueryKeysClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewQueryKeysClientWithBaseURI creates an instance of the QueryKeysClient
// client.
func NewQueryKeysClientWithBaseURI(baseURI string, subscriptionID string) QueryKeysClient {
return QueryKeysClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create generates a new query key for the specified Search service. You can
// create up to 50 query keys per service.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. name is the name of the new
// query API key. clientRequestID is 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.
func (client QueryKeysClient) Create(resourceGroupName string, searchServiceName string, name string, clientRequestID *uuid.UUID) (result QueryKey, err error) {
req, err := client.CreatePreparer(resourceGroupName, searchServiceName, name, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", resp, "Failure sending request")
return
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Create", resp, "Failure responding to request")
}
return
}
// CreatePreparer prepares the Create request.
func (client QueryKeysClient) CreatePreparer(resourceGroupName string, searchServiceName string, name string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"name": autorest.Encode("path", name),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client QueryKeysClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client QueryKeysClient) CreateResponder(resp *http.Response) (result QueryKey, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete 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.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. key is the query key to be
// deleted. Query keys are identified by value, not by name. clientRequestID is
// 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.
func (client QueryKeysClient) Delete(resourceGroupName string, searchServiceName string, key string, clientRequestID *uuid.UUID) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, searchServiceName, key, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client QueryKeysClient) DeletePreparer(resourceGroupName string, searchServiceName string, key string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"key": autorest.Encode("path", key),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client QueryKeysClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client QueryKeysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
autorest.ByClosing())
result.Response = resp
return
}
// ListBySearchService returns the list of query API keys for the given Azure
// Search service.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. clientRequestID is 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.
func (client QueryKeysClient) ListBySearchService(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result ListQueryKeysResult, err error) {
req, err := client.ListBySearchServicePreparer(resourceGroupName, searchServiceName, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", nil, "Failure preparing request")
return
}
resp, err := client.ListBySearchServiceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", resp, "Failure sending request")
return
}
result, err = client.ListBySearchServiceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.QueryKeysClient", "ListBySearchService", resp, "Failure responding to request")
}
return
}
// ListBySearchServicePreparer prepares the ListBySearchService request.
func (client QueryKeysClient) ListBySearchServicePreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// ListBySearchServiceSender sends the ListBySearchService request. The method will close the
// http.Response Body if it receives an error.
func (client QueryKeysClient) ListBySearchServiceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListBySearchServiceResponder handles the response to the ListBySearchService request. The method always
// closes the http.Response Body.
func (client QueryKeysClient) ListBySearchServiceResponder(resp *http.Response) (result ListQueryKeysResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+446
View File
@@ -0,0 +1,446 @@
package search
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/satori/uuid"
"net/http"
)
// ServicesClient is the client that can be used to manage Azure Search
// services and API keys.
type ServicesClient struct {
ManagementClient
}
// NewServicesClient creates an instance of the ServicesClient client.
func NewServicesClient(subscriptionID string) ServicesClient {
return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewServicesClientWithBaseURI creates an instance of the ServicesClient
// client.
func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient {
return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CheckNameAvailability 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).
//
// checkNameAvailabilityInput is the resource name and type to check.
// clientRequestID is 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.
func (client ServicesClient) CheckNameAvailability(checkNameAvailabilityInput CheckNameAvailabilityInput, clientRequestID *uuid.UUID) (result CheckNameAvailabilityOutput, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: checkNameAvailabilityInput,
Constraints: []validation.Constraint{{Target: "checkNameAvailabilityInput.Name", Name: validation.Null, Rule: true, Chain: nil},
{Target: "checkNameAvailabilityInput.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "search.ServicesClient", "CheckNameAvailability")
}
req, err := client.CheckNameAvailabilityPreparer(checkNameAvailabilityInput, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request")
return
}
resp, err := client.CheckNameAvailabilitySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", resp, "Failure sending request")
return
}
result, err = client.CheckNameAvailabilityResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request")
}
return
}
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
func (client ServicesClient) CheckNameAvailabilityPreparer(checkNameAvailabilityInput CheckNameAvailabilityInput, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability", pathParameters),
autorest.WithJSON(checkNameAvailabilityInput),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
// http.Response Body if it receives an error.
func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
// closes the http.Response Body.
func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityOutput, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateOrUpdate 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.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is 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. service is the definition of
// the Search service to create or update. clientRequestID is 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.
func (client ServicesClient) CreateOrUpdate(resourceGroupName string, searchServiceName string, service Service, clientRequestID *uuid.UUID) (result Service, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: service,
Constraints: []validation.Constraint{{Target: "service.ServiceProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "service.ServiceProperties.ReplicaCount", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "service.ServiceProperties.ReplicaCount", Name: validation.InclusiveMaximum, Rule: 12, Chain: nil},
{Target: "service.ServiceProperties.ReplicaCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}},
{Target: "service.ServiceProperties.PartitionCount", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "service.ServiceProperties.PartitionCount", Name: validation.InclusiveMaximum, Rule: 12, Chain: nil},
{Target: "service.ServiceProperties.PartitionCount", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}},
}},
{Target: "service.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "search.ServicesClient", "CreateOrUpdate")
}
req, err := client.CreateOrUpdatePreparer(resourceGroupName, searchServiceName, service, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ServicesClient) CreateOrUpdatePreparer(resourceGroupName string, searchServiceName string, service Service, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters),
autorest.WithJSON(service),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result Service, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a Search service in the given resource group, along with its
// associated resources.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. clientRequestID is 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.
func (client ServicesClient) Delete(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, searchServiceName, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client ServicesClient) DeletePreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client ServicesClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets the Search service with the given name in the given resource group.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. searchServiceName is the name of the Azure Search service
// associated with the specified resource group. clientRequestID is 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.
func (client ServicesClient) Get(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (result Service, err error) {
req, err := client.GetPreparer(resourceGroupName, searchServiceName, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client ServicesClient) GetPreparer(resourceGroupName string, searchServiceName string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"searchServiceName": autorest.Encode("path", searchServiceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client ServicesClient) GetResponder(resp *http.Response) (result Service, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroup gets a list of all Search services in the given resource
// group.
//
// resourceGroupName is the name of the resource group within the current
// subscription. You can obtain this value from the Azure Resource Manager API
// or the portal. clientRequestID is 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.
func (client ServicesClient) ListByResourceGroup(resourceGroupName string, clientRequestID *uuid.UUID) (result ServiceListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName, clientRequestID)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "search.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client ServicesClient) ListByResourceGroupPreparer(resourceGroupName string, clientRequestID *uuid.UUID) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2015-08-19"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices", pathParameters),
autorest.WithQueryParameters(queryParameters))
if clientRequestID != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("x-ms-client-request-id", autorest.String(clientRequestID)))
}
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+29
View File
@@ -0,0 +1,29 @@
package search
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v10.1.0-beta arm-search/2015-08-19"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}