azure_mgmt_postgresql 0.17.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql.rb +18 -10
  3. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/check_name_availability.rb +4 -2
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/configurations.rb +8 -2
  5. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/databases.rb +10 -2
  6. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/firewall_rules.rb +10 -2
  7. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +4 -2
  8. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/log_files.rb +4 -2
  9. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server.rb +1 -1
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +1 -1
  11. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_security_alert_policy.rb +166 -0
  12. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_security_alert_policy_state.rb +16 -0
  13. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +12 -1
  14. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/server_version.rb +4 -0
  15. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_autogrow.rb +16 -0
  16. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/storage_profile.rb +12 -0
  17. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/virtual_network_rule.rb +99 -0
  18. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/virtual_network_rule_list_result.rb +100 -0
  19. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/models/virtual_network_rule_state.rb +19 -0
  20. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/operations.rb +4 -2
  21. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +9 -1
  22. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/replicas.rb +4 -2
  23. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +294 -0
  24. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/servers.rb +145 -2
  25. data/lib/2017-12-01-preview/generated/azure_mgmt_postgresql/virtual_network_rules.rb +676 -0
  26. data/lib/2017-12-01/generated/azure_mgmt_postgresql.rb +1 -0
  27. data/lib/2017-12-01/generated/azure_mgmt_postgresql/check_name_availability.rb +2 -0
  28. data/lib/2017-12-01/generated/azure_mgmt_postgresql/configurations.rb +6 -0
  29. data/lib/2017-12-01/generated/azure_mgmt_postgresql/databases.rb +8 -0
  30. data/lib/2017-12-01/generated/azure_mgmt_postgresql/firewall_rules.rb +8 -0
  31. data/lib/2017-12-01/generated/azure_mgmt_postgresql/location_based_performance_tier.rb +2 -0
  32. data/lib/2017-12-01/generated/azure_mgmt_postgresql/log_files.rb +2 -0
  33. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server.rb +1 -1
  34. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_properties_for_create.rb +1 -1
  35. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_update_parameters.rb +1 -1
  36. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/server_version.rb +1 -0
  37. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_autogrow.rb +16 -0
  38. data/lib/2017-12-01/generated/azure_mgmt_postgresql/models/storage_profile.rb +12 -0
  39. data/lib/2017-12-01/generated/azure_mgmt_postgresql/operations.rb +2 -0
  40. data/lib/2017-12-01/generated/azure_mgmt_postgresql/postgre_sqlmanagement_client.rb +1 -1
  41. data/lib/2017-12-01/generated/azure_mgmt_postgresql/replicas.rb +2 -0
  42. data/lib/2017-12-01/generated/azure_mgmt_postgresql/server_security_alert_policies.rb +4 -0
  43. data/lib/2017-12-01/generated/azure_mgmt_postgresql/servers.rb +14 -0
  44. data/lib/2017-12-01/generated/azure_mgmt_postgresql/virtual_network_rules.rb +10 -0
  45. data/lib/profiles/latest/modules/postgresql_profile_module.rb +4 -0
  46. data/lib/version.rb +1 -1
  47. metadata +14 -5
@@ -0,0 +1,16 @@
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_preview
7
+ module Models
8
+ #
9
+ # Defines values for ServerSecurityAlertPolicyState
10
+ #
11
+ module ServerSecurityAlertPolicyState
12
+ Enabled = "Enabled"
13
+ Disabled = "Disabled"
14
+ end
15
+ end
16
+ end
@@ -22,13 +22,16 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
22
22
  attr_accessor :administrator_login_password
23
23
 
24
24
  # @return [ServerVersion] The version of a server. Possible values
25
- # include: '9.5', '9.6'
25
+ # include: '9.5', '9.6', '10', '10.0', '10.2', '11'
26
26
  attr_accessor :version
27
27
 
28
28
  # @return [SslEnforcementEnum] Enable ssl enforcement or not when connect
29
29
  # to server. Possible values include: 'Enabled', 'Disabled'
30
30
  attr_accessor :ssl_enforcement
31
31
 
32
+ # @return [String] The replication role of the server.
33
+ attr_accessor :replication_role
34
+
32
35
  # @return [Hash{String => String}] Application-specific metadata in the
33
36
  # form of key-value pairs.
34
37
  attr_accessor :tags
@@ -90,6 +93,14 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
90
93
  module: 'SslEnforcementEnum'
91
94
  }
92
95
  },
96
+ replication_role: {
97
+ client_side_validation: true,
98
+ required: false,
99
+ serialized_name: 'properties.replicationRole',
100
+ type: {
101
+ name: 'String'
102
+ }
103
+ },
93
104
  tags: {
94
105
  client_side_validation: true,
95
106
  required: false,
@@ -11,6 +11,10 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
11
11
  module ServerVersion
12
12
  NineFullStopFive = "9.5"
13
13
  NineFullStopSix = "9.6"
14
+ OneZero = "10"
15
+ OneZeroFullStopZero = "10.0"
16
+ OneZeroFullStopTwo = "10.2"
17
+ OneOne = "11"
14
18
  end
15
19
  end
16
20
  end
@@ -0,0 +1,16 @@
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_preview
7
+ module Models
8
+ #
9
+ # Defines values for StorageAutogrow
10
+ #
11
+ module StorageAutogrow
12
+ Enabled = "Enabled"
13
+ Disabled = "Disabled"
14
+ end
15
+ end
16
+ end
@@ -22,6 +22,10 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
22
22
  # @return [Integer] Max storage allowed for a server.
23
23
  attr_accessor :storage_mb
24
24
 
25
+ # @return [StorageAutogrow] Enable Storage Auto Grow. Possible values
26
+ # include: 'Enabled', 'Disabled'
27
+ attr_accessor :storage_autogrow
28
+
25
29
 
26
30
  #
27
31
  # Mapper for StorageProfile class as Ruby Hash.
@@ -59,6 +63,14 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
59
63
  type: {
60
64
  name: 'Number'
61
65
  }
66
+ },
67
+ storage_autogrow: {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'storageAutogrow',
71
+ type: {
72
+ name: 'String'
73
+ }
62
74
  }
63
75
  }
64
76
  }
@@ -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_preview
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_preview
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_preview
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
@@ -7,8 +7,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
7
7
  #
8
8
  # The Microsoft Azure management API provides create, read, update, and
9
9
  # delete functionality for Azure PostgreSQL resources including servers,
10
- # databases, firewall rules, log files and configurations with new business
11
- # model.
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with new business model.
12
12
  #
13
13
  class Operations
14
14
  include MsRestAzure
@@ -89,6 +89,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
89
89
  end
90
90
 
91
91
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
93
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
92
94
  # Deserialize Response
93
95
  if status_code == 200
94
96
  begin
@@ -45,6 +45,9 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
45
45
  # @return [FirewallRules] firewall_rules
46
46
  attr_reader :firewall_rules
47
47
 
48
+ # @return [VirtualNetworkRules] virtual_network_rules
49
+ attr_reader :virtual_network_rules
50
+
48
51
  # @return [Databases] databases
49
52
  attr_reader :databases
50
53
 
@@ -60,6 +63,9 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
60
63
  # @return [CheckNameAvailability] check_name_availability
61
64
  attr_reader :check_name_availability
62
65
 
66
+ # @return [ServerSecurityAlertPolicies] server_security_alert_policies
67
+ attr_reader :server_security_alert_policies
68
+
63
69
  # @return [Operations] operations
64
70
  attr_reader :operations
65
71
 
@@ -79,11 +85,13 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
79
85
  @servers = Servers.new(self)
80
86
  @replicas = Replicas.new(self)
81
87
  @firewall_rules = FirewallRules.new(self)
88
+ @virtual_network_rules = VirtualNetworkRules.new(self)
82
89
  @databases = Databases.new(self)
83
90
  @configurations = Configurations.new(self)
84
91
  @log_files = LogFiles.new(self)
85
92
  @location_based_performance_tier = LocationBasedPerformanceTier.new(self)
86
93
  @check_name_availability = CheckNameAvailability.new(self)
94
+ @server_security_alert_policies = ServerSecurityAlertPolicies.new(self)
87
95
  @operations = Operations.new(self)
88
96
  @api_version = '2017-12-01-preview'
89
97
  @accept_language = 'en-US'
@@ -157,7 +165,7 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
157
165
  #
158
166
  def add_telemetry
159
167
  sdk_information = 'azure_mgmt_postgresql'
160
- sdk_information = "#{sdk_information}/0.17.0"
168
+ sdk_information = "#{sdk_information}/0.17.1"
161
169
  add_user_agent_information(sdk_information)
162
170
  end
163
171
  end
@@ -7,8 +7,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
7
7
  #
8
8
  # The Microsoft Azure management API provides create, read, update, and
9
9
  # delete functionality for Azure PostgreSQL resources including servers,
10
- # databases, firewall rules, log files and configurations with new business
11
- # model.
10
+ # databases, firewall rules, VNET rules, security alert policies, log files
11
+ # and configurations with new business model.
12
12
  #
13
13
  class Replicas
14
14
  include MsRestAzure
@@ -105,6 +105,8 @@ module Azure::Postgresql::Mgmt::V2017_12_01_preview
105
105
  end
106
106
 
107
107
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
109
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
108
110
  # Deserialize Response
109
111
  if status_code == 200
110
112
  begin
@@ -0,0 +1,294 @@
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_preview
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 ServerSecurityAlertPolicies
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ServerSecurityAlertPolicies 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
+ # Get a server's security alert policy.
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 custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [ServerSecurityAlertPolicy] operation results.
38
+ #
39
+ def get(resource_group_name, server_name, custom_headers:nil)
40
+ response = get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Get a server's security alert policy.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the resource. You can obtain this value from the Azure Resource
49
+ # Manager API or the portal.
50
+ # @param server_name [String] The name of the server.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def get_with_http_info(resource_group_name, server_name, custom_headers:nil)
57
+ get_async(resource_group_name, server_name, custom_headers:custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Get a server's security alert policy.
62
+ #
63
+ # @param resource_group_name [String] The name of the resource group that
64
+ # contains the resource. You can obtain this value from the Azure Resource
65
+ # Manager API or the portal.
66
+ # @param server_name [String] The name of the server.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def get_async(resource_group_name, server_name, custom_headers:nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
75
+ security_alert_policy_name = 'Default'
76
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+
79
+
80
+ request_headers = {}
81
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
82
+
83
+ # Set Headers
84
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
85
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
86
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
87
+
88
+ request_url = @base_url || @client.base_url
89
+
90
+ options = {
91
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
92
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
93
+ query_params: {'api-version' => @client.api_version},
94
+ headers: request_headers.merge(custom_headers || {}),
95
+ base_url: request_url
96
+ }
97
+ promise = @client.make_request_async(:get, path_template, options)
98
+
99
+ promise = promise.then do |result|
100
+ http_response = result.response
101
+ status_code = http_response.status
102
+ response_content = http_response.body
103
+ unless status_code == 200
104
+ error_model = JSON.load(response_content)
105
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
106
+ end
107
+
108
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
109
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
110
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
111
+ # Deserialize Response
112
+ if status_code == 200
113
+ begin
114
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
115
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
116
+ result.body = @client.deserialize(result_mapper, parsed_response)
117
+ rescue Exception => e
118
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
119
+ end
120
+ end
121
+
122
+ result
123
+ end
124
+
125
+ promise.execute
126
+ end
127
+
128
+ #
129
+ # Creates or updates a threat detection policy.
130
+ #
131
+ # @param resource_group_name [String] The name of the resource group that
132
+ # contains the resource. You can obtain this value from the Azure Resource
133
+ # Manager API or the portal.
134
+ # @param server_name [String] The name of the server.
135
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
136
+ # policy.
137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
138
+ # will be added to the HTTP request.
139
+ #
140
+ # @return [ServerSecurityAlertPolicy] operation results.
141
+ #
142
+ def create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
143
+ response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
144
+ response.body unless response.nil?
145
+ end
146
+
147
+ #
148
+ # @param resource_group_name [String] The name of the resource group that
149
+ # contains the resource. You can obtain this value from the Azure Resource
150
+ # Manager API or the portal.
151
+ # @param server_name [String] The name of the server.
152
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
153
+ # policy.
154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
155
+ # will be added to the HTTP request.
156
+ #
157
+ # @return [Concurrent::Promise] promise which provides async access to http
158
+ # response.
159
+ #
160
+ def create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
161
+ # Send request
162
+ promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers)
163
+
164
+ promise = promise.then do |response|
165
+ # Defining deserialization method.
166
+ deserialize_method = lambda do |parsed_response|
167
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
168
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
169
+ end
170
+
171
+ # Waiting for response.
172
+ @client.get_long_running_operation_result(response, deserialize_method)
173
+ end
174
+
175
+ promise
176
+ end
177
+
178
+ #
179
+ # Creates or updates a threat detection policy.
180
+ #
181
+ # @param resource_group_name [String] The name of the resource group that
182
+ # contains the resource. You can obtain this value from the Azure Resource
183
+ # Manager API or the portal.
184
+ # @param server_name [String] The name of the server.
185
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
186
+ # policy.
187
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
188
+ # will be added to the HTTP request.
189
+ #
190
+ # @return [ServerSecurityAlertPolicy] operation results.
191
+ #
192
+ def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers:nil)
193
+ response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
194
+ response.body unless response.nil?
195
+ end
196
+
197
+ #
198
+ # Creates or updates a threat detection policy.
199
+ #
200
+ # @param resource_group_name [String] The name of the resource group that
201
+ # contains the resource. You can obtain this value from the Azure Resource
202
+ # Manager API or the portal.
203
+ # @param server_name [String] The name of the server.
204
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
205
+ # policy.
206
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
207
+ # will be added to the HTTP request.
208
+ #
209
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
210
+ #
211
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
212
+ begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
213
+ end
214
+
215
+ #
216
+ # Creates or updates a threat detection policy.
217
+ #
218
+ # @param resource_group_name [String] The name of the resource group that
219
+ # contains the resource. You can obtain this value from the Azure Resource
220
+ # Manager API or the portal.
221
+ # @param server_name [String] The name of the server.
222
+ # @param parameters [ServerSecurityAlertPolicy] The server security alert
223
+ # policy.
224
+ # @param [Hash{String => String}] A hash of custom headers that will be added
225
+ # to the HTTP request.
226
+ #
227
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
228
+ #
229
+ def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers:nil)
230
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
231
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
232
+ security_alert_policy_name = 'Default'
233
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
234
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
235
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
236
+
237
+
238
+ request_headers = {}
239
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
240
+
241
+ # Set Headers
242
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
243
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
244
+
245
+ # Serialize Request
246
+ request_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
247
+ request_content = @client.serialize(request_mapper, parameters)
248
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
249
+
250
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}'
251
+
252
+ request_url = @base_url || @client.base_url
253
+
254
+ options = {
255
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
256
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'securityAlertPolicyName' => security_alert_policy_name,'subscriptionId' => @client.subscription_id},
257
+ query_params: {'api-version' => @client.api_version},
258
+ body: request_content,
259
+ headers: request_headers.merge(custom_headers || {}),
260
+ base_url: request_url
261
+ }
262
+ promise = @client.make_request_async(:put, path_template, options)
263
+
264
+ promise = promise.then do |result|
265
+ http_response = result.response
266
+ status_code = http_response.status
267
+ response_content = http_response.body
268
+ unless status_code == 200 || status_code == 202
269
+ error_model = JSON.load(response_content)
270
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
271
+ end
272
+
273
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
274
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
275
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
276
+ # Deserialize Response
277
+ if status_code == 200
278
+ begin
279
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
280
+ result_mapper = Azure::Postgresql::Mgmt::V2017_12_01_preview::Models::ServerSecurityAlertPolicy.mapper()
281
+ result.body = @client.deserialize(result_mapper, parsed_response)
282
+ rescue Exception => e
283
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
284
+ end
285
+ end
286
+
287
+ result
288
+ end
289
+
290
+ promise.execute
291
+ end
292
+
293
+ end
294
+ end