azure_mgmt_postgresql 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql.rb +71 -0
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/check_name_availability.rb +126 -0
  5. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb +396 -0
  6. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/databases.rb +541 -0
  7. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/firewall_rules.rb +541 -0
  8. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +116 -0
  9. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/log_files.rb +126 -0
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/configuration.rb +132 -0
  11. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/configuration_list_result.rb +55 -0
  12. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/database.rb +84 -0
  13. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/database_list_result.rb +55 -0
  14. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/firewall_rule.rb +92 -0
  15. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb +55 -0
  16. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb +16 -0
  17. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/log_file.rb +119 -0
  18. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/log_file_list_result.rb +55 -0
  19. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/name_availability.rb +68 -0
  20. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/name_availability_request.rb +57 -0
  21. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation.rb +95 -0
  22. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_display.rb +83 -0
  23. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_list_result.rb +55 -0
  24. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/operation_origin.rb +17 -0
  25. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb +56 -0
  26. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb +67 -0
  27. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb +126 -0
  28. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/proxy_resource.rb +71 -0
  29. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server.rb +220 -0
  30. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_for_create.rb +92 -0
  31. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_list_result.rb +55 -0
  32. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +86 -0
  33. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb +100 -0
  34. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb +88 -0
  35. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb +87 -0
  36. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb +99 -0
  37. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_state.rb +17 -0
  38. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +115 -0
  39. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_version.rb +16 -0
  40. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/sku.rb +97 -0
  41. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/sku_tier.rb +17 -0
  42. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb +16 -0
  43. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_profile.rb +69 -0
  44. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/tracked_resource.rb +93 -0
  45. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/module_definition.rb +9 -0
  46. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/operations.rb +110 -0
  47. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +164 -0
  48. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/replicas.rb +126 -0
  49. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/servers.rb +771 -0
  50. data/lib/2017-12-01/generated/azure_mgmt_postgresql.rb +78 -0
  51. data/lib/2017-12-01/generated/azure_mgmt_postgresql/check_name_availability.rb +126 -0
  52. data/lib/2017-12-01/generated/azure_mgmt_postgresql/configurations.rb +396 -0
  53. data/lib/2017-12-01/generated/azure_mgmt_postgresql/databases.rb +541 -0
  54. data/lib/2017-12-01/generated/azure_mgmt_postgresql/firewall_rules.rb +541 -0
  55. data/lib/2017-12-01/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +116 -0
  56. data/lib/2017-12-01/generated/azure_mgmt_postgresql/log_files.rb +126 -0
  57. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/configuration.rb +132 -0
  58. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/configuration_list_result.rb +55 -0
  59. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/database.rb +84 -0
  60. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/database_list_result.rb +55 -0
  61. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule.rb +92 -0
  62. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb +55 -0
  63. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb +16 -0
  64. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/log_file.rb +119 -0
  65. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/log_file_list_result.rb +55 -0
  66. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/name_availability.rb +68 -0
  67. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/name_availability_request.rb +57 -0
  68. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation.rb +95 -0
  69. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_display.rb +83 -0
  70. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_list_result.rb +55 -0
  71. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/operation_origin.rb +17 -0
  72. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb +56 -0
  73. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb +67 -0
  74. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb +126 -0
  75. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/proxy_resource.rb +71 -0
  76. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server.rb +220 -0
  77. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_for_create.rb +92 -0
  78. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_list_result.rb +55 -0
  79. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +86 -0
  80. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb +100 -0
  81. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb +88 -0
  82. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb +87 -0
  83. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb +99 -0
  84. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy.rb +166 -0
  85. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy_state.rb +16 -0
  86. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_state.rb +17 -0
  87. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +126 -0
  88. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_version.rb +19 -0
  89. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/sku.rb +97 -0
  90. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/sku_tier.rb +17 -0
  91. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb +16 -0
  92. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_profile.rb +69 -0
  93. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/tracked_resource.rb +93 -0
  94. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule.rb +99 -0
  95. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_list_result.rb +100 -0
  96. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_state.rb +19 -0
  97. data/lib/2017-12-01/generated/azure_mgmt_postgresql/module_definition.rb +9 -0
  98. data/lib/2017-12-01/generated/azure_mgmt_postgresql/operations.rb +110 -0
  99. data/lib/2017-12-01/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +172 -0
  100. data/lib/2017-12-01/generated/azure_mgmt_postgresql/replicas.rb +126 -0
  101. data/lib/2017-12-01/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +290 -0
  102. data/lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb +900 -0
  103. data/lib/2017-12-01/generated/azure_mgmt_postgresql/virtual_network_rules.rb +666 -0
  104. data/lib/azure_mgmt_postgresql.rb +7 -0
  105. data/lib/module_definition.rb +7 -0
  106. data/lib/profiles/latest/modules/postgresql_profile_module.rb +241 -0
  107. data/lib/profiles/latest/postgresql_latest_profile_client.rb +40 -0
  108. data/lib/profiles/latest/postgresql_module_definition.rb +8 -0
  109. data/lib/version.rb +7 -0
  110. metadata +225 -0
@@ -0,0 +1,99 @@
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::Postgresql::Mgmt::V2017_12_01
7
+ module Models
8
+ #
9
+ # A virtual network rule.
10
+ #
11
+ class VirtualNetworkRule < ProxyResource
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The ARM resource id of the virtual network subnet.
16
+ attr_accessor :virtual_network_subnet_id
17
+
18
+ # @return [Boolean] Create firewall rule before the virtual network has
19
+ # vnet service endpoint enabled.
20
+ attr_accessor :ignore_missing_vnet_service_endpoint
21
+
22
+ # @return [VirtualNetworkRuleState] Virtual Network Rule State. Possible
23
+ # values include: 'Initializing', 'InProgress', 'Ready', 'Deleting',
24
+ # 'Unknown'
25
+ attr_accessor :state
26
+
27
+
28
+ #
29
+ # Mapper for VirtualNetworkRule class as Ruby Hash.
30
+ # This will be used for serialization/deserialization.
31
+ #
32
+ def self.mapper()
33
+ {
34
+ client_side_validation: true,
35
+ required: false,
36
+ serialized_name: 'VirtualNetworkRule',
37
+ type: {
38
+ name: 'Composite',
39
+ class_name: 'VirtualNetworkRule',
40
+ model_properties: {
41
+ id: {
42
+ client_side_validation: true,
43
+ required: false,
44
+ read_only: true,
45
+ serialized_name: 'id',
46
+ type: {
47
+ name: 'String'
48
+ }
49
+ },
50
+ name: {
51
+ client_side_validation: true,
52
+ required: false,
53
+ read_only: true,
54
+ serialized_name: 'name',
55
+ type: {
56
+ name: 'String'
57
+ }
58
+ },
59
+ type: {
60
+ client_side_validation: true,
61
+ required: false,
62
+ read_only: true,
63
+ serialized_name: 'type',
64
+ type: {
65
+ name: 'String'
66
+ }
67
+ },
68
+ virtual_network_subnet_id: {
69
+ client_side_validation: true,
70
+ required: true,
71
+ serialized_name: 'properties.virtualNetworkSubnetId',
72
+ type: {
73
+ name: 'String'
74
+ }
75
+ },
76
+ ignore_missing_vnet_service_endpoint: {
77
+ client_side_validation: true,
78
+ required: false,
79
+ serialized_name: 'properties.ignoreMissingVnetServiceEndpoint',
80
+ type: {
81
+ name: 'Boolean'
82
+ }
83
+ },
84
+ state: {
85
+ client_side_validation: true,
86
+ required: false,
87
+ read_only: true,
88
+ serialized_name: 'properties.state',
89
+ type: {
90
+ name: 'String'
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ end
97
+ end
98
+ end
99
+ end
@@ -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::Postgresql::Mgmt::V2017_12_01
7
+ module Models
8
+ #
9
+ # A list of virtual network rules.
10
+ #
11
+ class VirtualNetworkRuleListResult
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [Array<VirtualNetworkRule>] Array of results.
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<VirtualNetworkRule>] 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 [VirtualNetworkRuleListResult] 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 VirtualNetworkRuleListResult 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: 'VirtualNetworkRuleListResult',
63
+ type: {
64
+ name: 'Composite',
65
+ class_name: 'VirtualNetworkRuleListResult',
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: 'VirtualNetworkRuleElementType',
78
+ type: {
79
+ name: 'Composite',
80
+ class_name: 'VirtualNetworkRule'
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,19 @@
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::Postgresql::Mgmt::V2017_12_01
7
+ module Models
8
+ #
9
+ # Defines values for VirtualNetworkRuleState
10
+ #
11
+ module VirtualNetworkRuleState
12
+ Initializing = "Initializing"
13
+ InProgress = "InProgress"
14
+ Ready = "Ready"
15
+ Deleting = "Deleting"
16
+ Unknown = "Unknown"
17
+ end
18
+ end
19
+ 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::Postgresql end
8
+ module Azure::Postgresql::Mgmt end
9
+ module Azure::Postgresql::Mgmt::V2017_12_01 end
@@ -0,0 +1,110 @@
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::Postgresql::Mgmt::V2017_12_01
7
+ #
8
+ # The Microsoft Azure management API provides create, read, update, and
9
+ # delete functionality for Azure PostgreSQL resources including servers,
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with new business model.
12
+ #
13
+ class Operations
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Operations class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [PostgreSQLManagementClient] reference to the PostgreSQLManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Lists all of the available REST API operations.
29
+ #
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [OperationListResult] operation results.
34
+ #
35
+ def list(custom_headers:nil)
36
+ response = list_async(custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Lists all of the available REST API operations.
42
+ #
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def list_with_http_info(custom_headers:nil)
49
+ list_async(custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Lists all of the available REST API operations.
54
+ #
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+
63
+
64
+ request_headers = {}
65
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
66
+
67
+ # Set Headers
68
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
70
+ path_template = 'providers/Microsoft.DBforPostgreSQL/operations'
71
+
72
+ request_url = @base_url || @client.base_url
73
+
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ query_params: {'api-version' => @client.api_version},
77
+ headers: request_headers.merge(custom_headers || {}),
78
+ base_url: request_url
79
+ }
80
+ promise = @client.make_request_async(:get, path_template, options)
81
+
82
+ promise = promise.then do |result|
83
+ http_response = result.response
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
89
+ end
90
+
91
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ # Deserialize Response
93
+ if status_code == 200
94
+ begin
95
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
96
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::OperationListResult.mapper()
97
+ result.body = @client.deserialize(result_mapper, parsed_response)
98
+ rescue Exception => e
99
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
100
+ end
101
+ end
102
+
103
+ result
104
+ end
105
+
106
+ promise.execute
107
+ end
108
+
109
+ end
110
+ end
@@ -0,0 +1,172 @@
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::Postgresql::Mgmt::V2017_12_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class PostgreSQLManagementClient < 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 subscription ID that identifies an Azure
21
+ # subscription.
22
+ attr_accessor :subscription_id
23
+
24
+ # @return [String] The API version to use for the request.
25
+ attr_reader :api_version
26
+
27
+ # @return [String] The preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [Servers] servers
40
+ attr_reader :servers
41
+
42
+ # @return [Replicas] replicas
43
+ attr_reader :replicas
44
+
45
+ # @return [FirewallRules] firewall_rules
46
+ attr_reader :firewall_rules
47
+
48
+ # @return [VirtualNetworkRules] virtual_network_rules
49
+ attr_reader :virtual_network_rules
50
+
51
+ # @return [Databases] databases
52
+ attr_reader :databases
53
+
54
+ # @return [Configurations] configurations
55
+ attr_reader :configurations
56
+
57
+ # @return [LogFiles] log_files
58
+ attr_reader :log_files
59
+
60
+ # @return [LocationBasedPerformanceTier] location_based_performance_tier
61
+ attr_reader :location_based_performance_tier
62
+
63
+ # @return [CheckNameAvailability] check_name_availability
64
+ attr_reader :check_name_availability
65
+
66
+ # @return [ServerSecurityAlertPolicies] server_security_alert_policies
67
+ attr_reader :server_security_alert_policies
68
+
69
+ # @return [Operations] operations
70
+ attr_reader :operations
71
+
72
+ #
73
+ # Creates initializes a new instance of the PostgreSQLManagementClient class.
74
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
75
+ # @param base_url [String] the base URI of the service.
76
+ # @param options [Array] filters to be applied to the HTTP requests.
77
+ #
78
+ def initialize(credentials = nil, base_url = nil, options = nil)
79
+ super(credentials, options)
80
+ @base_url = base_url || 'https://management.azure.com'
81
+
82
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
83
+ @credentials = credentials
84
+
85
+ @servers = Servers.new(self)
86
+ @replicas = Replicas.new(self)
87
+ @firewall_rules = FirewallRules.new(self)
88
+ @virtual_network_rules = VirtualNetworkRules.new(self)
89
+ @databases = Databases.new(self)
90
+ @configurations = Configurations.new(self)
91
+ @log_files = LogFiles.new(self)
92
+ @location_based_performance_tier = LocationBasedPerformanceTier.new(self)
93
+ @check_name_availability = CheckNameAvailability.new(self)
94
+ @server_security_alert_policies = ServerSecurityAlertPolicies.new(self)
95
+ @operations = Operations.new(self)
96
+ @api_version = '2017-12-01'
97
+ @accept_language = 'en-US'
98
+ @long_running_operation_retry_timeout = 30
99
+ @generate_client_request_id = true
100
+ add_telemetry
101
+ end
102
+
103
+ #
104
+ # Makes a request and returns the body of the response.
105
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
106
+ # @param path [String] the path, relative to {base_url}.
107
+ # @param options [Hash{String=>String}] specifying any request options like :body.
108
+ # @return [Hash{String=>String}] containing the body of the response.
109
+ # Example:
110
+ #
111
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
112
+ # path = "/path"
113
+ # options = {
114
+ # body: request_content,
115
+ # query_params: {'api-version' => '2016-02-01'}
116
+ # }
117
+ # result = @client.make_request(:put, path, options)
118
+ #
119
+ def make_request(method, path, options = {})
120
+ result = make_request_with_http_info(method, path, options)
121
+ result.body unless result.nil?
122
+ end
123
+
124
+ #
125
+ # Makes a request and returns the operation response.
126
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
127
+ # @param path [String] the path, relative to {base_url}.
128
+ # @param options [Hash{String=>String}] specifying any request options like :body.
129
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
130
+ #
131
+ def make_request_with_http_info(method, path, options = {})
132
+ result = make_request_async(method, path, options).value!
133
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
134
+ result
135
+ end
136
+
137
+ #
138
+ # Makes a request asynchronously.
139
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
140
+ # @param path [String] the path, relative to {base_url}.
141
+ # @param options [Hash{String=>String}] specifying any request options like :body.
142
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
143
+ #
144
+ def make_request_async(method, path, options = {})
145
+ fail ArgumentError, 'method is nil' if method.nil?
146
+ fail ArgumentError, 'path is nil' if path.nil?
147
+
148
+ request_url = options[:base_url] || @base_url
149
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
150
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
151
+ end
152
+
153
+ request_headers = @request_headers
154
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
155
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
156
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
157
+
158
+ super(request_url, method, path, options)
159
+ end
160
+
161
+
162
+ private
163
+ #
164
+ # Adds telemetry information.
165
+ #
166
+ def add_telemetry
167
+ sdk_information = 'azure_mgmt_postgresql'
168
+ sdk_information = "#{sdk_information}/0.17.0"
169
+ add_user_agent_information(sdk_information)
170
+ end
171
+ end
172
+ end