azure_mgmt_netapp 0.17.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/LICENSE.txt +21 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp.rb +55 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/accounts.rb +597 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/azure_net_app_files_management_client.rb +153 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/capacity_pool.rb +154 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/capacity_pool_list.rb +55 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/capacity_pool_patch.rb +46 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/dimension.rb +57 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/error.rb +57 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/metric_specification.rb +145 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/mount_target.rb +198 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/mount_target_list.rb +55 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/net_app_account.rb +105 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/net_app_account_list.rb +55 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/net_app_account_patch.rb +46 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/operation.rb +83 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/operation_display.rb +79 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/operation_list_result.rb +57 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/service_level.rb +17 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/service_specification.rb +56 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/snapshot.rb +150 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/snapshot_patch.rb +46 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/snapshots_list.rb +55 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/volume.rb +179 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/volume_list.rb +55 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/models/volume_patch.rb +126 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/module_definition.rb +9 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/mount_targets.rb +128 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/operations.rb +107 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/pools.rb +631 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/snapshots.rb +664 -0
- data/lib/2017-08-15-preview/generated/azure_mgmt_netapp/volumes.rb +650 -0
- data/lib/azure_mgmt_netapp.rb +6 -0
- data/lib/module_definition.rb +9 -0
- data/lib/profiles/latest/modules/netapp_profile_module.rb +159 -0
- data/lib/profiles/latest/netapp_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/netapp_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +156 -0
@@ -0,0 +1,664 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::NetApp::Mgmt::V2017_08_15_preview
|
7
|
+
#
|
8
|
+
# Microsoft NetApp Azure Resource Provider specification
|
9
|
+
#
|
10
|
+
class Snapshots
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Snapshots class.
|
15
|
+
# @param client service class for accessing basic functionality.
|
16
|
+
#
|
17
|
+
def initialize(client)
|
18
|
+
@client = client
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [AzureNetAppFilesManagementClient] reference to the AzureNetAppFilesManagementClient
|
22
|
+
attr_reader :client
|
23
|
+
|
24
|
+
#
|
25
|
+
# List snapshots
|
26
|
+
#
|
27
|
+
# @param resource_group_name [String] The name of the resource group.
|
28
|
+
# @param account_name [String] The name of the NetApp account
|
29
|
+
# @param pool_name [String] The name of the capacity pool
|
30
|
+
# @param volume_name [String] The name of the volume
|
31
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
32
|
+
# will be added to the HTTP request.
|
33
|
+
#
|
34
|
+
# @return [SnapshotsList] operation results.
|
35
|
+
#
|
36
|
+
def list(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
|
37
|
+
response = list_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
|
38
|
+
response.body unless response.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# List snapshots
|
43
|
+
#
|
44
|
+
# @param resource_group_name [String] The name of the resource group.
|
45
|
+
# @param account_name [String] The name of the NetApp account
|
46
|
+
# @param pool_name [String] The name of the capacity pool
|
47
|
+
# @param volume_name [String] The name of the volume
|
48
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
49
|
+
# will be added to the HTTP request.
|
50
|
+
#
|
51
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
52
|
+
#
|
53
|
+
def list_with_http_info(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
|
54
|
+
list_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:custom_headers).value!
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# List snapshots
|
59
|
+
#
|
60
|
+
# @param resource_group_name [String] The name of the resource group.
|
61
|
+
# @param account_name [String] The name of the NetApp account
|
62
|
+
# @param pool_name [String] The name of the capacity pool
|
63
|
+
# @param volume_name [String] The name of the volume
|
64
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
65
|
+
# to the HTTP request.
|
66
|
+
#
|
67
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
68
|
+
#
|
69
|
+
def list_async(resource_group_name, account_name, pool_name, volume_name, custom_headers:nil)
|
70
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
71
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
72
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
73
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
74
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
75
|
+
fail ArgumentError, 'account_name is nil' if account_name.nil?
|
76
|
+
fail ArgumentError, 'pool_name is nil' if pool_name.nil?
|
77
|
+
fail ArgumentError, 'volume_name is nil' if volume_name.nil?
|
78
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
79
|
+
|
80
|
+
|
81
|
+
request_headers = {}
|
82
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
83
|
+
|
84
|
+
# Set Headers
|
85
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
86
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
87
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots'
|
88
|
+
|
89
|
+
request_url = @base_url || @client.base_url
|
90
|
+
|
91
|
+
options = {
|
92
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
93
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name},
|
94
|
+
query_params: {'api-version' => @client.api_version},
|
95
|
+
headers: request_headers.merge(custom_headers || {}),
|
96
|
+
base_url: request_url
|
97
|
+
}
|
98
|
+
promise = @client.make_request_async(:get, path_template, options)
|
99
|
+
|
100
|
+
promise = promise.then do |result|
|
101
|
+
http_response = result.response
|
102
|
+
status_code = http_response.status
|
103
|
+
response_content = http_response.body
|
104
|
+
unless status_code == 200
|
105
|
+
error_model = JSON.load(response_content)
|
106
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
107
|
+
end
|
108
|
+
|
109
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
110
|
+
# Deserialize Response
|
111
|
+
if status_code == 200
|
112
|
+
begin
|
113
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
114
|
+
result_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::SnapshotsList.mapper()
|
115
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
116
|
+
rescue Exception => e
|
117
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
result
|
122
|
+
end
|
123
|
+
|
124
|
+
promise.execute
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# Get a snapshot
|
129
|
+
#
|
130
|
+
# @param resource_group_name [String] The name of the resource group.
|
131
|
+
# @param account_name [String] The name of the NetApp account
|
132
|
+
# @param pool_name [String] The name of the capacity pool
|
133
|
+
# @param volume_name [String] The name of the volume
|
134
|
+
# @param snapshot_name [String] The name of the mount target
|
135
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
136
|
+
# will be added to the HTTP request.
|
137
|
+
#
|
138
|
+
# @return [Snapshot] operation results.
|
139
|
+
#
|
140
|
+
def get(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
141
|
+
response = get_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
142
|
+
response.body unless response.nil?
|
143
|
+
end
|
144
|
+
|
145
|
+
#
|
146
|
+
# Get a snapshot
|
147
|
+
#
|
148
|
+
# @param resource_group_name [String] The name of the resource group.
|
149
|
+
# @param account_name [String] The name of the NetApp account
|
150
|
+
# @param pool_name [String] The name of the capacity pool
|
151
|
+
# @param volume_name [String] The name of the volume
|
152
|
+
# @param snapshot_name [String] The name of the mount target
|
153
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
154
|
+
# will be added to the HTTP request.
|
155
|
+
#
|
156
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
157
|
+
#
|
158
|
+
def get_with_http_info(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
159
|
+
get_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
160
|
+
end
|
161
|
+
|
162
|
+
#
|
163
|
+
# Get a snapshot
|
164
|
+
#
|
165
|
+
# @param resource_group_name [String] The name of the resource group.
|
166
|
+
# @param account_name [String] The name of the NetApp account
|
167
|
+
# @param pool_name [String] The name of the capacity pool
|
168
|
+
# @param volume_name [String] The name of the volume
|
169
|
+
# @param snapshot_name [String] The name of the mount target
|
170
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
171
|
+
# to the HTTP request.
|
172
|
+
#
|
173
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
174
|
+
#
|
175
|
+
def get_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
176
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
177
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
178
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
179
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
180
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
181
|
+
fail ArgumentError, 'account_name is nil' if account_name.nil?
|
182
|
+
fail ArgumentError, 'pool_name is nil' if pool_name.nil?
|
183
|
+
fail ArgumentError, 'volume_name is nil' if volume_name.nil?
|
184
|
+
fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
|
185
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
186
|
+
|
187
|
+
|
188
|
+
request_headers = {}
|
189
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
190
|
+
|
191
|
+
# Set Headers
|
192
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
193
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
194
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'
|
195
|
+
|
196
|
+
request_url = @base_url || @client.base_url
|
197
|
+
|
198
|
+
options = {
|
199
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
200
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name,'snapshotName' => snapshot_name},
|
201
|
+
query_params: {'api-version' => @client.api_version},
|
202
|
+
headers: request_headers.merge(custom_headers || {}),
|
203
|
+
base_url: request_url
|
204
|
+
}
|
205
|
+
promise = @client.make_request_async(:get, path_template, options)
|
206
|
+
|
207
|
+
promise = promise.then do |result|
|
208
|
+
http_response = result.response
|
209
|
+
status_code = http_response.status
|
210
|
+
response_content = http_response.body
|
211
|
+
unless status_code == 200
|
212
|
+
error_model = JSON.load(response_content)
|
213
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
214
|
+
end
|
215
|
+
|
216
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
217
|
+
# Deserialize Response
|
218
|
+
if status_code == 200
|
219
|
+
begin
|
220
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
221
|
+
result_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::Snapshot.mapper()
|
222
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
223
|
+
rescue Exception => e
|
224
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
result
|
229
|
+
end
|
230
|
+
|
231
|
+
promise.execute
|
232
|
+
end
|
233
|
+
|
234
|
+
#
|
235
|
+
# Create a snapshot
|
236
|
+
#
|
237
|
+
# @param body [Snapshot] Snapshot object supplied in the body of the operation.
|
238
|
+
# @param resource_group_name [String] The name of the resource group.
|
239
|
+
# @param account_name [String] The name of the NetApp account
|
240
|
+
# @param pool_name [String] The name of the capacity pool
|
241
|
+
# @param volume_name [String] The name of the volume
|
242
|
+
# @param snapshot_name [String] The name of the mount target
|
243
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
244
|
+
# will be added to the HTTP request.
|
245
|
+
#
|
246
|
+
# @return [Snapshot] operation results.
|
247
|
+
#
|
248
|
+
def create(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
249
|
+
response = create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
250
|
+
response.body unless response.nil?
|
251
|
+
end
|
252
|
+
|
253
|
+
#
|
254
|
+
# @param body [Snapshot] Snapshot object supplied in the body of the operation.
|
255
|
+
# @param resource_group_name [String] The name of the resource group.
|
256
|
+
# @param account_name [String] The name of the NetApp account
|
257
|
+
# @param pool_name [String] The name of the capacity pool
|
258
|
+
# @param volume_name [String] The name of the volume
|
259
|
+
# @param snapshot_name [String] The name of the mount target
|
260
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
261
|
+
# will be added to the HTTP request.
|
262
|
+
#
|
263
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
264
|
+
# response.
|
265
|
+
#
|
266
|
+
def create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
267
|
+
# Send request
|
268
|
+
promise = begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers)
|
269
|
+
|
270
|
+
promise = promise.then do |response|
|
271
|
+
# Defining deserialization method.
|
272
|
+
deserialize_method = lambda do |parsed_response|
|
273
|
+
result_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::Snapshot.mapper()
|
274
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
275
|
+
end
|
276
|
+
|
277
|
+
# Waiting for response.
|
278
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
279
|
+
end
|
280
|
+
|
281
|
+
promise
|
282
|
+
end
|
283
|
+
|
284
|
+
#
|
285
|
+
# Patch a snapshot
|
286
|
+
#
|
287
|
+
# @param body [SnapshotPatch] Snapshot object supplied in the body of the
|
288
|
+
# operation.
|
289
|
+
# @param resource_group_name [String] The name of the resource group.
|
290
|
+
# @param account_name [String] The name of the NetApp account
|
291
|
+
# @param pool_name [String] The name of the capacity pool
|
292
|
+
# @param volume_name [String] The name of the volume
|
293
|
+
# @param snapshot_name [String] The name of the mount target
|
294
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
295
|
+
# will be added to the HTTP request.
|
296
|
+
#
|
297
|
+
# @return [Snapshot] operation results.
|
298
|
+
#
|
299
|
+
def update(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
300
|
+
response = update_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
301
|
+
response.body unless response.nil?
|
302
|
+
end
|
303
|
+
|
304
|
+
#
|
305
|
+
# Patch a snapshot
|
306
|
+
#
|
307
|
+
# @param body [SnapshotPatch] Snapshot object supplied in the body of the
|
308
|
+
# operation.
|
309
|
+
# @param resource_group_name [String] The name of the resource group.
|
310
|
+
# @param account_name [String] The name of the NetApp account
|
311
|
+
# @param pool_name [String] The name of the capacity pool
|
312
|
+
# @param volume_name [String] The name of the volume
|
313
|
+
# @param snapshot_name [String] The name of the mount target
|
314
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
315
|
+
# will be added to the HTTP request.
|
316
|
+
#
|
317
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
318
|
+
#
|
319
|
+
def update_with_http_info(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
320
|
+
update_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
321
|
+
end
|
322
|
+
|
323
|
+
#
|
324
|
+
# Patch a snapshot
|
325
|
+
#
|
326
|
+
# @param body [SnapshotPatch] Snapshot object supplied in the body of the
|
327
|
+
# operation.
|
328
|
+
# @param resource_group_name [String] The name of the resource group.
|
329
|
+
# @param account_name [String] The name of the NetApp account
|
330
|
+
# @param pool_name [String] The name of the capacity pool
|
331
|
+
# @param volume_name [String] The name of the volume
|
332
|
+
# @param snapshot_name [String] The name of the mount target
|
333
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
334
|
+
# to the HTTP request.
|
335
|
+
#
|
336
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
337
|
+
#
|
338
|
+
def update_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
339
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
340
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
341
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
342
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
343
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
344
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
345
|
+
fail ArgumentError, 'account_name is nil' if account_name.nil?
|
346
|
+
fail ArgumentError, 'pool_name is nil' if pool_name.nil?
|
347
|
+
fail ArgumentError, 'volume_name is nil' if volume_name.nil?
|
348
|
+
fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
|
349
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
350
|
+
|
351
|
+
|
352
|
+
request_headers = {}
|
353
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
354
|
+
|
355
|
+
# Set Headers
|
356
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
357
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
358
|
+
|
359
|
+
# Serialize Request
|
360
|
+
request_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::SnapshotPatch.mapper()
|
361
|
+
request_content = @client.serialize(request_mapper, body)
|
362
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
363
|
+
|
364
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'
|
365
|
+
|
366
|
+
request_url = @base_url || @client.base_url
|
367
|
+
|
368
|
+
options = {
|
369
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
370
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name,'snapshotName' => snapshot_name},
|
371
|
+
query_params: {'api-version' => @client.api_version},
|
372
|
+
body: request_content,
|
373
|
+
headers: request_headers.merge(custom_headers || {}),
|
374
|
+
base_url: request_url
|
375
|
+
}
|
376
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
377
|
+
|
378
|
+
promise = promise.then do |result|
|
379
|
+
http_response = result.response
|
380
|
+
status_code = http_response.status
|
381
|
+
response_content = http_response.body
|
382
|
+
unless status_code == 200
|
383
|
+
error_model = JSON.load(response_content)
|
384
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
385
|
+
end
|
386
|
+
|
387
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
388
|
+
# Deserialize Response
|
389
|
+
if status_code == 200
|
390
|
+
begin
|
391
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
392
|
+
result_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::Snapshot.mapper()
|
393
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
394
|
+
rescue Exception => e
|
395
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
result
|
400
|
+
end
|
401
|
+
|
402
|
+
promise.execute
|
403
|
+
end
|
404
|
+
|
405
|
+
#
|
406
|
+
# Delete snapshot
|
407
|
+
#
|
408
|
+
# @param resource_group_name [String] The name of the resource group.
|
409
|
+
# @param account_name [String] The name of the NetApp account
|
410
|
+
# @param pool_name [String] The name of the capacity pool
|
411
|
+
# @param volume_name [String] The name of the volume
|
412
|
+
# @param snapshot_name [String] The name of the mount target
|
413
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
414
|
+
# will be added to the HTTP request.
|
415
|
+
#
|
416
|
+
def delete(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
417
|
+
response = delete_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
418
|
+
nil
|
419
|
+
end
|
420
|
+
|
421
|
+
#
|
422
|
+
# @param resource_group_name [String] The name of the resource group.
|
423
|
+
# @param account_name [String] The name of the NetApp account
|
424
|
+
# @param pool_name [String] The name of the capacity pool
|
425
|
+
# @param volume_name [String] The name of the volume
|
426
|
+
# @param snapshot_name [String] The name of the mount target
|
427
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
428
|
+
# will be added to the HTTP request.
|
429
|
+
#
|
430
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
431
|
+
# response.
|
432
|
+
#
|
433
|
+
def delete_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
434
|
+
# Send request
|
435
|
+
promise = begin_delete_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers)
|
436
|
+
|
437
|
+
promise = promise.then do |response|
|
438
|
+
# Defining deserialization method.
|
439
|
+
deserialize_method = lambda do |parsed_response|
|
440
|
+
end
|
441
|
+
|
442
|
+
# Waiting for response.
|
443
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
444
|
+
end
|
445
|
+
|
446
|
+
promise
|
447
|
+
end
|
448
|
+
|
449
|
+
#
|
450
|
+
# Create a snapshot
|
451
|
+
#
|
452
|
+
# @param body [Snapshot] Snapshot object supplied in the body of the operation.
|
453
|
+
# @param resource_group_name [String] The name of the resource group.
|
454
|
+
# @param account_name [String] The name of the NetApp account
|
455
|
+
# @param pool_name [String] The name of the capacity pool
|
456
|
+
# @param volume_name [String] The name of the volume
|
457
|
+
# @param snapshot_name [String] The name of the mount target
|
458
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
459
|
+
# will be added to the HTTP request.
|
460
|
+
#
|
461
|
+
# @return [Snapshot] operation results.
|
462
|
+
#
|
463
|
+
def begin_create(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
464
|
+
response = begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
465
|
+
response.body unless response.nil?
|
466
|
+
end
|
467
|
+
|
468
|
+
#
|
469
|
+
# Create a snapshot
|
470
|
+
#
|
471
|
+
# @param body [Snapshot] Snapshot object supplied in the body of the operation.
|
472
|
+
# @param resource_group_name [String] The name of the resource group.
|
473
|
+
# @param account_name [String] The name of the NetApp account
|
474
|
+
# @param pool_name [String] The name of the capacity pool
|
475
|
+
# @param volume_name [String] The name of the volume
|
476
|
+
# @param snapshot_name [String] The name of the mount target
|
477
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
478
|
+
# will be added to the HTTP request.
|
479
|
+
#
|
480
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
481
|
+
#
|
482
|
+
def begin_create_with_http_info(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
483
|
+
begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
484
|
+
end
|
485
|
+
|
486
|
+
#
|
487
|
+
# Create a snapshot
|
488
|
+
#
|
489
|
+
# @param body [Snapshot] Snapshot object supplied in the body of the operation.
|
490
|
+
# @param resource_group_name [String] The name of the resource group.
|
491
|
+
# @param account_name [String] The name of the NetApp account
|
492
|
+
# @param pool_name [String] The name of the capacity pool
|
493
|
+
# @param volume_name [String] The name of the volume
|
494
|
+
# @param snapshot_name [String] The name of the mount target
|
495
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
496
|
+
# to the HTTP request.
|
497
|
+
#
|
498
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
499
|
+
#
|
500
|
+
def begin_create_async(body, resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
501
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
502
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
503
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
504
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
505
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
506
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
507
|
+
fail ArgumentError, 'account_name is nil' if account_name.nil?
|
508
|
+
fail ArgumentError, 'pool_name is nil' if pool_name.nil?
|
509
|
+
fail ArgumentError, 'volume_name is nil' if volume_name.nil?
|
510
|
+
fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
|
511
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
512
|
+
|
513
|
+
|
514
|
+
request_headers = {}
|
515
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
516
|
+
|
517
|
+
# Set Headers
|
518
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
519
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
520
|
+
|
521
|
+
# Serialize Request
|
522
|
+
request_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::Snapshot.mapper()
|
523
|
+
request_content = @client.serialize(request_mapper, body)
|
524
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
525
|
+
|
526
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'
|
527
|
+
|
528
|
+
request_url = @base_url || @client.base_url
|
529
|
+
|
530
|
+
options = {
|
531
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
532
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name,'snapshotName' => snapshot_name},
|
533
|
+
query_params: {'api-version' => @client.api_version},
|
534
|
+
body: request_content,
|
535
|
+
headers: request_headers.merge(custom_headers || {}),
|
536
|
+
base_url: request_url
|
537
|
+
}
|
538
|
+
promise = @client.make_request_async(:put, path_template, options)
|
539
|
+
|
540
|
+
promise = promise.then do |result|
|
541
|
+
http_response = result.response
|
542
|
+
status_code = http_response.status
|
543
|
+
response_content = http_response.body
|
544
|
+
unless status_code == 201 || status_code == 202
|
545
|
+
error_model = JSON.load(response_content)
|
546
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
547
|
+
end
|
548
|
+
|
549
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
550
|
+
# Deserialize Response
|
551
|
+
if status_code == 201
|
552
|
+
begin
|
553
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
554
|
+
result_mapper = Azure::NetApp::Mgmt::V2017_08_15_preview::Models::Snapshot.mapper()
|
555
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
556
|
+
rescue Exception => e
|
557
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
result
|
562
|
+
end
|
563
|
+
|
564
|
+
promise.execute
|
565
|
+
end
|
566
|
+
|
567
|
+
#
|
568
|
+
# Delete snapshot
|
569
|
+
#
|
570
|
+
# @param resource_group_name [String] The name of the resource group.
|
571
|
+
# @param account_name [String] The name of the NetApp account
|
572
|
+
# @param pool_name [String] The name of the capacity pool
|
573
|
+
# @param volume_name [String] The name of the volume
|
574
|
+
# @param snapshot_name [String] The name of the mount target
|
575
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
576
|
+
# will be added to the HTTP request.
|
577
|
+
#
|
578
|
+
#
|
579
|
+
def begin_delete(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
580
|
+
response = begin_delete_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
581
|
+
nil
|
582
|
+
end
|
583
|
+
|
584
|
+
#
|
585
|
+
# Delete snapshot
|
586
|
+
#
|
587
|
+
# @param resource_group_name [String] The name of the resource group.
|
588
|
+
# @param account_name [String] The name of the NetApp account
|
589
|
+
# @param pool_name [String] The name of the capacity pool
|
590
|
+
# @param volume_name [String] The name of the volume
|
591
|
+
# @param snapshot_name [String] The name of the mount target
|
592
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
593
|
+
# will be added to the HTTP request.
|
594
|
+
#
|
595
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
596
|
+
#
|
597
|
+
def begin_delete_with_http_info(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
598
|
+
begin_delete_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:custom_headers).value!
|
599
|
+
end
|
600
|
+
|
601
|
+
#
|
602
|
+
# Delete snapshot
|
603
|
+
#
|
604
|
+
# @param resource_group_name [String] The name of the resource group.
|
605
|
+
# @param account_name [String] The name of the NetApp account
|
606
|
+
# @param pool_name [String] The name of the capacity pool
|
607
|
+
# @param volume_name [String] The name of the volume
|
608
|
+
# @param snapshot_name [String] The name of the mount target
|
609
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
610
|
+
# to the HTTP request.
|
611
|
+
#
|
612
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
613
|
+
#
|
614
|
+
def begin_delete_async(resource_group_name, account_name, pool_name, volume_name, snapshot_name, custom_headers:nil)
|
615
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
616
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
617
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
618
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
619
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
620
|
+
fail ArgumentError, 'account_name is nil' if account_name.nil?
|
621
|
+
fail ArgumentError, 'pool_name is nil' if pool_name.nil?
|
622
|
+
fail ArgumentError, 'volume_name is nil' if volume_name.nil?
|
623
|
+
fail ArgumentError, 'snapshot_name is nil' if snapshot_name.nil?
|
624
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
625
|
+
|
626
|
+
|
627
|
+
request_headers = {}
|
628
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
629
|
+
|
630
|
+
# Set Headers
|
631
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
632
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
633
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'
|
634
|
+
|
635
|
+
request_url = @base_url || @client.base_url
|
636
|
+
|
637
|
+
options = {
|
638
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
639
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'poolName' => pool_name,'volumeName' => volume_name,'snapshotName' => snapshot_name},
|
640
|
+
query_params: {'api-version' => @client.api_version},
|
641
|
+
headers: request_headers.merge(custom_headers || {}),
|
642
|
+
base_url: request_url
|
643
|
+
}
|
644
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
645
|
+
|
646
|
+
promise = promise.then do |result|
|
647
|
+
http_response = result.response
|
648
|
+
status_code = http_response.status
|
649
|
+
response_content = http_response.body
|
650
|
+
unless status_code == 202 || status_code == 204
|
651
|
+
error_model = JSON.load(response_content)
|
652
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
653
|
+
end
|
654
|
+
|
655
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
656
|
+
|
657
|
+
result
|
658
|
+
end
|
659
|
+
|
660
|
+
promise.execute
|
661
|
+
end
|
662
|
+
|
663
|
+
end
|
664
|
+
end
|