Class: Azure::Mysql::Mgmt::V2020_01_01::Servers

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb

Overview

The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, security alert policies, log files, encryption keys, active directory administrator and configurations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Servers

Creates and initializes a new instance of the Servers class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientMySQLManagementClient (readonly)

Returns reference to the MySQLManagementClient.

Returns:



25
26
27
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 25

def client
  @client
end

Instance Method Details

#begin_start(resource_group_name, server_name, custom_headers: nil) ⇒ Object

Starts a stopped server.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that



161
162
163
164
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 161

def begin_start(resource_group_name, server_name, custom_headers:nil)
  response = begin_start_async(resource_group_name, server_name, custom_headers:custom_headers).value!
  nil
end

#begin_start_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise

Starts a stopped server.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 192

def begin_start_async(resource_group_name, server_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'server_name is nil' if server_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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/start'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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
      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?
    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

#begin_start_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Starts a stopped server.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



177
178
179
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 177

def begin_start_with_http_info(resource_group_name, server_name, custom_headers:nil)
  begin_start_async(resource_group_name, server_name, custom_headers:custom_headers).value!
end

#begin_stop(resource_group_name, server_name, custom_headers: nil) ⇒ Object

Stops a running server.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that



252
253
254
255
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 252

def begin_stop(resource_group_name, server_name, custom_headers:nil)
  response = begin_stop_async(resource_group_name, server_name, custom_headers:custom_headers).value!
  nil
end

#begin_stop_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise

Stops a running server.

is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



283
284
285
286
287
288
289
290
291
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
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 283

def begin_stop_async(resource_group_name, server_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'server_name is nil' if server_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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/stop'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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
      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?
    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

#begin_stop_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Stops a running server.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



268
269
270
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 268

def begin_stop_with_http_info(resource_group_name, server_name, custom_headers:nil)
  begin_stop_async(resource_group_name, server_name, custom_headers:custom_headers).value!
end

#begin_upgrade(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Object

Upgrade server version.

is case insensitive. updating a server. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • parameters (ServerUpgradeParameters)

    The required parameters for

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

    A hash of custom headers that



345
346
347
348
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 345

def begin_upgrade(resource_group_name, server_name, parameters, custom_headers:nil)
  response = begin_upgrade_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
  nil
end

#begin_upgrade_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Upgrade server version.

is case insensitive. updating a server. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • parameters (ServerUpgradeParameters)

    The required parameters for

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
427
428
429
430
431
432
433
434
435
436
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 380

def begin_upgrade_async(resource_group_name, server_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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::Mysql::Mgmt::V2020_01_01::Models::ServerUpgradeParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/upgrade'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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
      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?
    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

#begin_upgrade_with_http_info(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Upgrade server version.

is case insensitive. updating a server. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • parameters (ServerUpgradeParameters)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



363
364
365
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 363

def begin_upgrade_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
  begin_upgrade_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
end

#start(resource_group_name, server_name, custom_headers: nil) ⇒ Object

Starts a stopped server.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that



36
37
38
39
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 36

def start(resource_group_name, server_name, custom_headers:nil)
  response = start_async(resource_group_name, server_name, custom_headers:custom_headers).value!
  nil
end

#start_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 51

def start_async(resource_group_name, server_name, custom_headers:nil)
  # Send request
  promise = begin_start_async(resource_group_name, server_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#stop(resource_group_name, server_name, custom_headers: nil) ⇒ Object

Stops a running server.

is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that



76
77
78
79
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 76

def stop(resource_group_name, server_name, custom_headers:nil)
  response = stop_async(resource_group_name, server_name, custom_headers:custom_headers).value!
  nil
end

#stop_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 91

def stop_async(resource_group_name, server_name, custom_headers:nil)
  # Send request
  promise = begin_stop_async(resource_group_name, server_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#upgrade(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Object

Upgrade server version.

is case insensitive. updating a server. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • parameters (ServerUpgradeParameters)

    The required parameters for

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

    A hash of custom headers that



118
119
120
121
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 118

def upgrade(resource_group_name, server_name, parameters, custom_headers:nil)
  response = upgrade_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
  nil
end

#upgrade_async(resource_group_name, server_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

is case insensitive. updating a server. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group. The name

  • server_name (String)

    The name of the server.

  • parameters (ServerUpgradeParameters)

    The required parameters for

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb', line 135

def upgrade_async(resource_group_name, server_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_upgrade_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end