Class: Azure::ARM::Policy::PolicyDefinitions

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/generated/azure_mgmt_policy/policy_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) ⇒ PolicyDefinitions

Creates and initializes a new instance of the PolicyDefinitions class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_policy/policy_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/generated/azure_mgmt_policy/policy_definitions.rb', line 23

def client
  @client
end

Instance Method Details

#create_or_update(policy_definition_name, parameters, custom_headers = nil) ⇒ PolicyDefinition

Creates or updates a policy definition.

create. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • parameters (PolicyDefinition)

    The policy definition properties.

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

    A hash of custom headers that

Returns:

  • (PolicyDefinition)

    operation results.



36
37
38
39
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 36

def create_or_update(policy_definition_name, parameters, custom_headers = nil)
  response = create_or_update_async(policy_definition_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a policy definition.

create. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • parameters (PolicyDefinition)

    The policy definition properties.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



67
68
69
70
71
72
73
74
75
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
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 67

def create_or_update_async(policy_definition_name, parameters, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  api_version = '2016-12-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => 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
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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_definition_name, parameters, management_group_id, custom_headers = nil) ⇒ PolicyDefinition

Creates or updates a policy definition at management group level.

create. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • parameters (PolicyDefinition)

    The policy 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:

  • (PolicyDefinition)

    operation results.



398
399
400
401
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 398

def create_or_update_at_management_group(policy_definition_name, parameters, management_group_id, custom_headers = nil)
  response = create_or_update_at_management_group_async(policy_definition_name, parameters, management_group_id, custom_headers).value!
  response.body unless response.nil?
end

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

Creates or updates a policy definition at management group level.

create. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • parameters (PolicyDefinition)

    The policy 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.



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 431

def create_or_update_at_management_group_async(policy_definition_name, parameters, management_group_id, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  api_version = '2016-12-01'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name,'managementGroupId' => management_group_id},
      query_params: {'api-version' => 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
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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_definition_name, parameters, management_group_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a policy definition at management group level.

create. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • parameters (PolicyDefinition)

    The policy 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.



415
416
417
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 415

def create_or_update_at_management_group_with_http_info(policy_definition_name, parameters, management_group_id, custom_headers = nil)
  create_or_update_at_management_group_async(policy_definition_name, parameters, management_group_id, custom_headers).value!
end

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

Creates or updates a policy definition.

create. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • parameters (PolicyDefinition)

    The policy definition properties.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



52
53
54
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 52

def create_or_update_with_http_info(policy_definition_name, parameters, custom_headers = nil)
  create_or_update_async(policy_definition_name, parameters, custom_headers).value!
end

#delete(policy_definition_name, custom_headers = nil) ⇒ Object

Deletes a policy definition.

delete. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

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

    A hash of custom headers that



137
138
139
140
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 137

def delete(policy_definition_name, custom_headers = nil)
  response = delete_async(policy_definition_name, custom_headers).value!
  nil
end

#delete_async(policy_definition_name, custom_headers = nil) ⇒ Concurrent::Promise

Deletes a policy definition.

delete. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 166

def delete_async(policy_definition_name, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  api_version = '2016-12-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # 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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => 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 MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_at_management_group(policy_definition_name, management_group_id, custom_headers = nil) ⇒ Object

Deletes a policy definition at management group level.

delete. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • management_group_id (String)

    The ID of the management group.

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

    A hash of custom headers that



502
503
504
505
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 502

def delete_at_management_group(policy_definition_name, management_group_id, custom_headers = nil)
  response = delete_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
  nil
end

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

Deletes a policy definition at management group level.

delete. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • 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.



533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 533

def delete_at_management_group_async(policy_definition_name, management_group_id, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  api_version = '2016-12-01'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?


  request_headers = {}

  # 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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name,'managementGroupId' => management_group_id},
      query_params: {'api-version' => 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 MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

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

Deletes a policy definition at management group level.

delete. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • 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.



518
519
520
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 518

def delete_at_management_group_with_http_info(policy_definition_name, management_group_id, custom_headers = nil)
  delete_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
end

#delete_with_http_info(policy_definition_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a policy definition.

delete. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



152
153
154
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 152

def delete_with_http_info(policy_definition_name, custom_headers = nil)
  delete_async(policy_definition_name, custom_headers).value!
end

#get(policy_definition_name, custom_headers = nil) ⇒ PolicyDefinition

Gets the policy definition.

get. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

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

    A hash of custom headers that

Returns:

  • (PolicyDefinition)

    operation results.



217
218
219
220
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 217

def get(policy_definition_name, custom_headers = nil)
  response = get_async(policy_definition_name, custom_headers).value!
  response.body unless response.nil?
end

#get_async(policy_definition_name, custom_headers = nil) ⇒ Concurrent::Promise

Gets the policy definition.

get. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 246

def get_async(policy_definition_name, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  api_version = '2016-12-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # 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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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_definition_name, management_group_id, custom_headers = nil) ⇒ PolicyDefinition

Gets the policy definition at management group level.

get. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • 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:

  • (PolicyDefinition)

    operation results.



585
586
587
588
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 585

def get_at_management_group(policy_definition_name, management_group_id, custom_headers = nil)
  response = get_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
  response.body unless response.nil?
end

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

Gets the policy definition at management group level.

get. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • 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.



616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 616

def get_at_management_group_async(policy_definition_name, management_group_id, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  api_version = '2016-12-01'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?


  request_headers = {}

  # 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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name,'managementGroupId' => management_group_id},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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_definition_name, management_group_id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the policy definition at management group level.

get. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

  • 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.



601
602
603
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 601

def get_at_management_group_with_http_info(policy_definition_name, management_group_id, custom_headers = nil)
  get_at_management_group_async(policy_definition_name, management_group_id, custom_headers).value!
end

#get_built_in(policy_definition_name, custom_headers = nil) ⇒ PolicyDefinition

Gets the built in policy definition.

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

Parameters:

  • policy_definition_name (String)

    The name of the built in policy

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

    A hash of custom headers that

Returns:

  • (PolicyDefinition)

    operation results.



307
308
309
310
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 307

def get_built_in(policy_definition_name, custom_headers = nil)
  response = get_built_in_async(policy_definition_name, custom_headers).value!
  response.body unless response.nil?
end

#get_built_in_async(policy_definition_name, custom_headers = nil) ⇒ Concurrent::Promise

Gets the built in policy definition.

definition to get. to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the built in policy

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 336

def get_built_in_async(policy_definition_name, custom_headers = nil)
  fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
  api_version = '2016-12-01'


  request_headers = {}

  # 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/policyDefinitions/{policyDefinitionName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'policyDefinitionName' => policy_definition_name},
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinition.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_definition_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the built in policy definition.

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

Parameters:

  • policy_definition_name (String)

    The name of the built in policy

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



322
323
324
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 322

def get_built_in_with_http_info(policy_definition_name, custom_headers = nil)
  get_built_in_async(policy_definition_name, custom_headers).value!
end

#get_with_http_info(policy_definition_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the policy definition.

get. will be added to the HTTP request.

Parameters:

  • policy_definition_name (String)

    The name of the policy definition to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



232
233
234
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 232

def get_with_http_info(policy_definition_name, custom_headers = nil)
  get_async(policy_definition_name, custom_headers).value!
end

#list(custom_headers = nil) ⇒ Array<PolicyDefinition>

Gets all the policy definitions for a 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<PolicyDefinition>)

    operation results.



675
676
677
678
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 675

def list(custom_headers = nil)
  first_page = list_as_lazy(custom_headers)
  first_page.get_all_items
end

#list_as_lazy(custom_headers = nil) ⇒ PolicyDefinitionListResult

Gets all the policy definitions for a 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:

  • (PolicyDefinitionListResult)

    which provide lazy access to pages of



1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1187

def list_as_lazy(custom_headers = nil)
  response = list_async(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)
    end
    page
  end
end

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

Gets all the policy definitions for a 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.



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
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 700

def list_async(custom_headers = nil)
  api_version = '2016-12-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # 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/policyDefinitions'

  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' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.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<PolicyDefinition>

Gets all the built in policy 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<PolicyDefinition>)

    operation results.



758
759
760
761
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 758

def list_built_in(custom_headers = nil)
  first_page = list_built_in_as_lazy(custom_headers)
  first_page.get_all_items
end

#list_built_in_as_lazy(custom_headers = nil) ⇒ PolicyDefinitionListResult

Gets all the built in policy 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:

  • (PolicyDefinitionListResult)

    which provide lazy access to pages of



1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1207

def list_built_in_as_lazy(custom_headers = nil)
  response = list_built_in_async(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)
    end
    page
  end
end

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

Gets all the built in policy 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.



783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
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
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 783

def list_built_in_async(custom_headers = nil)
  api_version = '2016-12-01'


  request_headers = {}

  # 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/policyDefinitions'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      query_params: {'api-version' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.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) ⇒ PolicyDefinitionListResult

Gets all the built in policy 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:

  • (PolicyDefinitionListResult)

    operation results.



1014
1015
1016
1017
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1014

def list_built_in_next(next_page_link, custom_headers = nil)
  response = list_built_in_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

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

Gets all the built in policy 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.



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1043

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 = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.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

Gets all the built in policy 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.



1029
1030
1031
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1029

def list_built_in_next_with_http_info(next_page_link, custom_headers = nil)
  list_built_in_next_async(next_page_link, custom_headers).value!
end

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

Gets all the built in policy 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.



771
772
773
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 771

def list_built_in_with_http_info(custom_headers = nil)
  list_built_in_async(custom_headers).value!
end

#list_by_management_group(management_group_id, custom_headers = nil) ⇒ Array<PolicyDefinition>

Gets all the policy definitions for a subscription at management group level.

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<PolicyDefinition>)

    operation results.



840
841
842
843
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 840

def list_by_management_group(management_group_id, custom_headers = nil)
  first_page = list_by_management_group_as_lazy(management_group_id, custom_headers)
  first_page.get_all_items
end

#list_by_management_group_as_lazy(management_group_id, custom_headers = nil) ⇒ PolicyDefinitionListResult

Gets all the policy definitions for a subscription at management group level.

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:

  • (PolicyDefinitionListResult)

    which provide lazy access to pages of



1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1228

def list_by_management_group_as_lazy(management_group_id, custom_headers = nil)
  response = list_by_management_group_async(management_group_id, 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)
    end
    page
  end
end

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

Gets all the policy definitions for a subscription at management group level.

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.



867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 867

def list_by_management_group_async(management_group_id, custom_headers = nil)
  api_version = '2016-12-01'
  fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?


  request_headers = {}

  # 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/policyDefinitions'

  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' => api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.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) ⇒ PolicyDefinitionListResult

Gets all the policy definitions for a subscription at management group level.

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:

  • (PolicyDefinitionListResult)

    operation results.



1101
1102
1103
1104
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1101

def list_by_management_group_next(next_page_link, custom_headers = nil)
  response = list_by_management_group_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

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

Gets all the policy definitions for a subscription at management group level.

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.



1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1130

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 = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.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

Gets all the policy definitions for a subscription at management group level.

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.



1116
1117
1118
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 1116

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).value!
end

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

Gets all the policy definitions for a subscription at management group level.

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.



854
855
856
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 854

def list_by_management_group_with_http_info(management_group_id, custom_headers = nil)
  list_by_management_group_async(management_group_id, custom_headers).value!
end

#list_next(next_page_link, custom_headers = nil) ⇒ PolicyDefinitionListResult

Gets all the policy definitions for a 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:

  • (PolicyDefinitionListResult)

    operation results.



927
928
929
930
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 927

def list_next(next_page_link, custom_headers = nil)
  response = list_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

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

Gets all the policy definitions for a 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.



956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 956

def list_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::Policy::Models::PolicyDefinitionListResult.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

Gets all the policy definitions for a 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.



942
943
944
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 942

def list_next_with_http_info(next_page_link, custom_headers = nil)
  list_next_async(next_page_link, custom_headers).value!
end

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

Gets all the policy definitions for a 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.



688
689
690
# File 'lib/generated/azure_mgmt_policy/policy_definitions.rb', line 688

def list_with_http_info(custom_headers = nil)
  list_async(custom_headers).value!
end