azure_mgmt_search 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34a9a8df8d15f74533884a2775f30c8c23d8d3df
4
+ data.tar.gz: 4e1135d29cf599789e3aec72817f20c1b29b5b35
5
+ SHA512:
6
+ metadata.gz: 153c647d04624da1c9d59d22c3243ab074fe913b56f67808ca6b50755cb55289b151b899751933d2cf596129b45c8311dcba58b123ee9ecafa1691609d725a15
7
+ data.tar.gz: af8ad298e74c335a7d7e8c586238a8554330c91ab661a4210c7e0644b3f752c97dc35f17f852768bb1e695d026469f8abaec04777a400a52a2d7f432c13d7825
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'azure_mgmt_search/module_definition'
9
+ require 'azure_mgmt_search/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_search'
13
+ spec.version = Azure::ARM::Search::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure Search Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure Search Management services.'
18
+ spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+ spec.add_development_dependency 'azure_mgmt_resources', '~> 0.2'
33
+
34
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
35
+ end
@@ -0,0 +1,41 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'ms_rest_azure'
20
+
21
+ module Azure::ARM::Search
22
+ autoload :AdminKeys, 'azure_mgmt_search/admin_keys.rb'
23
+ autoload :QueryKeys, 'azure_mgmt_search/query_keys.rb'
24
+ autoload :Services, 'azure_mgmt_search/services.rb'
25
+ autoload :SearchManagementClient, 'azure_mgmt_search/search_management_client.rb'
26
+
27
+ module Models
28
+ autoload :AdminKeyResult, 'azure_mgmt_search/models/admin_key_result.rb'
29
+ autoload :QueryKey, 'azure_mgmt_search/models/query_key.rb'
30
+ autoload :ListQueryKeysResult, 'azure_mgmt_search/models/list_query_keys_result.rb'
31
+ autoload :Sku, 'azure_mgmt_search/models/sku.rb'
32
+ autoload :SearchServiceProperties, 'azure_mgmt_search/models/search_service_properties.rb'
33
+ autoload :SearchServiceCreateOrUpdateParameters, 'azure_mgmt_search/models/search_service_create_or_update_parameters.rb'
34
+ autoload :SearchServiceReadableProperties, 'azure_mgmt_search/models/search_service_readable_properties.rb'
35
+ autoload :SearchServiceResource, 'azure_mgmt_search/models/search_service_resource.rb'
36
+ autoload :SearchServiceListResult, 'azure_mgmt_search/models/search_service_list_result.rb'
37
+ autoload :SkuType, 'azure_mgmt_search/models/sku_type.rb'
38
+ autoload :SearchServiceStatus, 'azure_mgmt_search/models/search_service_status.rb'
39
+ autoload :ProvisioningState, 'azure_mgmt_search/models/provisioning_state.rb'
40
+ end
41
+ end
@@ -0,0 +1,92 @@
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 AdminKeys
11
+ include Azure::ARM::Search::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the AdminKeys 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 primary and secondary API keys for the given Azure Search
27
+ # service.
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group within
30
+ # the current subscription.
31
+ # @param service_name [String] The name of the Search service for which to
32
+ # list admin keys.
33
+ # @param [Hash{String => String}] The hash of custom headers need to be
34
+ # applied to HTTP request.
35
+ #
36
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
37
+ # response.
38
+ #
39
+ def list(resource_group_name, service_name, custom_headers = nil)
40
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
41
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
42
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
43
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
44
+ request_headers = {}
45
+
46
+ # Set Headers
47
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
48
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
49
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{serviceName}/listAdminKeys'
50
+ options = {
51
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
52
+ path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
53
+ query_params: {'api-version' => @client.api_version},
54
+ headers: request_headers.merge(custom_headers || {})
55
+ }
56
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
57
+ promise = request.run_promise do |req|
58
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
59
+ end
60
+
61
+ promise = promise.then do |http_response|
62
+ status_code = http_response.status
63
+ response_content = http_response.body
64
+ unless status_code == 200
65
+ error_model = JSON.load(response_content)
66
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
67
+ end
68
+
69
+ # Create Result
70
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
71
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
72
+ # Deserialize Response
73
+ if status_code == 200
74
+ begin
75
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
76
+ unless parsed_response.nil?
77
+ parsed_response = AdminKeyResult.deserialize_object(parsed_response)
78
+ end
79
+ result.body = parsed_response
80
+ rescue Exception => e
81
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
82
+ end
83
+ end
84
+
85
+ result
86
+ end
87
+
88
+ promise.execute
89
+ end
90
+
91
+ end
92
+ end
@@ -0,0 +1,66 @@
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
+ # Response containing the primary and secondary API keys for a given Azure
10
+ # Search service.
11
+ #
12
+ class AdminKeyResult
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Gets the primary API key of the Search service.
17
+ attr_accessor :primary_key
18
+
19
+ # @return [String] Gets the secondary API key of the Search service.
20
+ attr_accessor :secondary_key
21
+
22
+ #
23
+ # Validate the object. Throws ValidationError if validation fails.
24
+ #
25
+ def validate
26
+ # Nothing to validate
27
+ end
28
+
29
+ #
30
+ # Serializes given Model object into Ruby Hash.
31
+ # @param object Model object to serialize.
32
+ # @return [Hash] Serialized object in form of Ruby Hash.
33
+ #
34
+ def self.serialize_object(object)
35
+ object.validate
36
+ output_object = {}
37
+
38
+ serialized_property = object.primary_key
39
+ output_object['primaryKey'] = serialized_property unless serialized_property.nil?
40
+
41
+ serialized_property = object.secondary_key
42
+ output_object['secondaryKey'] = serialized_property unless serialized_property.nil?
43
+
44
+ output_object
45
+ end
46
+
47
+ #
48
+ # Deserializes given Ruby Hash into Model object.
49
+ # @param object [Hash] Ruby Hash object to deserialize.
50
+ # @return [AdminKeyResult] Deserialized object.
51
+ #
52
+ def self.deserialize_object(object)
53
+ return if object.nil?
54
+ output_object = AdminKeyResult.new
55
+
56
+ deserialized_property = object['primaryKey']
57
+ output_object.primary_key = deserialized_property
58
+
59
+ deserialized_property = object['secondaryKey']
60
+ output_object.secondary_key = deserialized_property
61
+
62
+ output_object
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,77 @@
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
+ # Response containing the query API keys for a given Azure Search service.
10
+ #
11
+ class ListQueryKeysResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<QueryKey>] Gets the query keys for the Azure Search
16
+ # service.
17
+ attr_accessor :value
18
+
19
+ #
20
+ # Validate the object. Throws ValidationError if validation fails.
21
+ #
22
+ def validate
23
+ @value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
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.value
36
+ unless serialized_property.nil?
37
+ serializedArray = []
38
+ serialized_property.each do |element|
39
+ unless element.nil?
40
+ element = QueryKey.serialize_object(element)
41
+ end
42
+ serializedArray.push(element)
43
+ end
44
+ serialized_property = serializedArray
45
+ end
46
+ output_object['value'] = serialized_property unless serialized_property.nil?
47
+
48
+ output_object
49
+ end
50
+
51
+ #
52
+ # Deserializes given Ruby Hash into Model object.
53
+ # @param object [Hash] Ruby Hash object to deserialize.
54
+ # @return [ListQueryKeysResult] Deserialized object.
55
+ #
56
+ def self.deserialize_object(object)
57
+ return if object.nil?
58
+ output_object = ListQueryKeysResult.new
59
+
60
+ deserialized_property = object['value']
61
+ unless deserialized_property.nil?
62
+ deserialized_array = []
63
+ deserialized_property.each do |element1|
64
+ unless element1.nil?
65
+ element1 = QueryKey.deserialize_object(element1)
66
+ end
67
+ deserialized_array.push(element1)
68
+ end
69
+ deserialized_property = deserialized_array
70
+ end
71
+ output_object.value = deserialized_property
72
+
73
+ output_object
74
+ end
75
+ end
76
+ end
77
+ 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 ProvisioningState
10
+ #
11
+ module ProvisioningState
12
+ Succeeded = "succeeded"
13
+ Provisioning = "provisioning"
14
+ Failed = "failed"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,66 @@
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
+ # Describes an API key for a given Azure Search service that has
10
+ # permissions for query operations only.
11
+ #
12
+ class QueryKey
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Gets the name of the query API key; may be empty.
17
+ attr_accessor :name
18
+
19
+ # @return [String] Gets the value of the query API key.
20
+ attr_accessor :key
21
+
22
+ #
23
+ # Validate the object. Throws ValidationError if validation fails.
24
+ #
25
+ def validate
26
+ # Nothing to validate
27
+ end
28
+
29
+ #
30
+ # Serializes given Model object into Ruby Hash.
31
+ # @param object Model object to serialize.
32
+ # @return [Hash] Serialized object in form of Ruby Hash.
33
+ #
34
+ def self.serialize_object(object)
35
+ object.validate
36
+ output_object = {}
37
+
38
+ serialized_property = object.name
39
+ output_object['name'] = serialized_property unless serialized_property.nil?
40
+
41
+ serialized_property = object.key
42
+ output_object['key'] = serialized_property unless serialized_property.nil?
43
+
44
+ output_object
45
+ end
46
+
47
+ #
48
+ # Deserializes given Ruby Hash into Model object.
49
+ # @param object [Hash] Ruby Hash object to deserialize.
50
+ # @return [QueryKey] Deserialized object.
51
+ #
52
+ def self.deserialize_object(object)
53
+ return if object.nil?
54
+ output_object = QueryKey.new
55
+
56
+ deserialized_property = object['name']
57
+ output_object.name = deserialized_property
58
+
59
+ deserialized_property = object['key']
60
+ output_object.key = deserialized_property
61
+
62
+ output_object
63
+ end
64
+ end
65
+ end
66
+ end