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,78 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2017-12-01/generated/azure_mgmt_postgresql/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Postgresql::Mgmt::V2017_12_01
23
+ autoload :Servers, '2017-12-01/generated/azure_mgmt_postgresql/servers.rb'
24
+ autoload :Replicas, '2017-12-01/generated/azure_mgmt_postgresql/replicas.rb'
25
+ autoload :FirewallRules, '2017-12-01/generated/azure_mgmt_postgresql/firewall_rules.rb'
26
+ autoload :VirtualNetworkRules, '2017-12-01/generated/azure_mgmt_postgresql/virtual_network_rules.rb'
27
+ autoload :Databases, '2017-12-01/generated/azure_mgmt_postgresql/databases.rb'
28
+ autoload :Configurations, '2017-12-01/generated/azure_mgmt_postgresql/configurations.rb'
29
+ autoload :LogFiles, '2017-12-01/generated/azure_mgmt_postgresql/log_files.rb'
30
+ autoload :LocationBasedPerformanceTier, '2017-12-01/generated/azure_mgmt_postgresql/location_based_performance_tier.rb'
31
+ autoload :CheckNameAvailability, '2017-12-01/generated/azure_mgmt_postgresql/check_name_availability.rb'
32
+ autoload :ServerSecurityAlertPolicies, '2017-12-01/generated/azure_mgmt_postgresql/server_security_alert_policies.rb'
33
+ autoload :Operations, '2017-12-01/generated/azure_mgmt_postgresql/operations.rb'
34
+ autoload :PostgreSQLManagementClient, '2017-12-01/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb'
35
+
36
+ module Models
37
+ autoload :VirtualNetworkRuleListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_list_result.rb'
38
+ autoload :FirewallRuleListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule_list_result.rb'
39
+ autoload :NameAvailabilityRequest, '2017-12-01/generated/azure_mgmt_postgresql/models/name_availability_request.rb'
40
+ autoload :StorageProfile, '2017-12-01/generated/azure_mgmt_postgresql/models/storage_profile.rb'
41
+ autoload :ProxyResource, '2017-12-01/generated/azure_mgmt_postgresql/models/proxy_resource.rb'
42
+ autoload :NameAvailability, '2017-12-01/generated/azure_mgmt_postgresql/models/name_availability.rb'
43
+ autoload :PerformanceTierListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_list_result.rb'
44
+ autoload :Operation, '2017-12-01/generated/azure_mgmt_postgresql/models/operation.rb'
45
+ autoload :PerformanceTierServiceLevelObjectives, '2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_service_level_objectives.rb'
46
+ autoload :ServerPropertiesForCreate, '2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb'
47
+ autoload :LogFileListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/log_file_list_result.rb'
48
+ autoload :OperationListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/operation_list_result.rb'
49
+ autoload :ServerUpdateParameters, '2017-12-01/generated/azure_mgmt_postgresql/models/server_update_parameters.rb'
50
+ autoload :PerformanceTierProperties, '2017-12-01/generated/azure_mgmt_postgresql/models/performance_tier_properties.rb'
51
+ autoload :DatabaseListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/database_list_result.rb'
52
+ autoload :ServerForCreate, '2017-12-01/generated/azure_mgmt_postgresql/models/server_for_create.rb'
53
+ autoload :Sku, '2017-12-01/generated/azure_mgmt_postgresql/models/sku.rb'
54
+ autoload :ConfigurationListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/configuration_list_result.rb'
55
+ autoload :ServerListResult, '2017-12-01/generated/azure_mgmt_postgresql/models/server_list_result.rb'
56
+ autoload :OperationDisplay, '2017-12-01/generated/azure_mgmt_postgresql/models/operation_display.rb'
57
+ autoload :TrackedResource, '2017-12-01/generated/azure_mgmt_postgresql/models/tracked_resource.rb'
58
+ autoload :ServerPropertiesForDefaultCreate, '2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_default_create.rb'
59
+ autoload :ServerPropertiesForRestore, '2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_restore.rb'
60
+ autoload :ServerPropertiesForGeoRestore, '2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_geo_restore.rb'
61
+ autoload :ServerPropertiesForReplica, '2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_replica.rb'
62
+ autoload :Server, '2017-12-01/generated/azure_mgmt_postgresql/models/server.rb'
63
+ autoload :FirewallRule, '2017-12-01/generated/azure_mgmt_postgresql/models/firewall_rule.rb'
64
+ autoload :VirtualNetworkRule, '2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule.rb'
65
+ autoload :Database, '2017-12-01/generated/azure_mgmt_postgresql/models/database.rb'
66
+ autoload :Configuration, '2017-12-01/generated/azure_mgmt_postgresql/models/configuration.rb'
67
+ autoload :LogFile, '2017-12-01/generated/azure_mgmt_postgresql/models/log_file.rb'
68
+ autoload :ServerSecurityAlertPolicy, '2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy.rb'
69
+ autoload :ServerVersion, '2017-12-01/generated/azure_mgmt_postgresql/models/server_version.rb'
70
+ autoload :SslEnforcementEnum, '2017-12-01/generated/azure_mgmt_postgresql/models/ssl_enforcement_enum.rb'
71
+ autoload :ServerState, '2017-12-01/generated/azure_mgmt_postgresql/models/server_state.rb'
72
+ autoload :GeoRedundantBackup, '2017-12-01/generated/azure_mgmt_postgresql/models/geo_redundant_backup.rb'
73
+ autoload :SkuTier, '2017-12-01/generated/azure_mgmt_postgresql/models/sku_tier.rb'
74
+ autoload :VirtualNetworkRuleState, '2017-12-01/generated/azure_mgmt_postgresql/models/virtual_network_rule_state.rb'
75
+ autoload :OperationOrigin, '2017-12-01/generated/azure_mgmt_postgresql/models/operation_origin.rb'
76
+ autoload :ServerSecurityAlertPolicyState, '2017-12-01/generated/azure_mgmt_postgresql/models/server_security_alert_policy_state.rb'
77
+ end
78
+ end
@@ -0,0 +1,126 @@
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 CheckNameAvailability
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the CheckNameAvailability 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
+ # Check the availability of name for resource
29
+ #
30
+ # @param name_availability_request [NameAvailabilityRequest] The required
31
+ # parameters for checking if resource name is available.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ # @return [NameAvailability] operation results.
36
+ #
37
+ def execute(name_availability_request, custom_headers:nil)
38
+ response = execute_async(name_availability_request, custom_headers:custom_headers).value!
39
+ response.body unless response.nil?
40
+ end
41
+
42
+ #
43
+ # Check the availability of name for resource
44
+ #
45
+ # @param name_availability_request [NameAvailabilityRequest] The required
46
+ # parameters for checking if resource name is available.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def execute_with_http_info(name_availability_request, custom_headers:nil)
53
+ execute_async(name_availability_request, custom_headers:custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Check the availability of name for resource
58
+ #
59
+ # @param name_availability_request [NameAvailabilityRequest] The required
60
+ # parameters for checking if resource name is available.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def execute_async(name_availability_request, custom_headers:nil)
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ fail ArgumentError, 'name_availability_request is nil' if name_availability_request.nil?
70
+
71
+
72
+ request_headers = {}
73
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
74
+
75
+ # Set Headers
76
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
77
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
78
+
79
+ # Serialize Request
80
+ request_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::NameAvailabilityRequest.mapper()
81
+ request_content = @client.serialize(request_mapper, name_availability_request)
82
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
83
+
84
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'subscriptionId' => @client.subscription_id},
91
+ query_params: {'api-version' => @client.api_version},
92
+ body: request_content,
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:post, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::NameAvailability.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ end
126
+ end
@@ -0,0 +1,396 @@
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 Configurations
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Configurations 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
+ # Updates a configuration of a server.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the resource. You can obtain this value from the Azure Resource
32
+ # Manager API or the portal.
33
+ # @param server_name [String] The name of the server.
34
+ # @param configuration_name [String] The name of the server configuration.
35
+ # @param parameters [Configuration] The required parameters for updating a
36
+ # server configuration.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ # @return [Configuration] operation results.
41
+ #
42
+ def create_or_update(resource_group_name, server_name, configuration_name, parameters, custom_headers:nil)
43
+ response = create_or_update_async(resource_group_name, server_name, configuration_name, parameters, custom_headers:custom_headers).value!
44
+ response.body unless response.nil?
45
+ end
46
+
47
+ #
48
+ # @param resource_group_name [String] The name of the resource group that
49
+ # contains the resource. You can obtain this value from the Azure Resource
50
+ # Manager API or the portal.
51
+ # @param server_name [String] The name of the server.
52
+ # @param configuration_name [String] The name of the server configuration.
53
+ # @param parameters [Configuration] The required parameters for updating a
54
+ # server configuration.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] promise which provides async access to http
59
+ # response.
60
+ #
61
+ def create_or_update_async(resource_group_name, server_name, configuration_name, parameters, custom_headers:nil)
62
+ # Send request
63
+ promise = begin_create_or_update_async(resource_group_name, server_name, configuration_name, parameters, custom_headers:custom_headers)
64
+
65
+ promise = promise.then do |response|
66
+ # Defining deserialization method.
67
+ deserialize_method = lambda do |parsed_response|
68
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Configuration.mapper()
69
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
70
+ end
71
+
72
+ # Waiting for response.
73
+ @client.get_long_running_operation_result(response, deserialize_method)
74
+ end
75
+
76
+ promise
77
+ end
78
+
79
+ #
80
+ # Gets information about a configuration of server.
81
+ #
82
+ # @param resource_group_name [String] The name of the resource group that
83
+ # contains the resource. You can obtain this value from the Azure Resource
84
+ # Manager API or the portal.
85
+ # @param server_name [String] The name of the server.
86
+ # @param configuration_name [String] The name of the server configuration.
87
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
88
+ # will be added to the HTTP request.
89
+ #
90
+ # @return [Configuration] operation results.
91
+ #
92
+ def get(resource_group_name, server_name, configuration_name, custom_headers:nil)
93
+ response = get_async(resource_group_name, server_name, configuration_name, custom_headers:custom_headers).value!
94
+ response.body unless response.nil?
95
+ end
96
+
97
+ #
98
+ # Gets information about a configuration of server.
99
+ #
100
+ # @param resource_group_name [String] The name of the resource group that
101
+ # contains the resource. You can obtain this value from the Azure Resource
102
+ # Manager API or the portal.
103
+ # @param server_name [String] The name of the server.
104
+ # @param configuration_name [String] The name of the server configuration.
105
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
106
+ # will be added to the HTTP request.
107
+ #
108
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
109
+ #
110
+ def get_with_http_info(resource_group_name, server_name, configuration_name, custom_headers:nil)
111
+ get_async(resource_group_name, server_name, configuration_name, custom_headers:custom_headers).value!
112
+ end
113
+
114
+ #
115
+ # Gets information about a configuration of server.
116
+ #
117
+ # @param resource_group_name [String] The name of the resource group that
118
+ # contains the resource. You can obtain this value from the Azure Resource
119
+ # Manager API or the portal.
120
+ # @param server_name [String] The name of the server.
121
+ # @param configuration_name [String] The name of the server configuration.
122
+ # @param [Hash{String => String}] A hash of custom headers that will be added
123
+ # to the HTTP request.
124
+ #
125
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
126
+ #
127
+ def get_async(resource_group_name, server_name, configuration_name, custom_headers:nil)
128
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
129
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
130
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
131
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
132
+ fail ArgumentError, 'configuration_name is nil' if configuration_name.nil?
133
+
134
+
135
+ request_headers = {}
136
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
137
+
138
+ # Set Headers
139
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
140
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
141
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}'
142
+
143
+ request_url = @base_url || @client.base_url
144
+
145
+ options = {
146
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
147
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'configurationName' => configuration_name},
148
+ query_params: {'api-version' => @client.api_version},
149
+ headers: request_headers.merge(custom_headers || {}),
150
+ base_url: request_url
151
+ }
152
+ promise = @client.make_request_async(:get, path_template, options)
153
+
154
+ promise = promise.then do |result|
155
+ http_response = result.response
156
+ status_code = http_response.status
157
+ response_content = http_response.body
158
+ unless status_code == 200
159
+ error_model = JSON.load(response_content)
160
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
161
+ end
162
+
163
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
164
+ # Deserialize Response
165
+ if status_code == 200
166
+ begin
167
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
168
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Configuration.mapper()
169
+ result.body = @client.deserialize(result_mapper, parsed_response)
170
+ rescue Exception => e
171
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
172
+ end
173
+ end
174
+
175
+ result
176
+ end
177
+
178
+ promise.execute
179
+ end
180
+
181
+ #
182
+ # List all the configurations in a given server.
183
+ #
184
+ # @param resource_group_name [String] The name of the resource group that
185
+ # contains the resource. You can obtain this value from the Azure Resource
186
+ # Manager API or the portal.
187
+ # @param server_name [String] The name of the server.
188
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
189
+ # will be added to the HTTP request.
190
+ #
191
+ # @return [ConfigurationListResult] operation results.
192
+ #
193
+ def list_by_server(resource_group_name, server_name, custom_headers:nil)
194
+ response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
195
+ response.body unless response.nil?
196
+ end
197
+
198
+ #
199
+ # List all the configurations in a given server.
200
+ #
201
+ # @param resource_group_name [String] The name of the resource group that
202
+ # contains the resource. You can obtain this value from the Azure Resource
203
+ # Manager API or the portal.
204
+ # @param server_name [String] The name of the server.
205
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
206
+ # will be added to the HTTP request.
207
+ #
208
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
209
+ #
210
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
211
+ list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
212
+ end
213
+
214
+ #
215
+ # List all the configurations in a given server.
216
+ #
217
+ # @param resource_group_name [String] The name of the resource group that
218
+ # contains the resource. You can obtain this value from the Azure Resource
219
+ # Manager API or the portal.
220
+ # @param server_name [String] The name of the server.
221
+ # @param [Hash{String => String}] A hash of custom headers that will be added
222
+ # to the HTTP request.
223
+ #
224
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
225
+ #
226
+ def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
227
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
228
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
229
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
230
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
231
+
232
+
233
+ request_headers = {}
234
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
235
+
236
+ # Set Headers
237
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
238
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
239
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations'
240
+
241
+ request_url = @base_url || @client.base_url
242
+
243
+ options = {
244
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
245
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
246
+ query_params: {'api-version' => @client.api_version},
247
+ headers: request_headers.merge(custom_headers || {}),
248
+ base_url: request_url
249
+ }
250
+ promise = @client.make_request_async(:get, path_template, options)
251
+
252
+ promise = promise.then do |result|
253
+ http_response = result.response
254
+ status_code = http_response.status
255
+ response_content = http_response.body
256
+ unless status_code == 200
257
+ error_model = JSON.load(response_content)
258
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
259
+ end
260
+
261
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
262
+ # Deserialize Response
263
+ if status_code == 200
264
+ begin
265
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
266
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::ConfigurationListResult.mapper()
267
+ result.body = @client.deserialize(result_mapper, parsed_response)
268
+ rescue Exception => e
269
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
270
+ end
271
+ end
272
+
273
+ result
274
+ end
275
+
276
+ promise.execute
277
+ end
278
+
279
+ #
280
+ # Updates a configuration of a server.
281
+ #
282
+ # @param resource_group_name [String] The name of the resource group that
283
+ # contains the resource. You can obtain this value from the Azure Resource
284
+ # Manager API or the portal.
285
+ # @param server_name [String] The name of the server.
286
+ # @param configuration_name [String] The name of the server configuration.
287
+ # @param parameters [Configuration] The required parameters for updating a
288
+ # server configuration.
289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
290
+ # will be added to the HTTP request.
291
+ #
292
+ # @return [Configuration] operation results.
293
+ #
294
+ def begin_create_or_update(resource_group_name, server_name, configuration_name, parameters, custom_headers:nil)
295
+ response = begin_create_or_update_async(resource_group_name, server_name, configuration_name, parameters, custom_headers:custom_headers).value!
296
+ response.body unless response.nil?
297
+ end
298
+
299
+ #
300
+ # Updates a configuration of a server.
301
+ #
302
+ # @param resource_group_name [String] The name of the resource group that
303
+ # contains the resource. You can obtain this value from the Azure Resource
304
+ # Manager API or the portal.
305
+ # @param server_name [String] The name of the server.
306
+ # @param configuration_name [String] The name of the server configuration.
307
+ # @param parameters [Configuration] The required parameters for updating a
308
+ # server configuration.
309
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
310
+ # will be added to the HTTP request.
311
+ #
312
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
313
+ #
314
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, configuration_name, parameters, custom_headers:nil)
315
+ begin_create_or_update_async(resource_group_name, server_name, configuration_name, parameters, custom_headers:custom_headers).value!
316
+ end
317
+
318
+ #
319
+ # Updates a configuration of a server.
320
+ #
321
+ # @param resource_group_name [String] The name of the resource group that
322
+ # contains the resource. You can obtain this value from the Azure Resource
323
+ # Manager API or the portal.
324
+ # @param server_name [String] The name of the server.
325
+ # @param configuration_name [String] The name of the server configuration.
326
+ # @param parameters [Configuration] The required parameters for updating a
327
+ # server configuration.
328
+ # @param [Hash{String => String}] A hash of custom headers that will be added
329
+ # to the HTTP request.
330
+ #
331
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
332
+ #
333
+ def begin_create_or_update_async(resource_group_name, server_name, configuration_name, parameters, custom_headers:nil)
334
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
335
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
336
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
337
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
338
+ fail ArgumentError, 'configuration_name is nil' if configuration_name.nil?
339
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
340
+
341
+
342
+ request_headers = {}
343
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
344
+
345
+ # Set Headers
346
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
347
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
348
+
349
+ # Serialize Request
350
+ request_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Configuration.mapper()
351
+ request_content = @client.serialize(request_mapper, parameters)
352
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
353
+
354
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}'
355
+
356
+ request_url = @base_url || @client.base_url
357
+
358
+ options = {
359
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
360
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'configurationName' => configuration_name},
361
+ query_params: {'api-version' => @client.api_version},
362
+ body: request_content,
363
+ headers: request_headers.merge(custom_headers || {}),
364
+ base_url: request_url
365
+ }
366
+ promise = @client.make_request_async(:put, path_template, options)
367
+
368
+ promise = promise.then do |result|
369
+ http_response = result.response
370
+ status_code = http_response.status
371
+ response_content = http_response.body
372
+ unless status_code == 200 || status_code == 202
373
+ error_model = JSON.load(response_content)
374
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
375
+ end
376
+
377
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
378
+ # Deserialize Response
379
+ if status_code == 200
380
+ begin
381
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
382
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01::Models::Configuration.mapper()
383
+ result.body = @client.deserialize(result_mapper, parsed_response)
384
+ rescue Exception => e
385
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
386
+ end
387
+ end
388
+
389
+ result
390
+ end
391
+
392
+ promise.execute
393
+ end
394
+
395
+ end
396
+ end