azure_mgmt_recovery_services 0.8.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: 72a125d832f3ccb14b5b50acdd9b283a53106660
4
+ data.tar.gz: 42b2ee6c2b761ecb51b656e4c9a1f1305b2231f1
5
+ SHA512:
6
+ metadata.gz: 73b854264f485fdfc562dffbad4e602b6abf76f6bb0c6170909ed62fd23f18af46233a11517f0145073122c009e02dbd07817d7cf5667dc46fb39ac562431149
7
+ data.tar.gz: e1ace4774a96e005d78d9e3a4f83e9b3dd78735f4798ce75fa4dbe37972181adb404f7953e2567d262015d34a8180ead194f3ba14db3004ba5b6f26eaf23c3e3
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.
@@ -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 'generated/azure_mgmt_recovery_services'
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.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 'generated/azure_mgmt_recovery_services/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::RecoveryServices
23
+ autoload :Vaults, 'generated/azure_mgmt_recovery_services/vaults.rb'
24
+ autoload :RecoveryServicesClient, 'generated/azure_mgmt_recovery_services/recovery_services_client.rb'
25
+
26
+ module Models
27
+ autoload :VaultProperties, 'generated/azure_mgmt_recovery_services/models/vault_properties.rb'
28
+ autoload :Sku, 'generated/azure_mgmt_recovery_services/models/sku.rb'
29
+ autoload :VaultList, 'generated/azure_mgmt_recovery_services/models/vault_list.rb'
30
+ autoload :Vault, 'generated/azure_mgmt_recovery_services/models/vault.rb'
31
+ autoload :SkuName, 'generated/azure_mgmt_recovery_services/models/sku_name.rb'
32
+ end
33
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ module Models
8
+ #
9
+ # Identifies the unique system identifier for each Azure resource.
10
+ #
11
+ class Sku
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [SkuName] The Sku name. Possible values include: 'Standard',
16
+ # 'RS0'
17
+ attr_accessor :name
18
+
19
+
20
+ #
21
+ # Mapper for Sku class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ required: false,
27
+ serialized_name: 'Sku',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'Sku',
31
+ model_properties: {
32
+ name: {
33
+ required: true,
34
+ serialized_name: 'name',
35
+ type: {
36
+ name: 'String'
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ module Models
8
+ #
9
+ # Defines values for SkuName
10
+ #
11
+ module SkuName
12
+ Standard = "Standard"
13
+ RS0 = "RS0"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,109 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ module Models
8
+ #
9
+ # Resource information, as returned by the resource provider.
10
+ #
11
+ class Vault < MsRestAzure::Resource
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] ETag of the Vault.
16
+ attr_accessor :etag
17
+
18
+ # @return [VaultProperties]
19
+ attr_accessor :properties
20
+
21
+
22
+ #
23
+ # Mapper for Vault class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ required: false,
29
+ serialized_name: 'Vault',
30
+ type: {
31
+ name: 'Composite',
32
+ class_name: 'Vault',
33
+ model_properties: {
34
+ id: {
35
+ required: false,
36
+ read_only: true,
37
+ serialized_name: 'id',
38
+ type: {
39
+ name: 'String'
40
+ }
41
+ },
42
+ name: {
43
+ required: false,
44
+ read_only: true,
45
+ serialized_name: 'name',
46
+ type: {
47
+ name: 'String'
48
+ }
49
+ },
50
+ type: {
51
+ required: false,
52
+ read_only: true,
53
+ serialized_name: 'type',
54
+ type: {
55
+ name: 'String'
56
+ }
57
+ },
58
+ location: {
59
+ required: false,
60
+ serialized_name: 'location',
61
+ type: {
62
+ name: 'String'
63
+ }
64
+ },
65
+ sku: {
66
+ required: false,
67
+ serialized_name: 'sku',
68
+ type: {
69
+ name: 'Composite',
70
+ class_name: 'Sku'
71
+ }
72
+ },
73
+ tags: {
74
+ required: false,
75
+ serialized_name: 'tags',
76
+ type: {
77
+ name: 'Dictionary',
78
+ value: {
79
+ required: false,
80
+ serialized_name: 'StringElementType',
81
+ type: {
82
+ name: 'String'
83
+ }
84
+ }
85
+ }
86
+ },
87
+ etag: {
88
+ required: false,
89
+ read_only: true,
90
+ serialized_name: 'etag',
91
+ type: {
92
+ name: 'String'
93
+ }
94
+ },
95
+ properties: {
96
+ required: false,
97
+ serialized_name: 'properties',
98
+ type: {
99
+ name: 'Composite',
100
+ class_name: 'VaultProperties'
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ module Models
8
+ #
9
+ # The response model for Vault.
10
+ #
11
+ class VaultList
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<Vault>]
16
+ attr_accessor :value
17
+
18
+ # return [Proc] with next page method call.
19
+ attr_accessor :next_method
20
+
21
+ #
22
+ # Gets the rest of the items for the request, enabling auto-pagination.
23
+ #
24
+ # @return [Array<Vault>] operation results.
25
+ #
26
+ def get_all_items
27
+ items = @value
28
+ page = self
29
+ while page.null != nil do
30
+ page = page.get_next_page
31
+ items.concat(page.value)
32
+ end
33
+ items
34
+ end
35
+
36
+ #
37
+ # Gets the next page of results.
38
+ #
39
+ # @return [VaultList] with next page content.
40
+ #
41
+ def get_next_page
42
+ response = @next_method.call(@null).value! unless @next_method.nil?
43
+ unless response.nil?
44
+ @null = response.body.null
45
+ @value = response.body.value
46
+ self
47
+ end
48
+ end
49
+
50
+ #
51
+ # Mapper for VaultList class as Ruby Hash.
52
+ # This will be used for serialization/deserialization.
53
+ #
54
+ def self.mapper()
55
+ {
56
+ required: false,
57
+ serialized_name: 'VaultList',
58
+ type: {
59
+ name: 'Composite',
60
+ class_name: 'VaultList',
61
+ model_properties: {
62
+ value: {
63
+ required: false,
64
+ serialized_name: 'value',
65
+ type: {
66
+ name: 'Sequence',
67
+ element: {
68
+ required: false,
69
+ serialized_name: 'VaultElementType',
70
+ type: {
71
+ name: 'Composite',
72
+ class_name: 'Vault'
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ module Models
8
+ #
9
+ # Properties of the vault.
10
+ #
11
+ class VaultProperties
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Provisioning State.
16
+ attr_accessor :provisioning_state
17
+
18
+
19
+ #
20
+ # Mapper for VaultProperties class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ required: false,
26
+ serialized_name: 'VaultProperties',
27
+ type: {
28
+ name: 'Composite',
29
+ class_name: 'VaultProperties',
30
+ model_properties: {
31
+ provisioning_state: {
32
+ required: false,
33
+ read_only: true,
34
+ serialized_name: 'provisioningState',
35
+ type: {
36
+ name: 'String'
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::ARM end
8
+ module Azure::ARM::RecoveryServices end
@@ -0,0 +1,130 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class RecoveryServicesClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The subscription Id.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Client Api Version.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] Gets or sets the preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
+ # Running Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
+ # is generated and included in each request. Default is true.
35
+ attr_accessor :generate_client_request_id
36
+
37
+ # @return [Vaults] vaults
38
+ attr_reader :vaults
39
+
40
+ #
41
+ # Creates initializes a new instance of the RecoveryServicesClient class.
42
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
43
+ # @param base_url [String] the base URI of the service.
44
+ # @param options [Array] filters to be applied to the HTTP requests.
45
+ #
46
+ def initialize(credentials, base_url = nil, options = nil)
47
+ super(credentials, options)
48
+ @base_url = base_url || 'https://management.azure.com'
49
+
50
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
51
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
52
+ @credentials = credentials
53
+
54
+ @vaults = Vaults.new(self)
55
+ @api_version = '2016-06-01'
56
+ @accept_language = 'en-US'
57
+ @long_running_operation_retry_timeout = 30
58
+ @generate_client_request_id = true
59
+ add_telemetry
60
+ end
61
+
62
+ #
63
+ # Makes a request and returns the body of the response.
64
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
65
+ # @param path [String] the path, relative to {base_url}.
66
+ # @param options [Hash{String=>String}] specifying any request options like :body.
67
+ # @return [Hash{String=>String}] containing the body of the response.
68
+ # Example:
69
+ #
70
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
71
+ # path = "/path"
72
+ # options = {
73
+ # body: request_content,
74
+ # query_params: {'api-version' => '2016-02-01'}
75
+ # }
76
+ # result = @client.make_request(:put, path, options)
77
+ #
78
+ def make_request(method, path, options = {})
79
+ result = make_request_with_http_info(method, path, options)
80
+ result.body unless result.nil?
81
+ end
82
+
83
+ #
84
+ # Makes a request and returns the operation response.
85
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
86
+ # @param path [String] the path, relative to {base_url}.
87
+ # @param options [Hash{String=>String}] specifying any request options like :body.
88
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
89
+ #
90
+ def make_request_with_http_info(method, path, options = {})
91
+ result = make_request_async(method, path, options).value!
92
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
93
+ result
94
+ end
95
+
96
+ #
97
+ # Makes a request asynchronously.
98
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
99
+ # @param path [String] the path, relative to {base_url}.
100
+ # @param options [Hash{String=>String}] specifying any request options like :body.
101
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
102
+ #
103
+ def make_request_async(method, path, options = {})
104
+ fail ArgumentError, 'method is nil' if method.nil?
105
+ fail ArgumentError, 'path is nil' if path.nil?
106
+
107
+ request_url = options[:base_url] || @base_url
108
+
109
+ request_headers = @request_headers
110
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
111
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
112
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
113
+
114
+ super(request_url, method, path, options)
115
+ end
116
+
117
+
118
+ private
119
+ #
120
+ # Adds telemetry information.
121
+ #
122
+ def add_telemetry
123
+ sdk_information = 'azure_mgmt_recovery_services'
124
+ if defined? Azure::ARM::RecoveryServices::VERSION
125
+ sdk_information = "#{sdk_information}/#{Azure::ARM::RecoveryServices::VERSION}"
126
+ end
127
+ add_user_agent_information(sdk_information)
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,518 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ #
8
+ # Vaults
9
+ #
10
+ class Vaults
11
+ include Azure::ARM::RecoveryServices::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the Vaults class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [RecoveryServicesClient] reference to the RecoveryServicesClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Get the Vault details.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group where the
29
+ # recovery services vault is present.
30
+ # @param vault_name [String] The name of the recovery services vault.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [Vault] operation results.
35
+ #
36
+ def get(resource_group_name, vault_name, custom_headers = nil)
37
+ response = get_async(resource_group_name, vault_name, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Get the Vault details.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group where the
45
+ # recovery services vault is present.
46
+ # @param vault_name [String] The name of the recovery services vault.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def get_with_http_info(resource_group_name, vault_name, custom_headers = nil)
53
+ get_async(resource_group_name, vault_name, custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Get the Vault details.
58
+ #
59
+ # @param resource_group_name [String] The name of the resource group where the
60
+ # recovery services vault is present.
61
+ # @param vault_name [String] The name of the recovery services vault.
62
+ # @param [Hash{String => String}] A hash of custom headers that will be added
63
+ # to the HTTP request.
64
+ #
65
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
66
+ #
67
+ def get_async(resource_group_name, vault_name, custom_headers = nil)
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
70
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+
73
+
74
+ request_headers = {}
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'
80
+
81
+ request_url = @base_url || @client.base_url
82
+
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'vaultName' => vault_name},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ # Deserialize Response
103
+ if status_code == 200
104
+ begin
105
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
106
+ result_mapper = Vault.mapper()
107
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
108
+ rescue Exception => e
109
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
+ end
111
+ end
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ #
120
+ # Creates or updates a Recovery Services vault.
121
+ #
122
+ # @param resource_group_name [String] The name of the resource group where the
123
+ # recovery services vault is present.
124
+ # @param vault_name [String] The name of the recovery services vault.
125
+ # @param vault [Vault] Recovery Services Vault to be created.
126
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
127
+ # will be added to the HTTP request.
128
+ #
129
+ # @return [Vault] operation results.
130
+ #
131
+ def create_or_update(resource_group_name, vault_name, vault, custom_headers = nil)
132
+ response = create_or_update_async(resource_group_name, vault_name, vault, custom_headers).value!
133
+ response.body unless response.nil?
134
+ end
135
+
136
+ #
137
+ # Creates or updates a Recovery Services vault.
138
+ #
139
+ # @param resource_group_name [String] The name of the resource group where the
140
+ # recovery services vault is present.
141
+ # @param vault_name [String] The name of the recovery services vault.
142
+ # @param vault [Vault] Recovery Services Vault to be created.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
147
+ #
148
+ def create_or_update_with_http_info(resource_group_name, vault_name, vault, custom_headers = nil)
149
+ create_or_update_async(resource_group_name, vault_name, vault, custom_headers).value!
150
+ end
151
+
152
+ #
153
+ # Creates or updates a Recovery Services vault.
154
+ #
155
+ # @param resource_group_name [String] The name of the resource group where the
156
+ # recovery services vault is present.
157
+ # @param vault_name [String] The name of the recovery services vault.
158
+ # @param vault [Vault] Recovery Services Vault to be created.
159
+ # @param [Hash{String => String}] A hash of custom headers that will be added
160
+ # to the HTTP request.
161
+ #
162
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
163
+ #
164
+ def create_or_update_async(resource_group_name, vault_name, vault, custom_headers = nil)
165
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
166
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
167
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
168
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
169
+ fail ArgumentError, 'vault is nil' if vault.nil?
170
+
171
+
172
+ request_headers = {}
173
+
174
+ # Set Headers
175
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
176
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
177
+
178
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
179
+
180
+ # Serialize Request
181
+ request_mapper = Vault.mapper()
182
+ request_content = @client.serialize(request_mapper, vault, 'vault')
183
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
184
+
185
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'
186
+
187
+ request_url = @base_url || @client.base_url
188
+
189
+ options = {
190
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
191
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'vaultName' => vault_name},
192
+ query_params: {'api-version' => @client.api_version},
193
+ body: request_content,
194
+ headers: request_headers.merge(custom_headers || {}),
195
+ base_url: request_url
196
+ }
197
+ promise = @client.make_request_async(:put, path_template, options)
198
+
199
+ promise = promise.then do |result|
200
+ http_response = result.response
201
+ status_code = http_response.status
202
+ response_content = http_response.body
203
+ unless status_code == 200 || status_code == 201
204
+ error_model = JSON.load(response_content)
205
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
206
+ end
207
+
208
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
209
+ # Deserialize Response
210
+ if status_code == 200
211
+ begin
212
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
213
+ result_mapper = Vault.mapper()
214
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
215
+ rescue Exception => e
216
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
217
+ end
218
+ end
219
+ # Deserialize Response
220
+ if status_code == 201
221
+ begin
222
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
223
+ result_mapper = Vault.mapper()
224
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
225
+ rescue Exception => e
226
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
227
+ end
228
+ end
229
+
230
+ result
231
+ end
232
+
233
+ promise.execute
234
+ end
235
+
236
+ #
237
+ # Deletes a vault.
238
+ #
239
+ # @param resource_group_name [String] The name of the resource group where the
240
+ # recovery services vault is present.
241
+ # @param vault_name [String] The name of the recovery services vault.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ #
246
+ def delete(resource_group_name, vault_name, custom_headers = nil)
247
+ response = delete_async(resource_group_name, vault_name, custom_headers).value!
248
+ nil
249
+ end
250
+
251
+ #
252
+ # Deletes a vault.
253
+ #
254
+ # @param resource_group_name [String] The name of the resource group where the
255
+ # recovery services vault is present.
256
+ # @param vault_name [String] The name of the recovery services vault.
257
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
258
+ # will be added to the HTTP request.
259
+ #
260
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
261
+ #
262
+ def delete_with_http_info(resource_group_name, vault_name, custom_headers = nil)
263
+ delete_async(resource_group_name, vault_name, custom_headers).value!
264
+ end
265
+
266
+ #
267
+ # Deletes a vault.
268
+ #
269
+ # @param resource_group_name [String] The name of the resource group where the
270
+ # recovery services vault is present.
271
+ # @param vault_name [String] The name of the recovery services vault.
272
+ # @param [Hash{String => String}] A hash of custom headers that will be added
273
+ # to the HTTP request.
274
+ #
275
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
276
+ #
277
+ def delete_async(resource_group_name, vault_name, custom_headers = nil)
278
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
279
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
280
+ fail ArgumentError, 'vault_name is nil' if vault_name.nil?
281
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
282
+
283
+
284
+ request_headers = {}
285
+
286
+ # Set Headers
287
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
288
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
289
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'
290
+
291
+ request_url = @base_url || @client.base_url
292
+
293
+ options = {
294
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
295
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'vaultName' => vault_name},
296
+ query_params: {'api-version' => @client.api_version},
297
+ headers: request_headers.merge(custom_headers || {}),
298
+ base_url: request_url
299
+ }
300
+ promise = @client.make_request_async(:delete, path_template, options)
301
+
302
+ promise = promise.then do |result|
303
+ http_response = result.response
304
+ status_code = http_response.status
305
+ response_content = http_response.body
306
+ unless status_code == 200
307
+ error_model = JSON.load(response_content)
308
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
309
+ end
310
+
311
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
312
+
313
+ result
314
+ end
315
+
316
+ promise.execute
317
+ end
318
+
319
+ #
320
+ # Retrieve a list of Vaults.
321
+ #
322
+ # @param resource_group_name [String] The name of the resource group where the
323
+ # recovery services vault is present.
324
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
325
+ # will be added to the HTTP request.
326
+ #
327
+ # @return [Array<Vault>] operation results.
328
+ #
329
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
330
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
331
+ first_page.get_all_items
332
+ end
333
+
334
+ #
335
+ # Retrieve a list of Vaults.
336
+ #
337
+ # @param resource_group_name [String] The name of the resource group where the
338
+ # recovery services vault is present.
339
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
340
+ # will be added to the HTTP request.
341
+ #
342
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
343
+ #
344
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
345
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
346
+ end
347
+
348
+ #
349
+ # Retrieve a list of Vaults.
350
+ #
351
+ # @param resource_group_name [String] The name of the resource group where the
352
+ # recovery services vault is present.
353
+ # @param [Hash{String => String}] A hash of custom headers that will be added
354
+ # to the HTTP request.
355
+ #
356
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
357
+ #
358
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
359
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
360
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
361
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
362
+
363
+
364
+ request_headers = {}
365
+
366
+ # Set Headers
367
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
368
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
369
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults'
370
+
371
+ request_url = @base_url || @client.base_url
372
+
373
+ options = {
374
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
375
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
376
+ query_params: {'api-version' => @client.api_version},
377
+ headers: request_headers.merge(custom_headers || {}),
378
+ base_url: request_url
379
+ }
380
+ promise = @client.make_request_async(:get, path_template, options)
381
+
382
+ promise = promise.then do |result|
383
+ http_response = result.response
384
+ status_code = http_response.status
385
+ response_content = http_response.body
386
+ unless status_code == 200
387
+ error_model = JSON.load(response_content)
388
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
389
+ end
390
+
391
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
392
+ # Deserialize Response
393
+ if status_code == 200
394
+ begin
395
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
396
+ result_mapper = VaultList.mapper()
397
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
398
+ rescue Exception => e
399
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
400
+ end
401
+ end
402
+
403
+ result
404
+ end
405
+
406
+ promise.execute
407
+ end
408
+
409
+ #
410
+ # Retrieve a list of Vaults.
411
+ #
412
+ # @param next_page_link [String] The NextLink from the previous successful call
413
+ # to List operation.
414
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
415
+ # will be added to the HTTP request.
416
+ #
417
+ # @return [VaultList] operation results.
418
+ #
419
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
420
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
421
+ response.body unless response.nil?
422
+ end
423
+
424
+ #
425
+ # Retrieve a list of Vaults.
426
+ #
427
+ # @param next_page_link [String] The NextLink from the previous successful call
428
+ # to List operation.
429
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
430
+ # will be added to the HTTP request.
431
+ #
432
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
433
+ #
434
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
435
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
436
+ end
437
+
438
+ #
439
+ # Retrieve a list of Vaults.
440
+ #
441
+ # @param next_page_link [String] The NextLink from the previous successful call
442
+ # to List operation.
443
+ # @param [Hash{String => String}] A hash of custom headers that will be added
444
+ # to the HTTP request.
445
+ #
446
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
447
+ #
448
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
449
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
450
+
451
+
452
+ request_headers = {}
453
+
454
+ # Set Headers
455
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
456
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
457
+ path_template = '{nextLink}'
458
+
459
+ request_url = @base_url || @client.base_url
460
+
461
+ options = {
462
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
463
+ skip_encoding_path_params: {'nextLink' => next_page_link},
464
+ headers: request_headers.merge(custom_headers || {}),
465
+ base_url: request_url
466
+ }
467
+ promise = @client.make_request_async(:get, path_template, options)
468
+
469
+ promise = promise.then do |result|
470
+ http_response = result.response
471
+ status_code = http_response.status
472
+ response_content = http_response.body
473
+ unless status_code == 200
474
+ error_model = JSON.load(response_content)
475
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
476
+ end
477
+
478
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
479
+ # Deserialize Response
480
+ if status_code == 200
481
+ begin
482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
483
+ result_mapper = VaultList.mapper()
484
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
485
+ rescue Exception => e
486
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
487
+ end
488
+ end
489
+
490
+ result
491
+ end
492
+
493
+ promise.execute
494
+ end
495
+
496
+ #
497
+ # Retrieve a list of Vaults.
498
+ #
499
+ # @param resource_group_name [String] The name of the resource group where the
500
+ # recovery services vault is present.
501
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
502
+ # will be added to the HTTP request.
503
+ #
504
+ # @return [VaultList] which provide lazy access to pages of the response.
505
+ #
506
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
507
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
508
+ unless response.nil?
509
+ page = response.body
510
+ page.next_method = Proc.new do |next_page_link|
511
+ list_by_resource_group_next_async(next_page_link, custom_headers)
512
+ end
513
+ page
514
+ end
515
+ end
516
+
517
+ end
518
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::RecoveryServices
7
+ VERSION = '0.8.0'
8
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: azure_mgmt_recovery_services
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0
5
+ platform: ruby
6
+ authors:
7
+ - Microsoft Corporation
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: ms_rest_azure
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.6.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.6.2
83
+ description: Microsoft Azure Recovery Services Library for Ruby
84
+ email: azrubyteam@microsoft.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - LICENSE.txt
90
+ - lib/azure_mgmt_recovery_services.rb
91
+ - lib/generated/azure_mgmt_recovery_services.rb
92
+ - lib/generated/azure_mgmt_recovery_services/models/sku.rb
93
+ - lib/generated/azure_mgmt_recovery_services/models/sku_name.rb
94
+ - lib/generated/azure_mgmt_recovery_services/models/vault.rb
95
+ - lib/generated/azure_mgmt_recovery_services/models/vault_list.rb
96
+ - lib/generated/azure_mgmt_recovery_services/models/vault_properties.rb
97
+ - lib/generated/azure_mgmt_recovery_services/module_definition.rb
98
+ - lib/generated/azure_mgmt_recovery_services/recovery_services_client.rb
99
+ - lib/generated/azure_mgmt_recovery_services/vaults.rb
100
+ - lib/generated/azure_mgmt_recovery_services/version.rb
101
+ homepage: https://aka.ms/azure-sdk-for-ruby
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: 2.0.0
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.5.1
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Official Ruby client library to consume Microsoft Azure Recovery services.
125
+ test_files: []