Class: Azure::ServiceFabric::Mgmt::V2018_02_01::ClusterVersions

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb

Overview

Azure Service Fabric Resource Provider API Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ClusterVersions

Creates and initializes a new instance of the ClusterVersions class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServiceFabricManagementClient (readonly)

Returns reference to the ServiceFabricManagementClient.

Returns:



22
23
24
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 22

def client
  @client
end

Instance Method Details

#get(location, cluster_version, custom_headers: nil) ⇒ ClusterCodeVersionsListResult

Gets information about a Service Fabric cluster code version available in the specified location.

Gets information about an available Service Fabric cluster code version.

different from cluster location. will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • cluster_version (String)

    The cluster code version.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ClusterCodeVersionsListResult)

    operation results.



38
39
40
41
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 38

def get(location, cluster_version, custom_headers:nil)
  response = get_async(location, cluster_version, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(location, cluster_version, custom_headers: nil) ⇒ Concurrent::Promise

Gets information about a Service Fabric cluster code version available in the specified location.

Gets information about an available Service Fabric cluster code version.

different from cluster location. to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • cluster_version (String)

    The cluster code version.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 75

def get_async(location, cluster_version, custom_headers:nil)
  fail ArgumentError, 'location is nil' if location.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cluster_version is nil' if cluster_version.nil?


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

  # 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}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'location' => location,'subscriptionId' => @client.subscription_id,'clusterVersion' => cluster_version},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterCodeVersionsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_by_environment(location, environment, cluster_version, custom_headers: nil) ⇒ ClusterCodeVersionsListResult

Gets information about a Service Fabric cluster code version available for the specified environment.

Gets information about an available Service Fabric cluster code version by environment.

different from cluster location. means all. Possible values include: ‘Windows’, ‘Linux’ will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • environment (Enum)

    The operating system of the cluster. The default

  • cluster_version (String)

    The cluster code version.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ClusterCodeVersionsListResult)

    operation results.



145
146
147
148
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 145

def get_by_environment(location, environment, cluster_version, custom_headers:nil)
  response = get_by_environment_async(location, environment, cluster_version, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_environment_async(location, environment, cluster_version, custom_headers: nil) ⇒ Concurrent::Promise

Gets information about a Service Fabric cluster code version available for the specified environment.

Gets information about an available Service Fabric cluster code version by environment.

different from cluster location. means all. Possible values include: ‘Windows’, ‘Linux’ to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • environment (Enum)

    The operating system of the cluster. The default

  • cluster_version (String)

    The cluster code version.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
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
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 188

def get_by_environment_async(location, environment, cluster_version, custom_headers:nil)
  fail ArgumentError, 'location is nil' if location.nil?
  fail ArgumentError, 'environment is nil' if environment.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'cluster_version is nil' if cluster_version.nil?


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

  # 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}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'location' => location,'environment' => environment,'subscriptionId' => @client.subscription_id,'clusterVersion' => cluster_version},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterCodeVersionsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_by_environment_with_http_info(location, environment, cluster_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets information about a Service Fabric cluster code version available for the specified environment.

Gets information about an available Service Fabric cluster code version by environment.

different from cluster location. means all. Possible values include: ‘Windows’, ‘Linux’ will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • environment (Enum)

    The operating system of the cluster. The default

  • cluster_version (String)

    The cluster code version.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



167
168
169
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 167

def get_by_environment_with_http_info(location, environment, cluster_version, custom_headers:nil)
  get_by_environment_async(location, environment, cluster_version, custom_headers:custom_headers).value!
end

#get_with_http_info(location, cluster_version, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets information about a Service Fabric cluster code version available in the specified location.

Gets information about an available Service Fabric cluster code version.

different from cluster location. will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • cluster_version (String)

    The cluster code version.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



57
58
59
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 57

def get_with_http_info(location, cluster_version, custom_headers:nil)
  get_async(location, cluster_version, custom_headers:custom_headers).value!
end

#list(location, custom_headers: nil) ⇒ ClusterCodeVersionsListResult

Gets the list of Service Fabric cluster code versions available for the specified location.

Gets all available code versions for Service Fabric cluster resources by location.

different from cluster location. will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ClusterCodeVersionsListResult)

    operation results.



256
257
258
259
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 256

def list(location, custom_headers:nil)
  response = list_async(location, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_async(location, custom_headers: nil) ⇒ Concurrent::Promise

Gets the list of Service Fabric cluster code versions available for the specified location.

Gets all available code versions for Service Fabric cluster resources by location.

different from cluster location. to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
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
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 293

def list_async(location, custom_headers:nil)
  fail ArgumentError, 'location is nil' if location.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

  # 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}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterCodeVersionsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_by_environment(location, environment, custom_headers: nil) ⇒ ClusterCodeVersionsListResult

Gets the list of Service Fabric cluster code versions available for the specified environment.

Gets all available code versions for Service Fabric cluster resources by environment.

different from cluster location. means all. Possible values include: ‘Windows’, ‘Linux’ will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • environment (Enum)

    The operating system of the cluster. The default

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ClusterCodeVersionsListResult)

    operation results.



361
362
363
364
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 361

def list_by_environment(location, environment, custom_headers:nil)
  response = list_by_environment_async(location, environment, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_environment_async(location, environment, custom_headers: nil) ⇒ Concurrent::Promise

Gets the list of Service Fabric cluster code versions available for the specified environment.

Gets all available code versions for Service Fabric cluster resources by environment.

different from cluster location. means all. Possible values include: ‘Windows’, ‘Linux’ to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • environment (Enum)

    The operating system of the cluster. The default

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
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
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 402

def list_by_environment_async(location, environment, custom_headers:nil)
  fail ArgumentError, 'location is nil' if location.nil?
  fail ArgumentError, 'environment is nil' if environment.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


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

  # 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}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'location' => location,'environment' => environment,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    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 = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterCodeVersionsListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_by_environment_with_http_info(location, environment, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the list of Service Fabric cluster code versions available for the specified environment.

Gets all available code versions for Service Fabric cluster resources by environment.

different from cluster location. means all. Possible values include: ‘Windows’, ‘Linux’ will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • environment (Enum)

    The operating system of the cluster. The default

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



382
383
384
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 382

def list_by_environment_with_http_info(location, environment, custom_headers:nil)
  list_by_environment_async(location, environment, custom_headers:custom_headers).value!
end

#list_with_http_info(location, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the list of Service Fabric cluster code versions available for the specified location.

Gets all available code versions for Service Fabric cluster resources by location.

different from cluster location. will be added to the HTTP request.

Parameters:

  • location (String)

    The location for the cluster code versions. This is

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



275
276
277
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/cluster_versions.rb', line 275

def list_with_http_info(location, custom_headers:nil)
  list_async(location, custom_headers:custom_headers).value!
end