azure_mgmt_search 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_search.gemspec +35 -0
- data/lib/azure_mgmt_search.rb +41 -0
- data/lib/azure_mgmt_search/admin_keys.rb +92 -0
- data/lib/azure_mgmt_search/models/admin_key_result.rb +66 -0
- data/lib/azure_mgmt_search/models/list_query_keys_result.rb +77 -0
- data/lib/azure_mgmt_search/models/provisioning_state.rb +17 -0
- data/lib/azure_mgmt_search/models/query_key.rb +66 -0
- data/lib/azure_mgmt_search/models/search_service_create_or_update_parameters.rb +84 -0
- data/lib/azure_mgmt_search/models/search_service_list_result.rb +78 -0
- data/lib/azure_mgmt_search/models/search_service_properties.rb +85 -0
- data/lib/azure_mgmt_search/models/search_service_readable_properties.rb +124 -0
- data/lib/azure_mgmt_search/models/search_service_resource.rb +102 -0
- data/lib/azure_mgmt_search/models/search_service_status.rb +20 -0
- data/lib/azure_mgmt_search/models/sku.rb +61 -0
- data/lib/azure_mgmt_search/models/sku_type.rb +17 -0
- data/lib/azure_mgmt_search/module_definition.rb +8 -0
- data/lib/azure_mgmt_search/query_keys.rb +91 -0
- data/lib/azure_mgmt_search/search_management_client.rb +76 -0
- data/lib/azure_mgmt_search/services.rb +232 -0
- data/lib/azure_mgmt_search/version.rb +8 -0
- metadata +151 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Search
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for SearchServiceStatus
|
10
|
+
#
|
11
|
+
module SearchServiceStatus
|
12
|
+
Running = "running"
|
13
|
+
Provisioning = "provisioning"
|
14
|
+
Deleting = "deleting"
|
15
|
+
Degraded = "degraded"
|
16
|
+
Disabled = "disabled"
|
17
|
+
Error = "error"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Search
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines the SKU of an Azure Search Service, which determines price tier
|
10
|
+
# and capacity limits.
|
11
|
+
#
|
12
|
+
class Sku
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [SkuType] Gets or sets the SKU of the Search service. Possible
|
17
|
+
# values include: 'free', 'standard', 'standard2'
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
#
|
21
|
+
# Validate the object. Throws ValidationError if validation fails.
|
22
|
+
#
|
23
|
+
def validate
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Serializes given Model object into Ruby Hash.
|
28
|
+
# @param object Model object to serialize.
|
29
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
30
|
+
#
|
31
|
+
def self.serialize_object(object)
|
32
|
+
object.validate
|
33
|
+
output_object = {}
|
34
|
+
|
35
|
+
serialized_property = object.name
|
36
|
+
output_object['name'] = serialized_property unless serialized_property.nil?
|
37
|
+
|
38
|
+
output_object
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Deserializes given Ruby Hash into Model object.
|
43
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
44
|
+
# @return [Sku] Deserialized object.
|
45
|
+
#
|
46
|
+
def self.deserialize_object(object)
|
47
|
+
return if object.nil?
|
48
|
+
output_object = Sku.new
|
49
|
+
|
50
|
+
deserialized_property = object['name']
|
51
|
+
if (!deserialized_property.nil? && !deserialized_property.empty?)
|
52
|
+
enum_is_valid = SkuType.constants.any? { |e| SkuType.const_get(e).to_s.downcase == deserialized_property.downcase }
|
53
|
+
warn 'Enum SkuType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
|
54
|
+
end
|
55
|
+
output_object.name = deserialized_property
|
56
|
+
|
57
|
+
output_object
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Search
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for SkuType
|
10
|
+
#
|
11
|
+
module SkuType
|
12
|
+
Free = "free"
|
13
|
+
Standard = "standard"
|
14
|
+
Standard2 = "standard2"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Search
|
7
|
+
#
|
8
|
+
# Client that can be used to manage Azure Search services and API keys.
|
9
|
+
#
|
10
|
+
class QueryKeys
|
11
|
+
include Azure::ARM::Search::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the QueryKeys class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the SearchManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Returns the list of query API keys for the given Azure Search service.
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The name of the resource group within
|
29
|
+
# the current subscription.
|
30
|
+
# @param service_name [String] The name of the Search service for which to
|
31
|
+
# list query keys.
|
32
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
33
|
+
# applied to HTTP request.
|
34
|
+
#
|
35
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
36
|
+
# response.
|
37
|
+
#
|
38
|
+
def list(resource_group_name, service_name, custom_headers = nil)
|
39
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
40
|
+
fail ArgumentError, 'service_name is nil' if service_name.nil?
|
41
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
42
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
43
|
+
request_headers = {}
|
44
|
+
|
45
|
+
# Set Headers
|
46
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
47
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
48
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}/listQueryKeys'
|
49
|
+
options = {
|
50
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
51
|
+
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
|
52
|
+
query_params: {'api-version' => @client.api_version},
|
53
|
+
headers: request_headers.merge(custom_headers || {})
|
54
|
+
}
|
55
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
56
|
+
promise = request.run_promise do |req|
|
57
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
promise = promise.then do |http_response|
|
61
|
+
status_code = http_response.status
|
62
|
+
response_content = http_response.body
|
63
|
+
unless status_code == 200
|
64
|
+
error_model = JSON.load(response_content)
|
65
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Create Result
|
69
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
70
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
71
|
+
# Deserialize Response
|
72
|
+
if status_code == 200
|
73
|
+
begin
|
74
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
75
|
+
unless parsed_response.nil?
|
76
|
+
parsed_response = ListQueryKeysResult.deserialize_object(parsed_response)
|
77
|
+
end
|
78
|
+
result.body = parsed_response
|
79
|
+
rescue Exception => e
|
80
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
result
|
85
|
+
end
|
86
|
+
|
87
|
+
promise.execute
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Search
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class SearchManagementClient < MsRestAzure::AzureServiceClient
|
11
|
+
include Azure::ARM::Search::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Gets Azure subscription credentials.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] Gets subscription credentials which uniquely identify
|
21
|
+
# Microsoft Azure subscription. The subscription ID forms part of the URI
|
22
|
+
# for every service call.
|
23
|
+
attr_accessor :subscription_id
|
24
|
+
|
25
|
+
# @return [String] Client Api Version.
|
26
|
+
attr_reader :api_version
|
27
|
+
|
28
|
+
# @return [String] Gets or sets the preferred language for the response.
|
29
|
+
attr_accessor :accept_language
|
30
|
+
|
31
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
32
|
+
# Running Operations. Default value is 30.
|
33
|
+
attr_accessor :long_running_operation_retry_timeout
|
34
|
+
|
35
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
36
|
+
# is generated and included in each request. Default is true.
|
37
|
+
attr_accessor :generate_client_request_id
|
38
|
+
|
39
|
+
# @return Subscription credentials which uniquely identify client
|
40
|
+
# subscription.
|
41
|
+
attr_accessor :credentials
|
42
|
+
|
43
|
+
# @return admin_keys
|
44
|
+
attr_reader :admin_keys
|
45
|
+
|
46
|
+
# @return query_keys
|
47
|
+
attr_reader :query_keys
|
48
|
+
|
49
|
+
# @return services
|
50
|
+
attr_reader :services
|
51
|
+
|
52
|
+
#
|
53
|
+
# Creates initializes a new instance of the SearchManagementClient class.
|
54
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
55
|
+
# @param base_url [String] the base URI of the service.
|
56
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
57
|
+
#
|
58
|
+
def initialize(credentials, base_url = nil, options = nil)
|
59
|
+
super(credentials, options)
|
60
|
+
@base_url = base_url || 'https://management.azure.com'
|
61
|
+
|
62
|
+
fail ArgumentError, 'credentials is nil' if credentials.nil?
|
63
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
|
64
|
+
@credentials = credentials
|
65
|
+
|
66
|
+
@admin_keys = AdminKeys.new(self)
|
67
|
+
@query_keys = QueryKeys.new(self)
|
68
|
+
@services = Services.new(self)
|
69
|
+
@api_version = '2015-02-28'
|
70
|
+
@accept_language = 'en-US'
|
71
|
+
@long_running_operation_retry_timeout = 30
|
72
|
+
@generate_client_request_id = true
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,232 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Search
|
7
|
+
#
|
8
|
+
# Client that can be used to manage Azure Search services and API keys.
|
9
|
+
#
|
10
|
+
class Services
|
11
|
+
include Azure::ARM::Search::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the Services class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the SearchManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Creates or updates a Search service in the given resource group. If the
|
27
|
+
# Search service already exists, all properties will be updated with the
|
28
|
+
# given values.
|
29
|
+
#
|
30
|
+
# @param resource_group_name [String] The name of the resource group within
|
31
|
+
# the current subscription.
|
32
|
+
# @param service_name [String] The name of the Search service to create or
|
33
|
+
# update.
|
34
|
+
# @param parameters [SearchServiceCreateOrUpdateParameters] The properties to
|
35
|
+
# set or update on the Search service.
|
36
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
37
|
+
# applied to HTTP request.
|
38
|
+
#
|
39
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
40
|
+
# response.
|
41
|
+
#
|
42
|
+
def create_or_update(resource_group_name, service_name, parameters, custom_headers = nil)
|
43
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
44
|
+
fail ArgumentError, 'service_name is nil' if service_name.nil?
|
45
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
46
|
+
parameters.validate unless parameters.nil?
|
47
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
48
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
49
|
+
request_headers = {}
|
50
|
+
|
51
|
+
# Set Headers
|
52
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
53
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
54
|
+
|
55
|
+
# Serialize Request
|
56
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
57
|
+
unless parameters.nil?
|
58
|
+
parameters = SearchServiceCreateOrUpdateParameters.serialize_object(parameters)
|
59
|
+
end
|
60
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
61
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}'
|
62
|
+
options = {
|
63
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
64
|
+
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
|
65
|
+
query_params: {'api-version' => @client.api_version},
|
66
|
+
body: request_content,
|
67
|
+
headers: request_headers.merge(custom_headers || {})
|
68
|
+
}
|
69
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
70
|
+
promise = request.run_promise do |req|
|
71
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
72
|
+
end
|
73
|
+
|
74
|
+
promise = promise.then do |http_response|
|
75
|
+
status_code = http_response.status
|
76
|
+
response_content = http_response.body
|
77
|
+
unless status_code == 200 || status_code == 201
|
78
|
+
error_model = JSON.load(response_content)
|
79
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Create Result
|
83
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
84
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
85
|
+
# Deserialize Response
|
86
|
+
if status_code == 200
|
87
|
+
begin
|
88
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
89
|
+
unless parsed_response.nil?
|
90
|
+
parsed_response = SearchServiceResource.deserialize_object(parsed_response)
|
91
|
+
end
|
92
|
+
result.body = parsed_response
|
93
|
+
rescue Exception => e
|
94
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
# Deserialize Response
|
98
|
+
if status_code == 201
|
99
|
+
begin
|
100
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
101
|
+
unless parsed_response.nil?
|
102
|
+
parsed_response = SearchServiceResource.deserialize_object(parsed_response)
|
103
|
+
end
|
104
|
+
result.body = parsed_response
|
105
|
+
rescue Exception => e
|
106
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
result
|
111
|
+
end
|
112
|
+
|
113
|
+
promise.execute
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Deletes a Search service in the given resource group, along with its
|
118
|
+
# associated resources.
|
119
|
+
#
|
120
|
+
# @param resource_group_name [String] The name of the resource group within
|
121
|
+
# the current subscription.
|
122
|
+
# @param service_name [String] The name of the Search service to delete.
|
123
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
124
|
+
# applied to HTTP request.
|
125
|
+
#
|
126
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
127
|
+
# response.
|
128
|
+
#
|
129
|
+
def delete(resource_group_name, service_name, custom_headers = nil)
|
130
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
131
|
+
fail ArgumentError, 'service_name is nil' if service_name.nil?
|
132
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
133
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
134
|
+
request_headers = {}
|
135
|
+
|
136
|
+
# Set Headers
|
137
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
138
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
139
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}'
|
140
|
+
options = {
|
141
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
142
|
+
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
|
143
|
+
query_params: {'api-version' => @client.api_version},
|
144
|
+
headers: request_headers.merge(custom_headers || {})
|
145
|
+
}
|
146
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
147
|
+
promise = request.run_promise do |req|
|
148
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
149
|
+
end
|
150
|
+
|
151
|
+
promise = promise.then do |http_response|
|
152
|
+
status_code = http_response.status
|
153
|
+
response_content = http_response.body
|
154
|
+
unless status_code == 200 || status_code == 404 || status_code == 204
|
155
|
+
error_model = JSON.load(response_content)
|
156
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
157
|
+
end
|
158
|
+
|
159
|
+
# Create Result
|
160
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
161
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
162
|
+
|
163
|
+
result
|
164
|
+
end
|
165
|
+
|
166
|
+
promise.execute
|
167
|
+
end
|
168
|
+
|
169
|
+
#
|
170
|
+
# Returns a list of all Search services in the given resource group.
|
171
|
+
#
|
172
|
+
# @param resource_group_name [String] The name of the resource group within
|
173
|
+
# the current subscription.
|
174
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
175
|
+
# applied to HTTP request.
|
176
|
+
#
|
177
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
178
|
+
# response.
|
179
|
+
#
|
180
|
+
def list(resource_group_name, custom_headers = nil)
|
181
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
182
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
183
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
184
|
+
request_headers = {}
|
185
|
+
|
186
|
+
# Set Headers
|
187
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
188
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
189
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices'
|
190
|
+
options = {
|
191
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
192
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
193
|
+
query_params: {'api-version' => @client.api_version},
|
194
|
+
headers: request_headers.merge(custom_headers || {})
|
195
|
+
}
|
196
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
197
|
+
promise = request.run_promise do |req|
|
198
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
199
|
+
end
|
200
|
+
|
201
|
+
promise = promise.then do |http_response|
|
202
|
+
status_code = http_response.status
|
203
|
+
response_content = http_response.body
|
204
|
+
unless status_code == 200
|
205
|
+
error_model = JSON.load(response_content)
|
206
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
207
|
+
end
|
208
|
+
|
209
|
+
# Create Result
|
210
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
211
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
212
|
+
# Deserialize Response
|
213
|
+
if status_code == 200
|
214
|
+
begin
|
215
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
216
|
+
unless parsed_response.nil?
|
217
|
+
parsed_response = SearchServiceListResult.deserialize_object(parsed_response)
|
218
|
+
end
|
219
|
+
result.body = parsed_response
|
220
|
+
rescue Exception => e
|
221
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
result
|
226
|
+
end
|
227
|
+
|
228
|
+
promise.execute
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
end
|