Class: Azure::Policy::Mgmt::V2018_03_01::PolicySetDefinitions

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-03-01/generated/azure_mgmt_policy/policy_set_definitions.rb

Overview

To manage and control access to your resources, you can define customized policies and assign them at a scope.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PolicySetDefinitions

Creates and initializes a new instance of the PolicySetDefinitions class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/2018-03-01/generated/azure_mgmt_policy/policy_set_definitions.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientPolicyClient (readonly)

Returns reference to the PolicyClient.

Returns:



23
24
25
# File 'lib/2018-03-01/generated/azure_mgmt_policy/policy_set_definitions.rb', line 23

def client
  @client
end

Instance Method Details

#create_or_update(policy_set_definition_name, parameters, custom_headers: nil) ⇒ PolicySetDefinition

Creates or updates a policy set definition.

This operation creates or updates a policy set definition in the given subscription with the given name.

definition to create. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • parameters (PolicySetDefinition)

    The policy set definition properties.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinition)

    operation results.



39
40
41
42
# File 'lib/2018-03-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

#create_or_update_async(policy_set_definition_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a policy set definition.

This operation creates or updates a policy set definition in the given subscription with the given name.

definition to create. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • parameters (PolicySetDefinition)

    The policy set definition properties.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/2018-03-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::V2018_03_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::V2018_03_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::V2018_03_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

#create_or_update_at_management_group(policy_set_definition_name, parameters, management_group_id, custom_headers: nil) ⇒ PolicySetDefinition

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.

definition to create. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • parameters (PolicySetDefinition)

    The policy set definition properties.

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinition)

    operation results.



642
643
644
645
# File 'lib/2018-03-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

#create_or_update_at_management_group_async(policy_set_definition_name, parameters, management_group_id, custom_headers: nil) ⇒ Concurrent::Promise

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.

definition to create. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • parameters (PolicySetDefinition)

    The policy set definition properties.

  • management_group_id (String)

    The ID of the management group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
# File 'lib/2018-03-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::V2018_03_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::V2018_03_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::V2018_03_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

#create_or_update_at_management_group_with_http_info(policy_set_definition_name, parameters, management_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

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.

definition to create. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • parameters (PolicySetDefinition)

    The policy set definition properties.

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



662
663
664
# File 'lib/2018-03-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

#create_or_update_with_http_info(policy_set_definition_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a policy set definition.

This operation creates or updates a policy set definition in the given subscription with the given name.

definition to create. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • parameters (PolicySetDefinition)

    The policy set definition properties.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



58
59
60
# File 'lib/2018-03-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

#delete(policy_set_definition_name, custom_headers: nil) ⇒ Object

Deletes a policy set definition.

This operation deletes the policy set definition in the given subscription with the given name.

definition to delete. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



160
161
162
163
# File 'lib/2018-03-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

#delete_async(policy_set_definition_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a policy set definition.

This operation deletes the policy set definition in the given subscription with the given name.

definition to delete. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/2018-03-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

#delete_at_management_group(policy_set_definition_name, management_group_id, custom_headers: nil) ⇒ Object

Deletes a policy set definition.

This operation deletes the policy set definition in the given management group with the given name.

definition to delete. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



766
767
768
769
# File 'lib/2018-03-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

#delete_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a policy set definition.

This operation deletes the policy set definition in the given management group with the given name.

definition to delete. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • management_group_id (String)

    The ID of the management group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
# File 'lib/2018-03-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

#delete_at_management_group_with_http_info(policy_set_definition_name, management_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a policy set definition.

This operation deletes the policy set definition in the given management group with the given name.

definition to delete. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



785
786
787
# File 'lib/2018-03-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

#delete_with_http_info(policy_set_definition_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a policy set definition.

This operation deletes the policy set definition in the given subscription with the given name.

definition to delete. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



178
179
180
# File 'lib/2018-03-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

#get(policy_set_definition_name, custom_headers: nil) ⇒ PolicySetDefinition

Retrieves a policy set definition.

This operation retrieves the policy set definition in the given subscription with the given name.

definition to get. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinition)

    operation results.



252
253
254
255
# File 'lib/2018-03-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

#get_async(policy_set_definition_name, custom_headers: nil) ⇒ Concurrent::Promise

Retrieves a policy set definition.

This operation retrieves the policy set definition in the given subscription with the given name.

definition to get. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/2018-03-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::V2018_03_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

#get_at_management_group(policy_set_definition_name, management_group_id, custom_headers: nil) ⇒ PolicySetDefinition

Retrieves a policy set definition.

This operation retrieves the policy set definition in the given management group with the given name.

definition to get. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinition)

    operation results.



861
862
863
864
# File 'lib/2018-03-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

#get_at_management_group_async(policy_set_definition_name, management_group_id, custom_headers: nil) ⇒ Concurrent::Promise

Retrieves a policy set definition.

This operation retrieves the policy set definition in the given management group with the given name.

definition to get. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • management_group_id (String)

    The ID of the management group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
# File 'lib/2018-03-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::V2018_03_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

#get_at_management_group_with_http_info(policy_set_definition_name, management_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves a policy set definition.

This operation retrieves the policy set definition in the given management group with the given name.

definition to get. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



880
881
882
# File 'lib/2018-03-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

#get_built_in(policy_set_definition_name, custom_headers: nil) ⇒ PolicySetDefinition

Retrieves a built in policy set definition.

This operation retrieves the built-in policy set definition with the given name.

definition to get. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinition)

    operation results.



354
355
356
357
# File 'lib/2018-03-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

#get_built_in_async(policy_set_definition_name, custom_headers: nil) ⇒ Concurrent::Promise

Retrieves a built in policy set definition.

This operation retrieves the built-in policy set definition with the given name.

definition to get. to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/2018-03-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::V2018_03_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

#get_built_in_with_http_info(policy_set_definition_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves a built in policy set definition.

This operation retrieves the built-in policy set definition with the given name.

definition to get. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



372
373
374
# File 'lib/2018-03-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

#get_with_http_info(policy_set_definition_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves a policy set definition.

This operation retrieves the policy set definition in the given subscription with the given name.

definition to get. will be added to the HTTP request.

Parameters:

  • policy_set_definition_name (String)

    The name of the policy set

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



270
271
272
# File 'lib/2018-03-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

#list(custom_headers: nil) ⇒ Array<PolicySetDefinition>

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<PolicySetDefinition>)

    operation results.



453
454
455
456
# File 'lib/2018-03-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

#list_as_lazy(custom_headers: nil) ⇒ PolicySetDefinitionListResult

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

will be added to the HTTP request.

the response.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinitionListResult)

    which provide lazy access to pages of



1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
# File 'lib/2018-03-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

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/2018-03-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::V2018_03_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

#list_built_in(custom_headers: nil) ⇒ Array<PolicySetDefinition>

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<PolicySetDefinition>)

    operation results.



547
548
549
550
# File 'lib/2018-03-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

#list_built_in_as_lazy(custom_headers: nil) ⇒ PolicySetDefinitionListResult

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

will be added to the HTTP request.

the response.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinitionListResult)

    which provide lazy access to pages of



1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
# File 'lib/2018-03-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

#list_built_in_async(custom_headers: nil) ⇒ Concurrent::Promise

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/2018-03-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::V2018_03_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

#list_built_in_next(next_page_link, custom_headers: nil) ⇒ PolicySetDefinitionListResult

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinitionListResult)

    operation results.



1161
1162
1163
1164
# File 'lib/2018-03-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

#list_built_in_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
# File 'lib/2018-03-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::V2018_03_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

#list_built_in_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1178
1179
1180
# File 'lib/2018-03-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

#list_built_in_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves built-in policy set definitions.

This operation retrieves a list of all the built-in policy set definitions.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



562
563
564
# File 'lib/2018-03-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

#list_by_management_group(management_group_id, custom_headers: nil) ⇒ Array<PolicySetDefinition>

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.

will be added to the HTTP request.

Parameters:

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<PolicySetDefinition>)

    operation results.



964
965
966
967
# File 'lib/2018-03-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

#list_by_management_group_as_lazy(management_group_id, custom_headers: nil) ⇒ PolicySetDefinitionListResult

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.

will be added to the HTTP request.

the response.

Parameters:

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinitionListResult)

    which provide lazy access to pages of



1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
# File 'lib/2018-03-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

#list_by_management_group_async(management_group_id, custom_headers: nil) ⇒ Concurrent::Promise

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.

to the HTTP request.

Parameters:

  • management_group_id (String)

    The ID of the management group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/2018-03-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::V2018_03_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

#list_by_management_group_next(next_page_link, custom_headers: nil) ⇒ PolicySetDefinitionListResult

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.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinitionListResult)

    operation results.



1258
1259
1260
1261
# File 'lib/2018-03-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

#list_by_management_group_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

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.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/2018-03-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::V2018_03_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

#list_by_management_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

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.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1276
1277
1278
# File 'lib/2018-03-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

#list_by_management_group_with_http_info(management_group_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

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.

will be added to the HTTP request.

Parameters:

  • management_group_id (String)

    The ID of the management group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



981
982
983
# File 'lib/2018-03-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

#list_next(next_page_link, custom_headers: nil) ⇒ PolicySetDefinitionListResult

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PolicySetDefinitionListResult)

    operation results.



1063
1064
1065
1066
# File 'lib/2018-03-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

#list_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/2018-03-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::V2018_03_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

#list_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1081
1082
1083
# File 'lib/2018-03-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

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves the policy set definitions for a subscription.

This operation retrieves a list of all the policy set definitions in the given subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



469
470
471
# File 'lib/2018-03-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