azure_mgmt_mysql 0.17.1 → 0.17.2

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-12-01-preview/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +1 -1
  3. data/lib/2017-12-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +1 -1
  4. data/lib/2018-06-01/generated/azure_mgmt_mysql.rb +52 -0
  5. data/lib/2018-06-01/generated/azure_mgmt_mysql/advisors.rb +349 -0
  6. data/lib/2018-06-01/generated/azure_mgmt_mysql/location_based_recommended_action_sessions_operation_status.rb +124 -0
  7. data/lib/2018-06-01/generated/azure_mgmt_mysql/location_based_recommended_action_sessions_result.rb +256 -0
  8. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/advisor.rb +73 -0
  9. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/advisors_result_list.rb +100 -0
  10. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/azure_entity_resource.rb +75 -0
  11. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/error_additional_info.rb +59 -0
  12. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/error_response.rb +113 -0
  13. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_endpoint_connection.rb +100 -0
  14. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_endpoint_connection_list_result.rb +100 -0
  15. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_endpoint_property.rb +47 -0
  16. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_resource.rb +76 -0
  17. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_resource_list_result.rb +100 -0
  18. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_resource_properties.rb +68 -0
  19. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/private_link_service_connection_state_property.rb +72 -0
  20. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/proxy_resource.rb +63 -0
  21. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/recommendation_action.rb +158 -0
  22. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/recommendation_actions_result_list.rb +101 -0
  23. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/recommended_action_sessions_operation_status.rb +68 -0
  24. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/resource.rb +83 -0
  25. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/tags_object.rb +54 -0
  26. data/lib/2018-06-01/generated/azure_mgmt_mysql/models/tracked_resource.rb +92 -0
  27. data/lib/2018-06-01/generated/azure_mgmt_mysql/module_definition.rb +9 -0
  28. data/lib/2018-06-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +351 -0
  29. data/lib/2018-06-01/generated/azure_mgmt_mysql/private_endpoint_connections.rb +832 -0
  30. data/lib/2018-06-01/generated/azure_mgmt_mysql/private_link_resources.rb +349 -0
  31. data/lib/2018-06-01/generated/azure_mgmt_mysql/recommended_actions.rb +362 -0
  32. data/lib/2020-01-01/generated/azure_mgmt_mysql.rb +38 -0
  33. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/azure_entity_resource.rb +75 -0
  34. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/error_additional_info.rb +59 -0
  35. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/error_response.rb +113 -0
  36. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/proxy_resource.rb +63 -0
  37. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/resource.rb +83 -0
  38. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/server_key.rb +111 -0
  39. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/server_key_list_result.rb +100 -0
  40. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/server_upgrade_parameters.rb +47 -0
  41. data/lib/2020-01-01/generated/azure_mgmt_mysql/models/tracked_resource.rb +92 -0
  42. data/lib/2020-01-01/generated/azure_mgmt_mysql/module_definition.rb +9 -0
  43. data/lib/2020-01-01/generated/azure_mgmt_mysql/my_sqlmanagement_client.rb +135 -0
  44. data/lib/2020-01-01/generated/azure_mgmt_mysql/server_keys.rb +666 -0
  45. data/lib/2020-01-01/generated/azure_mgmt_mysql/servers.rb +439 -0
  46. data/lib/azure_mgmt_mysql.rb +3 -1
  47. data/lib/profiles/latest/modules/mysql_profile_module.rb +122 -12
  48. data/lib/version.rb +1 -1
  49. metadata +44 -2
@@ -0,0 +1,100 @@
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::Mysql::Mgmt::V2020_01_01
7
+ module Models
8
+ #
9
+ # A list of MySQL Server keys.
10
+ #
11
+ class ServerKeyListResult
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Array<ServerKey>] A list of MySQL Server keys.
17
+ attr_accessor :value
18
+
19
+ # @return [String] Link to retrieve next page of results.
20
+ attr_accessor :next_link
21
+
22
+ # return [Proc] with next page method call.
23
+ attr_accessor :next_method
24
+
25
+ #
26
+ # Gets the rest of the items for the request, enabling auto-pagination.
27
+ #
28
+ # @return [Array<ServerKey>] operation results.
29
+ #
30
+ def get_all_items
31
+ items = @value
32
+ page = self
33
+ while page.next_link != nil && !page.next_link.strip.empty? do
34
+ page = page.get_next_page
35
+ items.concat(page.value)
36
+ end
37
+ items
38
+ end
39
+
40
+ #
41
+ # Gets the next page of results.
42
+ #
43
+ # @return [ServerKeyListResult] with next page content.
44
+ #
45
+ def get_next_page
46
+ response = @next_method.call(@next_link).value! unless @next_method.nil?
47
+ unless response.nil?
48
+ @next_link = response.body.next_link
49
+ @value = response.body.value
50
+ self
51
+ end
52
+ end
53
+
54
+ #
55
+ # Mapper for ServerKeyListResult class as Ruby Hash.
56
+ # This will be used for serialization/deserialization.
57
+ #
58
+ def self.mapper()
59
+ {
60
+ client_side_validation: true,
61
+ required: false,
62
+ serialized_name: 'ServerKeyListResult',
63
+ type: {
64
+ name: 'Composite',
65
+ class_name: 'ServerKeyListResult',
66
+ model_properties: {
67
+ value: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ read_only: true,
71
+ serialized_name: 'value',
72
+ type: {
73
+ name: 'Sequence',
74
+ element: {
75
+ client_side_validation: true,
76
+ required: false,
77
+ serialized_name: 'ServerKeyElementType',
78
+ type: {
79
+ name: 'Composite',
80
+ class_name: 'ServerKey'
81
+ }
82
+ }
83
+ }
84
+ },
85
+ next_link: {
86
+ client_side_validation: true,
87
+ required: false,
88
+ read_only: true,
89
+ serialized_name: 'nextLink',
90
+ type: {
91
+ name: 'String'
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,47 @@
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::Mysql::Mgmt::V2020_01_01
7
+ module Models
8
+ #
9
+ # Model object.
10
+ #
11
+ #
12
+ class ServerUpgradeParameters
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [String] Represents an server storage profile.
17
+ attr_accessor :target_server_version
18
+
19
+
20
+ #
21
+ # Mapper for ServerUpgradeParameters class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ client_side_validation: true,
27
+ required: false,
28
+ serialized_name: 'ServerUpgradeParameters',
29
+ type: {
30
+ name: 'Composite',
31
+ class_name: 'ServerUpgradeParameters',
32
+ model_properties: {
33
+ target_server_version: {
34
+ client_side_validation: true,
35
+ required: false,
36
+ serialized_name: 'properties.targetServerVersion',
37
+ type: {
38
+ name: 'String'
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,92 @@
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::Mysql::Mgmt::V2020_01_01
7
+ module Models
8
+ #
9
+ # The resource model definition for a ARM tracked top level resource
10
+ #
11
+ class TrackedResource < Resource
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Hash{String => String}] Resource tags.
16
+ attr_accessor :tags
17
+
18
+ # @return [String] The geo-location where the resource lives
19
+ attr_accessor :location
20
+
21
+
22
+ #
23
+ # Mapper for TrackedResource class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'TrackedResource',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'TrackedResource',
34
+ model_properties: {
35
+ id: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ read_only: true,
39
+ serialized_name: 'id',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ name: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ read_only: true,
48
+ serialized_name: 'name',
49
+ type: {
50
+ name: 'String'
51
+ }
52
+ },
53
+ type: {
54
+ client_side_validation: true,
55
+ required: false,
56
+ read_only: true,
57
+ serialized_name: 'type',
58
+ type: {
59
+ name: 'String'
60
+ }
61
+ },
62
+ tags: {
63
+ client_side_validation: true,
64
+ required: false,
65
+ serialized_name: 'tags',
66
+ type: {
67
+ name: 'Dictionary',
68
+ value: {
69
+ client_side_validation: true,
70
+ required: false,
71
+ serialized_name: 'StringElementType',
72
+ type: {
73
+ name: 'String'
74
+ }
75
+ }
76
+ }
77
+ },
78
+ location: {
79
+ client_side_validation: true,
80
+ required: true,
81
+ serialized_name: 'location',
82
+ type: {
83
+ name: 'String'
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Mysql end
8
+ module Azure::Mysql::Mgmt end
9
+ module Azure::Mysql::Mgmt::V2020_01_01 end
@@ -0,0 +1,135 @@
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::Mysql::Mgmt::V2020_01_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class MySQLManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The ID of the target subscription.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] The API version to use for this operation.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [ServerKeys] server_keys
39
+ attr_reader :server_keys
40
+
41
+ # @return [Servers] servers
42
+ attr_reader :servers
43
+
44
+ #
45
+ # Creates initializes a new instance of the MySQLManagementClient class.
46
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
47
+ # @param base_url [String] the base URI of the service.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials = nil, base_url = nil, options = nil)
51
+ super(credentials, options)
52
+ @base_url = base_url || 'https://management.azure.com'
53
+
54
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
55
+ @credentials = credentials
56
+
57
+ @server_keys = ServerKeys.new(self)
58
+ @servers = Servers.new(self)
59
+ @api_version = '2020-01-01'
60
+ @accept_language = 'en-US'
61
+ @long_running_operation_retry_timeout = 30
62
+ @generate_client_request_id = true
63
+ add_telemetry
64
+ end
65
+
66
+ #
67
+ # Makes a request and returns the body of the response.
68
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
69
+ # @param path [String] the path, relative to {base_url}.
70
+ # @param options [Hash{String=>String}] specifying any request options like :body.
71
+ # @return [Hash{String=>String}] containing the body of the response.
72
+ # Example:
73
+ #
74
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
75
+ # path = "/path"
76
+ # options = {
77
+ # body: request_content,
78
+ # query_params: {'api-version' => '2016-02-01'}
79
+ # }
80
+ # result = @client.make_request(:put, path, options)
81
+ #
82
+ def make_request(method, path, options = {})
83
+ result = make_request_with_http_info(method, path, options)
84
+ result.body unless result.nil?
85
+ end
86
+
87
+ #
88
+ # Makes a request and returns the operation response.
89
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
90
+ # @param path [String] the path, relative to {base_url}.
91
+ # @param options [Hash{String=>String}] specifying any request options like :body.
92
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
93
+ #
94
+ def make_request_with_http_info(method, path, options = {})
95
+ result = make_request_async(method, path, options).value!
96
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
97
+ result
98
+ end
99
+
100
+ #
101
+ # Makes a request asynchronously.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
106
+ #
107
+ def make_request_async(method, path, options = {})
108
+ fail ArgumentError, 'method is nil' if method.nil?
109
+ fail ArgumentError, 'path is nil' if path.nil?
110
+
111
+ request_url = options[:base_url] || @base_url
112
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
113
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
114
+ end
115
+
116
+ request_headers = @request_headers
117
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
118
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
119
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
120
+
121
+ super(request_url, method, path, options)
122
+ end
123
+
124
+
125
+ private
126
+ #
127
+ # Adds telemetry information.
128
+ #
129
+ def add_telemetry
130
+ sdk_information = 'azure_mgmt_mysql'
131
+ sdk_information = "#{sdk_information}/0.17.2"
132
+ add_user_agent_information(sdk_information)
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,666 @@
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::Mysql::Mgmt::V2020_01_01
7
+ #
8
+ # The Microsoft Azure management API provides create, read, update, and
9
+ # delete functionality for Azure MySQL resources including servers,
10
+ # databases, firewall rules, VNET rules, security alert policies, log files,
11
+ # encryption keys, active directory administrator and configurations.
12
+ #
13
+ class ServerKeys
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ServerKeys class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [MySQLManagementClient] reference to the MySQLManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets a list of Server keys.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group. The name
31
+ # is case insensitive.
32
+ # @param server_name [String] The name of the server.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Array<ServerKey>] operation results.
37
+ #
38
+ def list(resource_group_name, server_name, custom_headers:nil)
39
+ first_page = list_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
40
+ first_page.get_all_items
41
+ end
42
+
43
+ #
44
+ # Gets a list of Server keys.
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group. The name
47
+ # is case insensitive.
48
+ # @param server_name [String] The name of the server.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def list_with_http_info(resource_group_name, server_name, custom_headers:nil)
55
+ list_async(resource_group_name, server_name, custom_headers:custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Gets a list of Server keys.
60
+ #
61
+ # @param resource_group_name [String] The name of the resource group. The name
62
+ # is case insensitive.
63
+ # @param server_name [String] The name of the server.
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, server_name, custom_headers:nil)
70
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
71
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
72
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
73
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
74
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
76
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
78
+ fail ArgumentError, 'server_name is nil' if server_name.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.DBforMySQL/servers/{serverName}/keys'
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,'serverName' => server_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 MsRestAzure::AzureOperationError.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
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
111
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKeyListResult.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Gets a MySQL Server key.
131
+ #
132
+ # @param resource_group_name [String] The name of the resource group. The name
133
+ # is case insensitive.
134
+ # @param server_name [String] The name of the server.
135
+ # @param key_name [String] The name of the MySQL Server key to be retrieved.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [ServerKey] operation results.
140
+ #
141
+ def get(resource_group_name, server_name, key_name, custom_headers:nil)
142
+ response = get_async(resource_group_name, server_name, key_name, custom_headers:custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Gets a MySQL Server key.
148
+ #
149
+ # @param resource_group_name [String] The name of the resource group. The name
150
+ # is case insensitive.
151
+ # @param server_name [String] The name of the server.
152
+ # @param key_name [String] The name of the MySQL Server key to be retrieved.
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, server_name, key_name, custom_headers:nil)
159
+ get_async(resource_group_name, server_name, key_name, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Gets a MySQL Server key.
164
+ #
165
+ # @param resource_group_name [String] The name of the resource group. The name
166
+ # is case insensitive.
167
+ # @param server_name [String] The name of the server.
168
+ # @param key_name [String] The name of the MySQL Server key to be retrieved.
169
+ # @param [Hash{String => String}] A hash of custom headers that will be added
170
+ # to the HTTP request.
171
+ #
172
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
173
+ #
174
+ def get_async(resource_group_name, server_name, key_name, custom_headers:nil)
175
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
176
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
177
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
178
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
179
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
180
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
181
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
182
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
183
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
184
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
185
+
186
+
187
+ request_headers = {}
188
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
189
+
190
+ # Set Headers
191
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
192
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
193
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}'
194
+
195
+ request_url = @base_url || @client.base_url
196
+
197
+ options = {
198
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
199
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'keyName' => key_name,'subscriptionId' => @client.subscription_id},
200
+ query_params: {'api-version' => @client.api_version},
201
+ headers: request_headers.merge(custom_headers || {}),
202
+ base_url: request_url
203
+ }
204
+ promise = @client.make_request_async(:get, path_template, options)
205
+
206
+ promise = promise.then do |result|
207
+ http_response = result.response
208
+ status_code = http_response.status
209
+ response_content = http_response.body
210
+ unless status_code == 200
211
+ error_model = JSON.load(response_content)
212
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
213
+ end
214
+
215
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
216
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
217
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
218
+ # Deserialize Response
219
+ if status_code == 200
220
+ begin
221
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
222
+ result_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKey.mapper()
223
+ result.body = @client.deserialize(result_mapper, parsed_response)
224
+ rescue Exception => e
225
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
226
+ end
227
+ end
228
+
229
+ result
230
+ end
231
+
232
+ promise.execute
233
+ end
234
+
235
+ #
236
+ # Creates or updates a MySQL Server key.
237
+ #
238
+ # @param server_name [String] The name of the server.
239
+ # @param key_name [String] The name of the MySQL Server key to be operated on
240
+ # (updated or created).
241
+ # @param parameters [ServerKey] The requested MySQL Server key resource state.
242
+ # @param resource_group_name [String] The name of the resource group. The name
243
+ # is case insensitive.
244
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
245
+ # will be added to the HTTP request.
246
+ #
247
+ # @return [ServerKey] operation results.
248
+ #
249
+ def create_or_update(server_name, key_name, parameters, resource_group_name, custom_headers:nil)
250
+ response = create_or_update_async(server_name, key_name, parameters, resource_group_name, custom_headers:custom_headers).value!
251
+ response.body unless response.nil?
252
+ end
253
+
254
+ #
255
+ # @param server_name [String] The name of the server.
256
+ # @param key_name [String] The name of the MySQL Server key to be operated on
257
+ # (updated or created).
258
+ # @param parameters [ServerKey] The requested MySQL Server key resource state.
259
+ # @param resource_group_name [String] The name of the resource group. The name
260
+ # is case insensitive.
261
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
262
+ # will be added to the HTTP request.
263
+ #
264
+ # @return [Concurrent::Promise] promise which provides async access to http
265
+ # response.
266
+ #
267
+ def create_or_update_async(server_name, key_name, parameters, resource_group_name, custom_headers:nil)
268
+ # Send request
269
+ promise = begin_create_or_update_async(server_name, key_name, parameters, resource_group_name, custom_headers:custom_headers)
270
+
271
+ promise = promise.then do |response|
272
+ # Defining deserialization method.
273
+ deserialize_method = lambda do |parsed_response|
274
+ result_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKey.mapper()
275
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
276
+ end
277
+
278
+ # Waiting for response.
279
+ @client.get_long_running_operation_result(response, deserialize_method)
280
+ end
281
+
282
+ promise
283
+ end
284
+
285
+ #
286
+ # Deletes the MySQL Server key with the given name.
287
+ #
288
+ # @param server_name [String] The name of the server.
289
+ # @param key_name [String] The name of the MySQL Server key to be deleted.
290
+ # @param resource_group_name [String] The name of the resource group. The name
291
+ # is case insensitive.
292
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
293
+ # will be added to the HTTP request.
294
+ #
295
+ def delete(server_name, key_name, resource_group_name, custom_headers:nil)
296
+ response = delete_async(server_name, key_name, resource_group_name, custom_headers:custom_headers).value!
297
+ nil
298
+ end
299
+
300
+ #
301
+ # @param server_name [String] The name of the server.
302
+ # @param key_name [String] The name of the MySQL Server key to be deleted.
303
+ # @param resource_group_name [String] The name of the resource group. The name
304
+ # is case insensitive.
305
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
306
+ # will be added to the HTTP request.
307
+ #
308
+ # @return [Concurrent::Promise] promise which provides async access to http
309
+ # response.
310
+ #
311
+ def delete_async(server_name, key_name, resource_group_name, custom_headers:nil)
312
+ # Send request
313
+ promise = begin_delete_async(server_name, key_name, resource_group_name, custom_headers:custom_headers)
314
+
315
+ promise = promise.then do |response|
316
+ # Defining deserialization method.
317
+ deserialize_method = lambda do |parsed_response|
318
+ end
319
+
320
+ # Waiting for response.
321
+ @client.get_long_running_operation_result(response, deserialize_method)
322
+ end
323
+
324
+ promise
325
+ end
326
+
327
+ #
328
+ # Creates or updates a MySQL Server key.
329
+ #
330
+ # @param server_name [String] The name of the server.
331
+ # @param key_name [String] The name of the MySQL Server key to be operated on
332
+ # (updated or created).
333
+ # @param parameters [ServerKey] The requested MySQL Server key resource state.
334
+ # @param resource_group_name [String] The name of the resource group. The name
335
+ # is case insensitive.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [ServerKey] operation results.
340
+ #
341
+ def begin_create_or_update(server_name, key_name, parameters, resource_group_name, custom_headers:nil)
342
+ response = begin_create_or_update_async(server_name, key_name, parameters, resource_group_name, custom_headers:custom_headers).value!
343
+ response.body unless response.nil?
344
+ end
345
+
346
+ #
347
+ # Creates or updates a MySQL Server key.
348
+ #
349
+ # @param server_name [String] The name of the server.
350
+ # @param key_name [String] The name of the MySQL Server key to be operated on
351
+ # (updated or created).
352
+ # @param parameters [ServerKey] The requested MySQL Server key resource state.
353
+ # @param resource_group_name [String] The name of the resource group. The name
354
+ # is case insensitive.
355
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
356
+ # will be added to the HTTP request.
357
+ #
358
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
359
+ #
360
+ def begin_create_or_update_with_http_info(server_name, key_name, parameters, resource_group_name, custom_headers:nil)
361
+ begin_create_or_update_async(server_name, key_name, parameters, resource_group_name, custom_headers:custom_headers).value!
362
+ end
363
+
364
+ #
365
+ # Creates or updates a MySQL Server key.
366
+ #
367
+ # @param server_name [String] The name of the server.
368
+ # @param key_name [String] The name of the MySQL Server key to be operated on
369
+ # (updated or created).
370
+ # @param parameters [ServerKey] The requested MySQL Server key resource state.
371
+ # @param resource_group_name [String] The name of the resource group. The name
372
+ # is case insensitive.
373
+ # @param [Hash{String => String}] A hash of custom headers that will be added
374
+ # to the HTTP request.
375
+ #
376
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
377
+ #
378
+ def begin_create_or_update_async(server_name, key_name, parameters, resource_group_name, custom_headers:nil)
379
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
380
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
381
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
382
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
383
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
384
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
385
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
386
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
387
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
388
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
389
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
390
+
391
+
392
+ request_headers = {}
393
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
394
+
395
+ # Set Headers
396
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
397
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
398
+
399
+ # Serialize Request
400
+ request_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKey.mapper()
401
+ request_content = @client.serialize(request_mapper, parameters)
402
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
403
+
404
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}'
405
+
406
+ request_url = @base_url || @client.base_url
407
+
408
+ options = {
409
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
410
+ path_params: {'serverName' => server_name,'keyName' => key_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
411
+ query_params: {'api-version' => @client.api_version},
412
+ body: request_content,
413
+ headers: request_headers.merge(custom_headers || {}),
414
+ base_url: request_url
415
+ }
416
+ promise = @client.make_request_async(:put, path_template, options)
417
+
418
+ promise = promise.then do |result|
419
+ http_response = result.response
420
+ status_code = http_response.status
421
+ response_content = http_response.body
422
+ unless status_code == 200 || status_code == 202
423
+ error_model = JSON.load(response_content)
424
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
425
+ end
426
+
427
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
428
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
429
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
430
+ # Deserialize Response
431
+ if status_code == 200
432
+ begin
433
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
434
+ result_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKey.mapper()
435
+ result.body = @client.deserialize(result_mapper, parsed_response)
436
+ rescue Exception => e
437
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
438
+ end
439
+ end
440
+ # Deserialize Response
441
+ if status_code == 202
442
+ begin
443
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
444
+ result_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKey.mapper()
445
+ result.body = @client.deserialize(result_mapper, parsed_response)
446
+ rescue Exception => e
447
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
448
+ end
449
+ end
450
+
451
+ result
452
+ end
453
+
454
+ promise.execute
455
+ end
456
+
457
+ #
458
+ # Deletes the MySQL Server key with the given name.
459
+ #
460
+ # @param server_name [String] The name of the server.
461
+ # @param key_name [String] The name of the MySQL Server key to be deleted.
462
+ # @param resource_group_name [String] The name of the resource group. The name
463
+ # is case insensitive.
464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
+ # will be added to the HTTP request.
466
+ #
467
+ #
468
+ def begin_delete(server_name, key_name, resource_group_name, custom_headers:nil)
469
+ response = begin_delete_async(server_name, key_name, resource_group_name, custom_headers:custom_headers).value!
470
+ nil
471
+ end
472
+
473
+ #
474
+ # Deletes the MySQL Server key with the given name.
475
+ #
476
+ # @param server_name [String] The name of the server.
477
+ # @param key_name [String] The name of the MySQL Server key to be deleted.
478
+ # @param resource_group_name [String] The name of the resource group. The name
479
+ # is case insensitive.
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def begin_delete_with_http_info(server_name, key_name, resource_group_name, custom_headers:nil)
486
+ begin_delete_async(server_name, key_name, resource_group_name, custom_headers:custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # Deletes the MySQL Server key with the given name.
491
+ #
492
+ # @param server_name [String] The name of the server.
493
+ # @param key_name [String] The name of the MySQL Server key to be deleted.
494
+ # @param resource_group_name [String] The name of the resource group. The name
495
+ # is case insensitive.
496
+ # @param [Hash{String => String}] A hash of custom headers that will be added
497
+ # to the HTTP request.
498
+ #
499
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
500
+ #
501
+ def begin_delete_async(server_name, key_name, resource_group_name, custom_headers:nil)
502
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
503
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
504
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
505
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
506
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
507
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
508
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
509
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
510
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
511
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMySQL/servers/{serverName}/keys/{keyName}'
521
+
522
+ request_url = @base_url || @client.base_url
523
+
524
+ options = {
525
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
526
+ path_params: {'serverName' => server_name,'keyName' => key_name,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
527
+ query_params: {'api-version' => @client.api_version},
528
+ headers: request_headers.merge(custom_headers || {}),
529
+ base_url: request_url
530
+ }
531
+ promise = @client.make_request_async(:delete, path_template, options)
532
+
533
+ promise = promise.then do |result|
534
+ http_response = result.response
535
+ status_code = http_response.status
536
+ response_content = http_response.body
537
+ unless status_code == 200 || status_code == 202 || status_code == 204
538
+ error_model = JSON.load(response_content)
539
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
540
+ end
541
+
542
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
543
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
544
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
545
+
546
+ result
547
+ end
548
+
549
+ promise.execute
550
+ end
551
+
552
+ #
553
+ # Gets a list of Server keys.
554
+ #
555
+ # @param next_page_link [String] The NextLink from the previous successful call
556
+ # to List operation.
557
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
558
+ # will be added to the HTTP request.
559
+ #
560
+ # @return [ServerKeyListResult] operation results.
561
+ #
562
+ def list_next(next_page_link, custom_headers:nil)
563
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
564
+ response.body unless response.nil?
565
+ end
566
+
567
+ #
568
+ # Gets a list of Server keys.
569
+ #
570
+ # @param next_page_link [String] The NextLink from the previous successful call
571
+ # to List operation.
572
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
573
+ # will be added to the HTTP request.
574
+ #
575
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
576
+ #
577
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
578
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
579
+ end
580
+
581
+ #
582
+ # Gets a list of Server keys.
583
+ #
584
+ # @param next_page_link [String] The NextLink from the previous successful call
585
+ # to List operation.
586
+ # @param [Hash{String => String}] A hash of custom headers that will be added
587
+ # to the HTTP request.
588
+ #
589
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
590
+ #
591
+ def list_next_async(next_page_link, custom_headers:nil)
592
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
593
+
594
+
595
+ request_headers = {}
596
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
597
+
598
+ # Set Headers
599
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
600
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
601
+ path_template = '{nextLink}'
602
+
603
+ request_url = @base_url || @client.base_url
604
+
605
+ options = {
606
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
607
+ skip_encoding_path_params: {'nextLink' => next_page_link},
608
+ headers: request_headers.merge(custom_headers || {}),
609
+ base_url: request_url
610
+ }
611
+ promise = @client.make_request_async(:get, path_template, options)
612
+
613
+ promise = promise.then do |result|
614
+ http_response = result.response
615
+ status_code = http_response.status
616
+ response_content = http_response.body
617
+ unless status_code == 200
618
+ error_model = JSON.load(response_content)
619
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
620
+ end
621
+
622
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
623
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
624
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
625
+ # Deserialize Response
626
+ if status_code == 200
627
+ begin
628
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
629
+ result_mapper = Azure::Mysql::Mgmt::V2020_01_01::Models::ServerKeyListResult.mapper()
630
+ result.body = @client.deserialize(result_mapper, parsed_response)
631
+ rescue Exception => e
632
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
633
+ end
634
+ end
635
+
636
+ result
637
+ end
638
+
639
+ promise.execute
640
+ end
641
+
642
+ #
643
+ # Gets a list of Server keys.
644
+ #
645
+ # @param resource_group_name [String] The name of the resource group. The name
646
+ # is case insensitive.
647
+ # @param server_name [String] The name of the server.
648
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
649
+ # will be added to the HTTP request.
650
+ #
651
+ # @return [ServerKeyListResult] which provide lazy access to pages of the
652
+ # response.
653
+ #
654
+ def list_as_lazy(resource_group_name, server_name, custom_headers:nil)
655
+ response = list_async(resource_group_name, server_name, custom_headers:custom_headers).value!
656
+ unless response.nil?
657
+ page = response.body
658
+ page.next_method = Proc.new do |next_page_link|
659
+ list_next_async(next_page_link, custom_headers:custom_headers)
660
+ end
661
+ page
662
+ end
663
+ end
664
+
665
+ end
666
+ end