Class: Azure::ServiceFabric::V7_0_0_42::MeshNetwork

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb

Overview

Service Fabric REST Client APIs allows management of Service Fabric clusters, applications and services.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MeshNetwork

Creates and initializes a new instance of the MeshNetwork class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServiceFabricClientAPIs (readonly)

Returns reference to the ServiceFabricClientAPIs.

Returns:



23
24
25
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 23

def client
  @client
end

Instance Method Details

#create_or_update(network_resource_name, network_resource_description, custom_headers: nil) ⇒ NetworkResourceDescription

Creates or updates a Network resource.

Creates a Network resource with the specified name, description and properties. If Network resource with the same name exists, then it is updated with the specified description and properties. Network resource provides connectivity between application services.

for creating a Network resource. will be added to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

  • network_resource_description (NetworkResourceDescription)

    Description

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

    A hash of custom headers that

Returns:

  • (NetworkResourceDescription)

    operation results.



41
42
43
44
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 41

def create_or_update(network_resource_name, network_resource_description, custom_headers:nil)
  response = create_or_update_async(network_resource_name, network_resource_description, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(network_resource_name, network_resource_description, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a Network resource.

Creates a Network resource with the specified name, description and properties. If Network resource with the same name exists, then it is updated with the specified description and properties. Network resource provides connectivity between application services.

for creating a Network resource. to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

  • network_resource_description (NetworkResourceDescription)

    Description

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
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
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 82

def create_or_update_async(network_resource_name, network_resource_description, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'network_resource_name is nil' if network_resource_name.nil?
  fail ArgumentError, 'network_resource_description is nil' if network_resource_description.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?

  # Serialize Request
  request_mapper = Azure::ServiceFabric::V7_0_0_42::Models::NetworkResourceDescription.mapper()
  request_content = @client.serialize(request_mapper,  network_resource_description)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'Resources/Networks/{networkResourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'networkResourceName' => network_resource_name},
      query_params: {'api-version' => api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 || status_code == 201 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::V7_0_0_42::Models::NetworkResourceDescription.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::V7_0_0_42::Models::NetworkResourceDescription.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

#create_or_update_with_http_info(network_resource_name, network_resource_description, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a Network resource.

Creates a Network resource with the specified name, description and properties. If Network resource with the same name exists, then it is updated with the specified description and properties. Network resource provides connectivity between application services.

for creating a Network resource. will be added to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

  • network_resource_description (NetworkResourceDescription)

    Description

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



62
63
64
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 62

def create_or_update_with_http_info(network_resource_name, network_resource_description, custom_headers:nil)
  create_or_update_async(network_resource_name, network_resource_description, custom_headers:custom_headers).value!
end

#delete(network_resource_name, custom_headers: nil) ⇒ Object

Deletes the Network resource.

Deletes the Network resource identified by the name.

will be added to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

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

    A hash of custom headers that



261
262
263
264
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 261

def delete(network_resource_name, custom_headers:nil)
  response = delete_async(network_resource_name, custom_headers:custom_headers).value!
  nil
end

#delete_async(network_resource_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the Network resource.

Deletes the Network resource identified by the name.

to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



292
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
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 292

def delete_async(network_resource_name, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'network_resource_name is nil' if network_resource_name.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 = 'Resources/Networks/{networkResourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'networkResourceName' => network_resource_name},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#delete_with_http_info(network_resource_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the Network resource.

Deletes the Network resource identified by the name.

will be added to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



277
278
279
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 277

def delete_with_http_info(network_resource_name, custom_headers:nil)
  delete_async(network_resource_name, custom_headers:custom_headers).value!
end

#get(network_resource_name, custom_headers: nil) ⇒ NetworkResourceDescription

Gets the Network resource with the given name.

Gets the information about the Network resource with the given name. The information include the description and other properties of the Network.

will be added to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

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

    A hash of custom headers that

Returns:

  • (NetworkResourceDescription)

    operation results.



165
166
167
168
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 165

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

#get_async(network_resource_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the Network resource with the given name.

Gets the information about the Network resource with the given name. The information include the description and other properties of the Network.

to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
241
242
243
244
245
246
247
248
249
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 198

def get_async(network_resource_name, custom_headers:nil)
  api_version = '6.4-preview'
  fail ArgumentError, 'network_resource_name is nil' if network_resource_name.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 = 'Resources/Networks/{networkResourceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'networkResourceName' => network_resource_name},
      query_params: {'api-version' => 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 MsRest::HttpOperationError.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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::V7_0_0_42::Models::NetworkResourceDescription.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_with_http_info(network_resource_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the Network resource with the given name.

Gets the information about the Network resource with the given name. The information include the description and other properties of the Network.

will be added to the HTTP request.

Parameters:

  • network_resource_name (String)

    The identity of the network.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



182
183
184
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 182

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

#list(custom_headers: nil) ⇒ PagedNetworkResourceDescriptionList

Lists all the network resources.

Gets the information about all network resources in a given resource group. The information include the description and other properties of the Network.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (PagedNetworkResourceDescriptionList)

    operation results.



346
347
348
349
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 346

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

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

Lists all the network resources.

Gets the information about all network resources in a given resource group. The information include the description and other properties of the Network.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
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
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 377

def list_async(custom_headers:nil)
  api_version = '6.4-preview'


  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 = 'Resources/Networks'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      query_params: {'api-version' => 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 MsRest::HttpOperationError.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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::V7_0_0_42::Models::PagedNetworkResourceDescriptionList.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_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the network resources.

Gets the information about all network resources in a given resource group. The information include the description and other properties of the Network.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



362
363
364
# File 'lib/7.0.0.42/generated/azure_service_fabric/mesh_network.rb', line 362

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