class Azure::Security::Mgmt::V2017_08_01_preview::DeviceSecurityGroups
API spec for Microsoft.Security (Azure
Security
Center) resource provider
Attributes
@return [SecurityCenter] reference to the SecurityCenter
Private Class Methods
Creates and initializes a new instance of the DeviceSecurityGroups
class. @param client service class for accessing basic functionality.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 17 def initialize(client) @client = client end
Private Instance Methods
Use this method to creates or updates the device security group on a specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param device_security_group [DeviceSecurityGroup] Security
group object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DeviceSecurityGroup] operation results.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 229 def create_or_update(resource_id, device_security_group_name, device_security_group, custom_headers:nil) response = create_or_update_async(resource_id, device_security_group_name, device_security_group, custom_headers:custom_headers).value! response.body unless response.nil? end
Use this method to creates or updates the device security group on a specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param device_security_group [DeviceSecurityGroup] Security
group object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 264 def create_or_update_async(resource_id, device_security_group_name, device_security_group, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_id is nil' if resource_id.nil? fail ArgumentError, 'device_security_group_name is nil' if device_security_group_name.nil? fail ArgumentError, 'device_security_group is nil' if device_security_group.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::DeviceSecurityGroup.mapper() request_content = @client.serialize(request_mapper, device_security_group) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'deviceSecurityGroupName' => device_security_group_name}, skip_encoding_path_params: {'resourceId' => resource_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 201 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::DeviceSecurityGroup.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::DeviceSecurityGroup.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Use this method to creates or updates the device security group on a specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param device_security_group [DeviceSecurityGroup] Security
group object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 247 def create_or_update_with_http_info(resource_id, device_security_group_name, device_security_group, custom_headers:nil) create_or_update_async(resource_id, device_security_group_name, device_security_group, custom_headers:custom_headers).value! end
User this method to deletes the device security group.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 347 def delete(resource_id, device_security_group_name, custom_headers:nil) response = delete_async(resource_id, device_security_group_name, custom_headers:custom_headers).value! nil end
User this method to deletes the device security group.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 378 def delete_async(resource_id, device_security_group_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_id is nil' if resource_id.nil? fail ArgumentError, 'device_security_group_name is nil' if device_security_group_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'deviceSecurityGroupName' => device_security_group_name}, skip_encoding_path_params: {'resourceId' => resource_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
User this method to deletes the device security group.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 363 def delete_with_http_info(resource_id, device_security_group_name, custom_headers:nil) delete_async(resource_id, device_security_group_name, custom_headers:custom_headers).value! end
Use this method to get the device security group for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DeviceSecurityGroup] operation results.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 128 def get(resource_id, device_security_group_name, custom_headers:nil) response = get_async(resource_id, device_security_group_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Use this method to get the device security group for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 161 def get_async(resource_id, device_security_group_name, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_id is nil' if resource_id.nil? fail ArgumentError, 'device_security_group_name is nil' if device_security_group_name.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'deviceSecurityGroupName' => device_security_group_name}, skip_encoding_path_params: {'resourceId' => resource_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::DeviceSecurityGroup.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Use this method to get the device security group for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param device_security_group_name [String] The name of the device security group. Note that the name of the device security group is case insensitive. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 145 def get_with_http_info(resource_id, device_security_group_name, custom_headers:nil) get_async(resource_id, device_security_group_name, custom_headers:custom_headers).value! end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<DeviceSecurityGroup>] operation results.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 34 def list(resource_id, custom_headers:nil) first_page = list_as_lazy(resource_id, custom_headers:custom_headers) first_page.get_all_items end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DeviceSecurityGroupList] which provide lazy access to pages of the response.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 527 def list_as_lazy(resource_id, custom_headers:nil) response = list_async(resource_id, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_next_async(next_page_link, custom_headers:custom_headers) end page end end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 63 def list_async(resource_id, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'resource_id is nil' if resource_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'resourceId' => resource_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::DeviceSecurityGroupList.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [DeviceSecurityGroupList] operation results.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 434 def list_next(next_page_link, custom_headers:nil) response = list_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 465 def list_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Security::Mgmt::V2017_08_01_preview::Models::DeviceSecurityGroupList.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 450 def list_next_with_http_info(next_page_link, custom_headers:nil) list_next_async(next_page_link, custom_headers:custom_headers).value! end
Use this method get the list of device security groups for the specified IoT Hub resource.
@param resource_id [String] The identifier of the resource. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2017-08-01-preview/generated/azure_mgmt_security/device_security_groups.rb, line 49 def list_with_http_info(resource_id, custom_headers:nil) list_async(resource_id, custom_headers:custom_headers).value! end