Class: Azure::ARM::DevTestLabs::ArtifactOperations

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb

Overview

The DevTest Labs Client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ArtifactOperations

Creates and initializes a new instance of the ArtifactOperations class.

Parameters:

  • service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientDevTestLabsClient (readonly)

Returns reference to the DevTestLabsClient.

Returns:

  • reference to the DevTestLabsClient



23
24
25
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 23

def client
  @client
end

Instance Method Details

#generate_arm_template(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers = nil) ⇒ ArmTemplateInfo

Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact.

will be added to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • The name of the artifact.

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • operation results.



282
283
284
285
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 282

def generate_arm_template(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers = nil)
  response = generate_arm_template_async(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers).value!
  response.body unless response.nil?
end

#generate_arm_template_async(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers = nil) ⇒ Concurrent::Promise

Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact.

to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • The name of the artifact.

  • hash of custom headers that will be added

Returns:

  • Promise object which holds the HTTP response.



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 319

def generate_arm_template_async(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'artifact_source_name is nil' if artifact_source_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'generate_arm_template_request is nil' if generate_arm_template_request.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = GenerateArmTemplateRequest.mapper()
  request_content = @client.serialize(request_mapper,  generate_arm_template_request, 'generate_arm_template_request')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'artifactSourceName' => artifact_source_name,'name' => name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = ArmTemplateInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#generate_arm_template_with_http_info(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact.

will be added to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • The name of the artifact.

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • HTTP response information.



301
302
303
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 301

def generate_arm_template_with_http_info(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers = nil)
  generate_arm_template_async(resource_group_name, lab_name, artifact_source_name, name, generate_arm_template_request, custom_headers).value!
end

#get_resource(resource_group_name, lab_name, artifact_source_name, name, custom_headers = nil) ⇒ Artifact

Get artifact.

will be added to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • The name of the artifact.

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • operation results.



178
179
180
181
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 178

def get_resource(resource_group_name, lab_name, artifact_source_name, name, custom_headers = nil)
  response = get_resource_async(resource_group_name, lab_name, artifact_source_name, name, custom_headers).value!
  response.body unless response.nil?
end

#get_resource_async(resource_group_name, lab_name, artifact_source_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Get artifact.

to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • The name of the artifact.

  • hash of custom headers that will be added

Returns:

  • Promise object which holds the HTTP response.



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 211

def get_resource_async(resource_group_name, lab_name, artifact_source_name, name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'artifact_source_name is nil' if artifact_source_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'artifactSourceName' => artifact_source_name,'name' => name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Artifact.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_resource_with_http_info(resource_group_name, lab_name, artifact_source_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get artifact.

will be added to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • The name of the artifact.

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • HTTP response information.



195
196
197
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 195

def get_resource_with_http_info(resource_group_name, lab_name, artifact_source_name, name, custom_headers = nil)
  get_resource_async(resource_group_name, lab_name, artifact_source_name, name, custom_headers).value!
end

#list(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ Array<Artifact>

List artifacts in a given artifact source.

operation. OData notation. will be added to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • (defaults to: nil)

    The filter to apply on the operation.

  • (defaults to: nil)

    The maximum number of resources to return from the

  • (defaults to: nil)

    The ordering expression for the results, using

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • operation results.



69
70
71
72
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 69

def list(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
  first_page = list_as_lazy(resource_group_name, lab_name, artifact_source_name, filter, top, order_by, custom_headers)
  first_page.get_all_items
end

#list_as_lazy(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ ResponseWithContinuationArtifact

List artifacts in a given artifact source.

operation. OData notation. will be added to the HTTP request.

pages of the response.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • (defaults to: nil)

    The filter to apply on the operation.

  • (defaults to: nil)

    The maximum number of resources to return from the

  • (defaults to: nil)

    The ordering expression for the results, using

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • which provide lazy access to



42
43
44
45
46
47
48
49
50
51
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 42

def list_as_lazy(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
  response = list_async(resource_group_name, lab_name, artifact_source_name, filter, top, order_by, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_next_async(next_link, custom_headers)
    end
    page
  end
end

#list_async(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ Concurrent::Promise

List artifacts in a given artifact source.

operation. OData notation. to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • (defaults to: nil)

    The filter to apply on the operation.

  • (defaults to: nil)

    The maximum number of resources to return from the

  • (defaults to: nil)

    The ordering expression for the results, using

  • hash of custom headers that will be added

Returns:

  • Promise object which holds the HTTP response.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 110

def list_async(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'artifact_source_name is nil' if artifact_source_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'artifactSourceName' => artifact_source_name},
      query_params: {'$filter' => filter,'$top' => top,'$orderBy' => order_by,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = ResponseWithContinuationArtifact.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next(next_page_link, custom_headers = nil) ⇒ ResponseWithContinuationArtifact

List artifacts in a given artifact source.

call to List operation. will be added to the HTTP request.

Parameters:

  • The NextLink from the previous successful

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • operation results.



396
397
398
399
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 396

def list_next(next_page_link, custom_headers = nil)
  response = list_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

List artifacts in a given artifact source.

call to List operation. to the HTTP request.

Parameters:

  • The NextLink from the previous successful

  • hash of custom headers that will be added

Returns:

  • Promise object which holds the HTTP response.



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 425

def list_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = ResponseWithContinuationArtifact.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List artifacts in a given artifact source.

call to List operation. will be added to the HTTP request.

Parameters:

  • The NextLink from the previous successful

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • HTTP response information.



411
412
413
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 411

def list_next_with_http_info(next_page_link, custom_headers = nil)
  list_next_async(next_page_link, custom_headers).value!
end

#list_with_http_info(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List artifacts in a given artifact source.

operation. OData notation. will be added to the HTTP request.

Parameters:

  • The name of the resource group.

  • The name of the lab.

  • The name of the artifact source.

  • (defaults to: nil)

    The filter to apply on the operation.

  • (defaults to: nil)

    The maximum number of resources to return from the

  • (defaults to: nil)

    The ordering expression for the results, using

  • (defaults to: nil)

    A hash of custom headers that

Returns:

  • HTTP response information.



90
91
92
# File 'lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb', line 90

def list_with_http_info(resource_group_name, lab_name, artifact_source_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
  list_async(resource_group_name, lab_name, artifact_source_name, filter, top, order_by, custom_headers).value!
end