azure_mgmt_security 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-08-01-preview/generated/azure_mgmt_security.rb +48 -0
  4. data/lib/2017-08-01-preview/generated/azure_mgmt_security/auto_provisioning_settings.rb +407 -0
  5. data/lib/2017-08-01-preview/generated/azure_mgmt_security/compliances.rb +325 -0
  6. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/alert_notifications.rb +16 -0
  7. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/alerts_to_admins.rb +16 -0
  8. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/auto_provisioning_setting.rb +75 -0
  9. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/auto_provisioning_setting_list.rb +100 -0
  10. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/compliance.rb +111 -0
  11. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/compliance_list.rb +99 -0
  12. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/compliance_segment.rb +60 -0
  13. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/pricing.rb +74 -0
  14. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/pricing_list.rb +99 -0
  15. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/pricing_tier.rb +16 -0
  16. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/provisioning_setting.rb +16 -0
  17. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/resource.rb +71 -0
  18. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/security_contact.rb +109 -0
  19. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/security_contact_list.rb +100 -0
  20. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/workspace_setting.rb +86 -0
  21. data/lib/2017-08-01-preview/generated/azure_mgmt_security/models/workspace_setting_list.rb +99 -0
  22. data/lib/2017-08-01-preview/generated/azure_mgmt_security/module_definition.rb +9 -0
  23. data/lib/2017-08-01-preview/generated/azure_mgmt_security/pricings.rb +822 -0
  24. data/lib/2017-08-01-preview/generated/azure_mgmt_security/security_contacts.rb +585 -0
  25. data/lib/2017-08-01-preview/generated/azure_mgmt_security/security_management_client.rb +146 -0
  26. data/lib/2017-08-01-preview/generated/azure_mgmt_security/workspace_settings.rb +588 -0
  27. data/lib/azure_mgmt_security.rb +6 -0
  28. data/lib/module_definition.rb +7 -0
  29. data/lib/profiles/latest/modules/security_profile_module.rb +133 -0
  30. data/lib/profiles/latest/security_latest_profile_client.rb +40 -0
  31. data/lib/profiles/latest/security_module_definition.rb +8 -0
  32. data/lib/version.rb +7 -0
  33. metadata +150 -0
@@ -0,0 +1,146 @@
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::Security::Mgmt::V2017_08_01_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class SecurityManagementClient < 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] Azure subscription ID
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] API version for the operation
24
+ attr_reader :api_version
25
+
26
+ # @return [String] Gets or sets the preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
+ # Running Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
+ # is generated and included in each request. Default is true.
35
+ attr_accessor :generate_client_request_id
36
+
37
+ # @return [Pricings] pricings
38
+ attr_reader :pricings
39
+
40
+ # @return [SecurityContacts] security_contacts
41
+ attr_reader :security_contacts
42
+
43
+ # @return [WorkspaceSettings] workspace_settings
44
+ attr_reader :workspace_settings
45
+
46
+ # @return [AutoProvisioningSettings] auto_provisioning_settings
47
+ attr_reader :auto_provisioning_settings
48
+
49
+ # @return [Compliances] compliances
50
+ attr_reader :compliances
51
+
52
+ #
53
+ # Creates initializes a new instance of the SecurityManagementClient class.
54
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
55
+ # @param base_url [String] the base URI of the service.
56
+ # @param options [Array] filters to be applied to the HTTP requests.
57
+ #
58
+ def initialize(credentials = nil, base_url = nil, options = nil)
59
+ super(credentials, options)
60
+ @base_url = base_url || 'https://management.azure.com'
61
+
62
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
63
+ @credentials = credentials
64
+
65
+ @pricings = Pricings.new(self)
66
+ @security_contacts = SecurityContacts.new(self)
67
+ @workspace_settings = WorkspaceSettings.new(self)
68
+ @auto_provisioning_settings = AutoProvisioningSettings.new(self)
69
+ @compliances = Compliances.new(self)
70
+ @api_version = '2017-08-01-preview'
71
+ @accept_language = 'en-US'
72
+ @long_running_operation_retry_timeout = 30
73
+ @generate_client_request_id = true
74
+ add_telemetry
75
+ end
76
+
77
+ #
78
+ # Makes a request and returns the body of the response.
79
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
80
+ # @param path [String] the path, relative to {base_url}.
81
+ # @param options [Hash{String=>String}] specifying any request options like :body.
82
+ # @return [Hash{String=>String}] containing the body of the response.
83
+ # Example:
84
+ #
85
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
86
+ # path = "/path"
87
+ # options = {
88
+ # body: request_content,
89
+ # query_params: {'api-version' => '2016-02-01'}
90
+ # }
91
+ # result = @client.make_request(:put, path, options)
92
+ #
93
+ def make_request(method, path, options = {})
94
+ result = make_request_with_http_info(method, path, options)
95
+ result.body unless result.nil?
96
+ end
97
+
98
+ #
99
+ # Makes a request and returns the operation response.
100
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
101
+ # @param path [String] the path, relative to {base_url}.
102
+ # @param options [Hash{String=>String}] specifying any request options like :body.
103
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
104
+ #
105
+ def make_request_with_http_info(method, path, options = {})
106
+ result = make_request_async(method, path, options).value!
107
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
108
+ result
109
+ end
110
+
111
+ #
112
+ # Makes a request asynchronously.
113
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
114
+ # @param path [String] the path, relative to {base_url}.
115
+ # @param options [Hash{String=>String}] specifying any request options like :body.
116
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
117
+ #
118
+ def make_request_async(method, path, options = {})
119
+ fail ArgumentError, 'method is nil' if method.nil?
120
+ fail ArgumentError, 'path is nil' if path.nil?
121
+
122
+ request_url = options[:base_url] || @base_url
123
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
124
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
125
+ end
126
+
127
+ request_headers = @request_headers
128
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
129
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
130
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
131
+
132
+ super(request_url, method, path, options)
133
+ end
134
+
135
+
136
+ private
137
+ #
138
+ # Adds telemetry information.
139
+ #
140
+ def add_telemetry
141
+ sdk_information = 'azure_mgmt_security'
142
+ sdk_information = "#{sdk_information}/0.16.0"
143
+ add_user_agent_information(sdk_information)
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,588 @@
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::Security::Mgmt::V2017_08_01_preview
7
+ #
8
+ # API spec for Microsoft.Security (Azure Security Center) resource provider
9
+ #
10
+ class WorkspaceSettings
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the WorkspaceSettings class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [SecurityManagementClient] reference to the SecurityManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Settings about where we should store your security data and logs
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [Array<WorkspaceSetting>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Settings about where we should store your security data and logs
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Settings about where we should store your security data and logs
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ @client.api_version = '2017-08-01-preview'
59
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
60
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
61
+
62
+
63
+ request_headers = {}
64
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
65
+
66
+ # Set Headers
67
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
68
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
69
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings'
70
+
71
+ request_url = @base_url || @client.base_url
72
+
73
+ options = {
74
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
75
+ path_params: {'subscriptionId' => @client.subscription_id},
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::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSettingList.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
+ #
110
+ # Settings about where we should store your security data and logs
111
+ #
112
+ # @param workspace_setting_name [String] Name of the security setting
113
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
114
+ # will be added to the HTTP request.
115
+ #
116
+ # @return [WorkspaceSetting] operation results.
117
+ #
118
+ def get(workspace_setting_name, custom_headers:nil)
119
+ response = get_async(workspace_setting_name, custom_headers:custom_headers).value!
120
+ response.body unless response.nil?
121
+ end
122
+
123
+ #
124
+ # Settings about where we should store your security data and logs
125
+ #
126
+ # @param workspace_setting_name [String] Name of the security setting
127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
128
+ # will be added to the HTTP request.
129
+ #
130
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
131
+ #
132
+ def get_with_http_info(workspace_setting_name, custom_headers:nil)
133
+ get_async(workspace_setting_name, custom_headers:custom_headers).value!
134
+ end
135
+
136
+ #
137
+ # Settings about where we should store your security data and logs
138
+ #
139
+ # @param workspace_setting_name [String] Name of the security setting
140
+ # @param [Hash{String => String}] A hash of custom headers that will be added
141
+ # to the HTTP request.
142
+ #
143
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
144
+ #
145
+ def get_async(workspace_setting_name, custom_headers:nil)
146
+ @client.api_version = '2017-08-01-preview'
147
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
148
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
149
+ fail ArgumentError, 'workspace_setting_name is nil' if workspace_setting_name.nil?
150
+
151
+
152
+ request_headers = {}
153
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
154
+
155
+ # Set Headers
156
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
157
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
158
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}'
159
+
160
+ request_url = @base_url || @client.base_url
161
+
162
+ options = {
163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
164
+ path_params: {'subscriptionId' => @client.subscription_id,'workspaceSettingName' => workspace_setting_name},
165
+ query_params: {'api-version' => @client.api_version},
166
+ headers: request_headers.merge(custom_headers || {}),
167
+ base_url: request_url
168
+ }
169
+ promise = @client.make_request_async(:get, path_template, options)
170
+
171
+ promise = promise.then do |result|
172
+ http_response = result.response
173
+ status_code = http_response.status
174
+ response_content = http_response.body
175
+ unless status_code == 200
176
+ error_model = JSON.load(response_content)
177
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
178
+ end
179
+
180
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
181
+ # Deserialize Response
182
+ if status_code == 200
183
+ begin
184
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
185
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSetting.mapper()
186
+ result.body = @client.deserialize(result_mapper, parsed_response)
187
+ rescue Exception => e
188
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
189
+ end
190
+ end
191
+
192
+ result
193
+ end
194
+
195
+ promise.execute
196
+ end
197
+
198
+ #
199
+ # creating settings about where we should store your security data and logs
200
+ #
201
+ # @param workspace_setting_name [String] Name of the security setting
202
+ # @param workspace_setting [WorkspaceSetting] Security data setting object
203
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
204
+ # will be added to the HTTP request.
205
+ #
206
+ # @return [WorkspaceSetting] operation results.
207
+ #
208
+ def create(workspace_setting_name, workspace_setting, custom_headers:nil)
209
+ response = create_async(workspace_setting_name, workspace_setting, custom_headers:custom_headers).value!
210
+ response.body unless response.nil?
211
+ end
212
+
213
+ #
214
+ # creating settings about where we should store your security data and logs
215
+ #
216
+ # @param workspace_setting_name [String] Name of the security setting
217
+ # @param workspace_setting [WorkspaceSetting] Security data setting object
218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
219
+ # will be added to the HTTP request.
220
+ #
221
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
222
+ #
223
+ def create_with_http_info(workspace_setting_name, workspace_setting, custom_headers:nil)
224
+ create_async(workspace_setting_name, workspace_setting, custom_headers:custom_headers).value!
225
+ end
226
+
227
+ #
228
+ # creating settings about where we should store your security data and logs
229
+ #
230
+ # @param workspace_setting_name [String] Name of the security setting
231
+ # @param workspace_setting [WorkspaceSetting] Security data setting object
232
+ # @param [Hash{String => String}] A hash of custom headers that will be added
233
+ # to the HTTP request.
234
+ #
235
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
236
+ #
237
+ def create_async(workspace_setting_name, workspace_setting, custom_headers:nil)
238
+ @client.api_version = '2017-08-01-preview'
239
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
240
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
241
+ fail ArgumentError, 'workspace_setting_name is nil' if workspace_setting_name.nil?
242
+ fail ArgumentError, 'workspace_setting is nil' if workspace_setting.nil?
243
+
244
+
245
+ request_headers = {}
246
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
247
+
248
+ # Set Headers
249
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
250
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
251
+
252
+ # Serialize Request
253
+ request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSetting.mapper()
254
+ request_content = @client.serialize(request_mapper, workspace_setting)
255
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
256
+
257
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}'
258
+
259
+ request_url = @base_url || @client.base_url
260
+
261
+ options = {
262
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
263
+ path_params: {'subscriptionId' => @client.subscription_id,'workspaceSettingName' => workspace_setting_name},
264
+ query_params: {'api-version' => @client.api_version},
265
+ body: request_content,
266
+ headers: request_headers.merge(custom_headers || {}),
267
+ base_url: request_url
268
+ }
269
+ promise = @client.make_request_async(:put, path_template, options)
270
+
271
+ promise = promise.then do |result|
272
+ http_response = result.response
273
+ status_code = http_response.status
274
+ response_content = http_response.body
275
+ unless status_code == 200
276
+ error_model = JSON.load(response_content)
277
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
278
+ end
279
+
280
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
281
+ # Deserialize Response
282
+ if status_code == 200
283
+ begin
284
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
285
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSetting.mapper()
286
+ result.body = @client.deserialize(result_mapper, parsed_response)
287
+ rescue Exception => e
288
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
289
+ end
290
+ end
291
+
292
+ result
293
+ end
294
+
295
+ promise.execute
296
+ end
297
+
298
+ #
299
+ # Settings about where we should store your security data and logs
300
+ #
301
+ # @param workspace_setting_name [String] Name of the security setting
302
+ # @param workspace_setting [WorkspaceSetting] Security data setting object
303
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
304
+ # will be added to the HTTP request.
305
+ #
306
+ # @return [WorkspaceSetting] operation results.
307
+ #
308
+ def update(workspace_setting_name, workspace_setting, custom_headers:nil)
309
+ response = update_async(workspace_setting_name, workspace_setting, custom_headers:custom_headers).value!
310
+ response.body unless response.nil?
311
+ end
312
+
313
+ #
314
+ # Settings about where we should store your security data and logs
315
+ #
316
+ # @param workspace_setting_name [String] Name of the security setting
317
+ # @param workspace_setting [WorkspaceSetting] Security data setting object
318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
319
+ # will be added to the HTTP request.
320
+ #
321
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
322
+ #
323
+ def update_with_http_info(workspace_setting_name, workspace_setting, custom_headers:nil)
324
+ update_async(workspace_setting_name, workspace_setting, custom_headers:custom_headers).value!
325
+ end
326
+
327
+ #
328
+ # Settings about where we should store your security data and logs
329
+ #
330
+ # @param workspace_setting_name [String] Name of the security setting
331
+ # @param workspace_setting [WorkspaceSetting] Security data setting object
332
+ # @param [Hash{String => String}] A hash of custom headers that will be added
333
+ # to the HTTP request.
334
+ #
335
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
336
+ #
337
+ def update_async(workspace_setting_name, workspace_setting, custom_headers:nil)
338
+ @client.api_version = '2017-08-01-preview'
339
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
340
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
341
+ fail ArgumentError, 'workspace_setting_name is nil' if workspace_setting_name.nil?
342
+ fail ArgumentError, 'workspace_setting is nil' if workspace_setting.nil?
343
+
344
+
345
+ request_headers = {}
346
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
347
+
348
+ # Set Headers
349
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
350
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
351
+
352
+ # Serialize Request
353
+ request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSetting.mapper()
354
+ request_content = @client.serialize(request_mapper, workspace_setting)
355
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
356
+
357
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}'
358
+
359
+ request_url = @base_url || @client.base_url
360
+
361
+ options = {
362
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
363
+ path_params: {'subscriptionId' => @client.subscription_id,'workspaceSettingName' => workspace_setting_name},
364
+ query_params: {'api-version' => @client.api_version},
365
+ body: request_content,
366
+ headers: request_headers.merge(custom_headers || {}),
367
+ base_url: request_url
368
+ }
369
+ promise = @client.make_request_async(:patch, path_template, options)
370
+
371
+ promise = promise.then do |result|
372
+ http_response = result.response
373
+ status_code = http_response.status
374
+ response_content = http_response.body
375
+ unless status_code == 200
376
+ error_model = JSON.load(response_content)
377
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
378
+ end
379
+
380
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
381
+ # Deserialize Response
382
+ if status_code == 200
383
+ begin
384
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
385
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSetting.mapper()
386
+ result.body = @client.deserialize(result_mapper, parsed_response)
387
+ rescue Exception => e
388
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
389
+ end
390
+ end
391
+
392
+ result
393
+ end
394
+
395
+ promise.execute
396
+ end
397
+
398
+ #
399
+ # Deletes the custom workspace settings for this subscription. new VMs will
400
+ # report to the default workspace
401
+ #
402
+ # @param workspace_setting_name [String] Name of the security setting
403
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
404
+ # will be added to the HTTP request.
405
+ #
406
+ #
407
+ def delete(workspace_setting_name, custom_headers:nil)
408
+ response = delete_async(workspace_setting_name, custom_headers:custom_headers).value!
409
+ nil
410
+ end
411
+
412
+ #
413
+ # Deletes the custom workspace settings for this subscription. new VMs will
414
+ # report to the default workspace
415
+ #
416
+ # @param workspace_setting_name [String] Name of the security setting
417
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
418
+ # will be added to the HTTP request.
419
+ #
420
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
421
+ #
422
+ def delete_with_http_info(workspace_setting_name, custom_headers:nil)
423
+ delete_async(workspace_setting_name, custom_headers:custom_headers).value!
424
+ end
425
+
426
+ #
427
+ # Deletes the custom workspace settings for this subscription. new VMs will
428
+ # report to the default workspace
429
+ #
430
+ # @param workspace_setting_name [String] Name of the security setting
431
+ # @param [Hash{String => String}] A hash of custom headers that will be added
432
+ # to the HTTP request.
433
+ #
434
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
435
+ #
436
+ def delete_async(workspace_setting_name, custom_headers:nil)
437
+ @client.api_version = '2017-08-01-preview'
438
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
439
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
440
+ fail ArgumentError, 'workspace_setting_name is nil' if workspace_setting_name.nil?
441
+
442
+
443
+ request_headers = {}
444
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
445
+
446
+ # Set Headers
447
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
448
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
449
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}'
450
+
451
+ request_url = @base_url || @client.base_url
452
+
453
+ options = {
454
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
455
+ path_params: {'subscriptionId' => @client.subscription_id,'workspaceSettingName' => workspace_setting_name},
456
+ query_params: {'api-version' => @client.api_version},
457
+ headers: request_headers.merge(custom_headers || {}),
458
+ base_url: request_url
459
+ }
460
+ promise = @client.make_request_async(:delete, path_template, options)
461
+
462
+ promise = promise.then do |result|
463
+ http_response = result.response
464
+ status_code = http_response.status
465
+ response_content = http_response.body
466
+ unless status_code == 204
467
+ error_model = JSON.load(response_content)
468
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
469
+ end
470
+
471
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
472
+
473
+ result
474
+ end
475
+
476
+ promise.execute
477
+ end
478
+
479
+ #
480
+ # Settings about where we should store your security data and logs
481
+ #
482
+ # @param next_page_link [String] The NextLink from the previous successful call
483
+ # to List operation.
484
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
485
+ # will be added to the HTTP request.
486
+ #
487
+ # @return [WorkspaceSettingList] operation results.
488
+ #
489
+ def list_next(next_page_link, custom_headers:nil)
490
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
491
+ response.body unless response.nil?
492
+ end
493
+
494
+ #
495
+ # Settings about where we should store your security data and logs
496
+ #
497
+ # @param next_page_link [String] The NextLink from the previous successful call
498
+ # to List operation.
499
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
500
+ # will be added to the HTTP request.
501
+ #
502
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
503
+ #
504
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
505
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
506
+ end
507
+
508
+ #
509
+ # Settings about where we should store your security data and logs
510
+ #
511
+ # @param next_page_link [String] The NextLink from the previous successful call
512
+ # to List operation.
513
+ # @param [Hash{String => String}] A hash of custom headers that will be added
514
+ # to the HTTP request.
515
+ #
516
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
517
+ #
518
+ def list_next_async(next_page_link, custom_headers:nil)
519
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
520
+
521
+
522
+ request_headers = {}
523
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
524
+
525
+ # Set Headers
526
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
527
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
528
+ path_template = '{nextLink}'
529
+
530
+ request_url = @base_url || @client.base_url
531
+
532
+ options = {
533
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
534
+ skip_encoding_path_params: {'nextLink' => next_page_link},
535
+ headers: request_headers.merge(custom_headers || {}),
536
+ base_url: request_url
537
+ }
538
+ promise = @client.make_request_async(:get, path_template, options)
539
+
540
+ promise = promise.then do |result|
541
+ http_response = result.response
542
+ status_code = http_response.status
543
+ response_content = http_response.body
544
+ unless status_code == 200
545
+ error_model = JSON.load(response_content)
546
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
547
+ end
548
+
549
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
550
+ # Deserialize Response
551
+ if status_code == 200
552
+ begin
553
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
554
+ result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::WorkspaceSettingList.mapper()
555
+ result.body = @client.deserialize(result_mapper, parsed_response)
556
+ rescue Exception => e
557
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
558
+ end
559
+ end
560
+
561
+ result
562
+ end
563
+
564
+ promise.execute
565
+ end
566
+
567
+ #
568
+ # Settings about where we should store your security data and logs
569
+ #
570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
571
+ # will be added to the HTTP request.
572
+ #
573
+ # @return [WorkspaceSettingList] which provide lazy access to pages of the
574
+ # response.
575
+ #
576
+ def list_as_lazy(custom_headers:nil)
577
+ response = list_async(custom_headers:custom_headers).value!
578
+ unless response.nil?
579
+ page = response.body
580
+ page.next_method = Proc.new do |next_page_link|
581
+ list_next_async(next_page_link, custom_headers:custom_headers)
582
+ end
583
+ page
584
+ end
585
+ end
586
+
587
+ end
588
+ end