class Azure::Policy::Mgmt::V2019_01_01::PolicySetDefinitions
To manage and control access to your resources, you can define customized policies and assign them at a scope.
Attributes
@return [PolicyClient] reference to the PolicyClient
Public Class Methods
Creates and initializes a new instance of the PolicySetDefinitions
class. @param client service class for accessing basic functionality.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 18 def initialize(client) @client = client end
Public Instance Methods
Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to create. @param parameters [PolicySetDefinition] The policy set definition properties. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinition] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 39 def create_or_update(policy_set_definition_name, parameters, custom_headers:nil) response = create_or_update_async(policy_set_definition_name, parameters, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to create. @param parameters [PolicySetDefinition] The policy set definition properties. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 76 def create_or_update_async(policy_set_definition_name, parameters, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_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? # Serialize Request request_mapper = Azure::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name,'subscriptionId' => @client.subscription_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 == 201 || status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.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 == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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 == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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
Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to create. @param parameters [PolicySetDefinition] The policy set definition properties. @param management_group_id [String] The ID of the management group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinition] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 642 def create_or_update_at_management_group(policy_set_definition_name, parameters, management_group_id, custom_headers:nil) response = create_or_update_at_management_group_async(policy_set_definition_name, parameters, management_group_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to create. @param parameters [PolicySetDefinition] The policy set definition properties. @param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 681 def create_or_update_at_management_group_async(policy_set_definition_name, parameters, management_group_id, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'management_group_id is nil' if management_group_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? # Serialize Request request_mapper = Azure::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.mapper() request_content = @client.serialize(request_mapper, parameters) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name,'managementGroupId' => management_group_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 == 201 || status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.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 == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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 == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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
Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to create. @param parameters [PolicySetDefinition] The policy set definition properties. @param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 662 def create_or_update_at_management_group_with_http_info(policy_set_definition_name, parameters, management_group_id, custom_headers:nil) create_or_update_at_management_group_async(policy_set_definition_name, parameters, management_group_id, custom_headers:custom_headers).value! end
Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to create. @param parameters [PolicySetDefinition] The policy set definition properties. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 58 def create_or_update_with_http_info(policy_set_definition_name, parameters, custom_headers:nil) create_or_update_async(policy_set_definition_name, parameters, custom_headers:custom_headers).value! end
Deletes a policy set definition.
This operation deletes the policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to delete. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 160 def delete(policy_set_definition_name, custom_headers:nil) response = delete_async(policy_set_definition_name, custom_headers:custom_headers).value! nil end
Deletes a policy set definition.
This operation deletes the policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to delete. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 195 def delete_async(policy_set_definition_name, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_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 = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name,'subscriptionId' => @client.subscription_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 == 204 || status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.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
Deletes a policy set definition.
This operation deletes the policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to delete. @param management_group_id [String] The ID of the management group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 766 def delete_at_management_group(policy_set_definition_name, management_group_id, custom_headers:nil) response = delete_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:custom_headers).value! nil end
Deletes a policy set definition.
This operation deletes the policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to delete. @param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 803 def delete_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'management_group_id is nil' if management_group_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 = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name,'managementGroupId' => management_group_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 == 204 || status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.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
Deletes a policy set definition.
This operation deletes the policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to delete. @param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 785 def delete_at_management_group_with_http_info(policy_set_definition_name, management_group_id, custom_headers:nil) delete_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:custom_headers).value! end
Deletes a policy set definition.
This operation deletes the policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to delete. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 178 def delete_with_http_info(policy_set_definition_name, custom_headers:nil) delete_async(policy_set_definition_name, custom_headers:custom_headers).value! end
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinition] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 252 def get(policy_set_definition_name, custom_headers:nil) response = get_async(policy_set_definition_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 287 def get_async(policy_set_definition_name, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_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 = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name,'subscriptionId' => @client.subscription_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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @param management_group_id [String] The ID of the management group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinition] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 861 def get_at_management_group(policy_set_definition_name, management_group_id, custom_headers:nil) response = get_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 898 def get_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'management_group_id is nil' if management_group_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 = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name,'managementGroupId' => management_group_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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given management group with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 880 def get_at_management_group_with_http_info(policy_set_definition_name, management_group_id, custom_headers:nil) get_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers:custom_headers).value! end
Retrieves a built in policy set definition.
This operation retrieves the built-in policy set definition with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinition] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 354 def get_built_in(policy_set_definition_name, custom_headers:nil) response = get_built_in_async(policy_set_definition_name, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieves a built in policy set definition.
This operation retrieves the built-in policy set definition with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 389 def get_built_in_async(policy_set_definition_name, custom_headers:nil) fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'policySetDefinitionName' => policy_set_definition_name}, 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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinition.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
Retrieves a built in policy set definition.
This operation retrieves the built-in policy set definition with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 372 def get_built_in_with_http_info(policy_set_definition_name, custom_headers:nil) get_built_in_async(policy_set_definition_name, custom_headers:custom_headers).value! end
Retrieves a policy set definition.
This operation retrieves the policy set definition in the given subscription with the given name.
@param policy_set_definition_name [String] The name of the policy set definition to get. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 270 def get_with_http_info(policy_set_definition_name, custom_headers:nil) get_async(policy_set_definition_name, custom_headers:custom_headers).value! end
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<PolicySetDefinition>] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 453 def list(custom_headers:nil) first_page = list_as_lazy(custom_headers:custom_headers) first_page.get_all_items end
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinitionListResult] which provide lazy access to pages of the response.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1356 def list_as_lazy(custom_headers:nil) response = list_async(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
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 484 def list_async(custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_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 = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinitionListResult.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
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<PolicySetDefinition>] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 547 def list_built_in(custom_headers:nil) first_page = list_built_in_as_lazy(custom_headers:custom_headers) first_page.get_all_items end
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinitionListResult] which provide lazy access to pages of the response.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1378 def list_built_in_as_lazy(custom_headers:nil) response = list_built_in_async(custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_built_in_next_async(next_page_link, custom_headers:custom_headers) end page end end
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 576 def list_built_in_async(custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'providers/Microsoft.Authorization/policySetDefinitions' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], 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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinitionListResult.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
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@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 [PolicySetDefinitionListResult] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1161 def list_built_in_next(next_page_link, custom_headers:nil) response = list_built_in_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1194 def list_built_in_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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinitionListResult.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
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1178 def list_built_in_next_with_http_info(next_page_link, custom_headers:nil) list_built_in_next_async(next_page_link, custom_headers:custom_headers).value! end
Retrieves built-in policy set definitions.
This operation retrieves a list of all the built-in policy set definitions.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 562 def list_built_in_with_http_info(custom_headers:nil) list_built_in_async(custom_headers:custom_headers).value! end
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@param management_group_id [String] The ID of the management group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<PolicySetDefinition>] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 964 def list_by_management_group(management_group_id, custom_headers:nil) first_page = list_by_management_group_as_lazy(management_group_id, custom_headers:custom_headers) first_page.get_all_items end
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@param management_group_id [String] The ID of the management group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [PolicySetDefinitionListResult] which provide lazy access to pages of the response.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1402 def list_by_management_group_as_lazy(management_group_id, custom_headers:nil) response = list_by_management_group_async(management_group_id, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| list_by_management_group_next_async(next_page_link, custom_headers:custom_headers) end page end end
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 997 def list_by_management_group_async(management_group_id, custom_headers:nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'management_group_id is nil' if management_group_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 = 'providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'managementGroupId' => management_group_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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinitionListResult.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
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@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 [PolicySetDefinitionListResult] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1258 def list_by_management_group_next(next_page_link, custom_headers:nil) response = list_by_management_group_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1293 def list_by_management_group_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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinitionListResult.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
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1276 def list_by_management_group_next_with_http_info(next_page_link, custom_headers:nil) list_by_management_group_next_async(next_page_link, custom_headers:custom_headers).value! end
Retrieves all policy set definitions in management group.
This operation retrieves a list of all the a policy set definition in the given management group.
@param management_group_id [String] The ID of the management group. @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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 981 def list_by_management_group_with_http_info(management_group_id, custom_headers:nil) list_by_management_group_async(management_group_id, custom_headers:custom_headers).value! end
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@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 [PolicySetDefinitionListResult] operation results.
# File lib/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1063 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
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1098 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 MsRest::HttpOperationError.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::Policy::Mgmt::V2019_01_01::Models::PolicySetDefinitionListResult.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
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 1081 def list_next_with_http_info(next_page_link, custom_headers:nil) list_next_async(next_page_link, custom_headers:custom_headers).value! end
Retrieves the policy set definitions for a subscription.
This operation retrieves a list of all the policy set definitions in the given subscription.
@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/2019-01-01/generated/azure_mgmt_policy/policy_set_definitions.rb, line 469 def list_with_http_info(custom_headers:nil) list_async(custom_headers:custom_headers).value! end