Class: Azure::Security::Mgmt::V2020_01_01::JitNetworkAccessPolicies

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb

Overview

API spec for Microsoft.Security (Azure Security Center) resource provider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ JitNetworkAccessPolicies

Creates and initializes a new instance of the JitNetworkAccessPolicies class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSecurityCenter (readonly)

Returns reference to the SecurityCenter.

Returns:



22
23
24
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 22

def client
  @client
end

Instance Method Details

#create_or_update(resource_group_name, jit_network_access_policy_name, body, custom_headers: nil) ⇒ JitNetworkAccessPolicy

Create a policy for protecting resources using Just-in-Time access control

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (JitNetworkAccessPolicy)

    operation results.



524
525
526
527
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 524

def create_or_update(resource_group_name, jit_network_access_policy_name, body, custom_headers:nil)
  response = create_or_update_async(resource_group_name, jit_network_access_policy_name, body, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, jit_network_access_policy_name, body, custom_headers: nil) ⇒ Concurrent::Promise

Create a policy for protecting resources using Just-in-Time access control

user’s subscription. The name is case insensitive. configuration policy. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

  • body (JitNetworkAccessPolicy)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
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/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 559

def create_or_update_async(resource_group_name, jit_network_access_policy_name, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'jit_network_access_policy_name is nil' if jit_network_access_policy_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPolicy.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'ascLocation' => @client.asc_location,'jitNetworkAccessPolicyName' => jit_network_access_policy_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPolicy.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_with_http_info(resource_group_name, jit_network_access_policy_name, body, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create a policy for protecting resources using Just-in-Time access control

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



542
543
544
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 542

def create_or_update_with_http_info(resource_group_name, jit_network_access_policy_name, body, custom_headers:nil)
  create_or_update_async(resource_group_name, jit_network_access_policy_name, body, custom_headers:custom_headers).value!
end

#delete(resource_group_name, jit_network_access_policy_name, custom_headers: nil) ⇒ Object

Delete a Just-in-Time access control policy.

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that



638
639
640
641
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 638

def delete(resource_group_name, jit_network_access_policy_name, custom_headers:nil)
  response = delete_async(resource_group_name, jit_network_access_policy_name, custom_headers:custom_headers).value!
  nil
end

#delete_async(resource_group_name, jit_network_access_policy_name, custom_headers: nil) ⇒ Concurrent::Promise

Delete a Just-in-Time access control policy.

user’s subscription. The name is case insensitive. configuration policy. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



671
672
673
674
675
676
677
678
679
680
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
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 671

def delete_async(resource_group_name, jit_network_access_policy_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'jit_network_access_policy_name is nil' if jit_network_access_policy_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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#delete_with_http_info(resource_group_name, jit_network_access_policy_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Delete a Just-in-Time access control policy.

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



655
656
657
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 655

def delete_with_http_info(resource_group_name, jit_network_access_policy_name, custom_headers:nil)
  delete_async(resource_group_name, jit_network_access_policy_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, jit_network_access_policy_name, custom_headers: nil) ⇒ JitNetworkAccessPolicy

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (JitNetworkAccessPolicy)

    operation results.



416
417
418
419
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 416

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

#get_async(resource_group_name, jit_network_access_policy_name, custom_headers: nil) ⇒ Concurrent::Promise

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. configuration policy. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 451

def get_async(resource_group_name, jit_network_access_policy_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'jit_network_access_policy_name is nil' if jit_network_access_policy_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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'ascLocation' => @client.asc_location,'jitNetworkAccessPolicyName' => jit_network_access_policy_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 MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPolicy.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_with_http_info(resource_group_name, jit_network_access_policy_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



434
435
436
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 434

def get_with_http_info(resource_group_name, jit_network_access_policy_name, custom_headers:nil)
  get_async(resource_group_name, jit_network_access_policy_name, custom_headers:custom_headers).value!
end

#initiate(resource_group_name, jit_network_access_policy_name, body, custom_headers: nil) ⇒ JitNetworkAccessRequest

Initiate a JIT access from a specific Just-in-Time policy configuration.

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (JitNetworkAccessRequest)

    operation results.



734
735
736
737
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 734

def initiate(resource_group_name, jit_network_access_policy_name, body, custom_headers:nil)
  response = initiate_async(resource_group_name, jit_network_access_policy_name, body, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#initiate_async(resource_group_name, jit_network_access_policy_name, body, custom_headers: nil) ⇒ Concurrent::Promise

Initiate a JIT access from a specific Just-in-Time policy configuration.

user’s subscription. The name is case insensitive. configuration policy. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

  • body (JitNetworkAccessPolicyInitiateRequest)
  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



769
770
771
772
773
774
775
776
777
778
779
780
781
782
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
830
831
832
833
834
835
836
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 769

def initiate_async(resource_group_name, jit_network_access_policy_name, body, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.nil?
  fail ArgumentError, 'jit_network_access_policy_name is nil' if jit_network_access_policy_name.nil?
  jit_network_access_policy_initiate_type = 'initiate'
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'body is nil' if body.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPolicyInitiateRequest.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'ascLocation' => @client.asc_location,'jitNetworkAccessPolicyName' => jit_network_access_policy_name,'jitNetworkAccessPolicyInitiateType' => jit_network_access_policy_initiate_type},
      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(:post, 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 == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessRequest.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

#initiate_with_http_info(resource_group_name, jit_network_access_policy_name, body, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Initiate a JIT access from a specific Just-in-Time policy configuration.

user’s subscription. The name is case insensitive. configuration policy. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • jit_network_access_policy_name (String)

    Name of a Just-in-Time access

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



752
753
754
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 752

def initiate_with_http_info(resource_group_name, jit_network_access_policy_name, body, custom_headers:nil)
  initiate_async(resource_group_name, jit_network_access_policy_name, body, custom_headers:custom_headers).value!
end

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

Policies for protecting resources using Just-in-Time access control.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<JitNetworkAccessPolicy>)

    operation results.



32
33
34
35
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 32

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) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control.

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:

  • (JitNetworkAccessPoliciesList)

    which provide lazy access to pages of



1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1216

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

Policies for protecting resources using Just-in-Time access control.

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.



57
58
59
60
61
62
63
64
65
66
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
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 57

def list_async(custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  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 = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies'

  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 MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_region(custom_headers: nil) ⇒ Array<JitNetworkAccessPolicy>

Policies for protecting resources using Just-in-Time access control for the subscription, location

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<JitNetworkAccessPolicy>)

    operation results.



120
121
122
123
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 120

def list_by_region(custom_headers:nil)
  first_page = list_by_region_as_lazy(custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_region_as_lazy(custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control for the subscription, location

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:

  • (JitNetworkAccessPoliciesList)

    which provide lazy access to pages of



1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1237

def list_by_region_as_lazy(custom_headers:nil)
  response = list_by_region_async(custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_region_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

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

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 147

def list_by_region_async(custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.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 = 'subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_region_next(next_page_link, custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control for the subscription, location

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:

  • (JitNetworkAccessPoliciesList)

    operation results.



939
940
941
942
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 939

def list_by_region_next(next_page_link, custom_headers:nil)
  response = list_by_region_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



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
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 970

def list_by_region_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_region_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



955
956
957
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 955

def list_by_region_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_region_next_async(next_page_link, custom_headers:custom_headers).value!
end

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

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



134
135
136
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 134

def list_by_region_with_http_info(custom_headers:nil)
  list_by_region_async(custom_headers:custom_headers).value!
end

#list_by_resource_group(resource_group_name, custom_headers: nil) ⇒ Array<JitNetworkAccessPolicy>

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Array<JitNetworkAccessPolicy>)

    operation results.



213
214
215
216
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 213

def list_by_resource_group(resource_group_name, custom_headers:nil)
  first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_and_region(resource_group_name, custom_headers: nil) ⇒ Array<JitNetworkAccessPolicy>

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Array<JitNetworkAccessPolicy>)

    operation results.



313
314
315
316
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 313

def list_by_resource_group_and_region(resource_group_name, custom_headers:nil)
  first_page = list_by_resource_group_and_region_as_lazy(resource_group_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_and_region_as_lazy(resource_group_name, custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (JitNetworkAccessPoliciesList)

    which provide lazy access to pages of



1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1283

def list_by_resource_group_and_region_as_lazy(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_and_region_async(resource_group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_and_region_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_and_region_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 344

def list_by_resource_group_and_region_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.asc_location is nil' if @client.asc_location.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_resource_group_and_region_next(next_page_link, custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control for the subscription, location

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:

  • (JitNetworkAccessPoliciesList)

    operation results.



1125
1126
1127
1128
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1125

def list_by_resource_group_and_region_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_and_region_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1156

def list_by_resource_group_and_region_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_resource_group_and_region_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



1141
1142
1143
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1141

def list_by_resource_group_and_region_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_and_region_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_and_region_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



329
330
331
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 329

def list_by_resource_group_and_region_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_and_region_async(resource_group_name, custom_headers:custom_headers).value!
end

#list_by_resource_group_as_lazy(resource_group_name, custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (JitNetworkAccessPoliciesList)

    which provide lazy access to pages of



1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1260

def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



244
245
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
296
297
298
299
300
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 244

def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'Pattern': '^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'" if !@client.subscription_id.nil? && @client.subscription_id.match(Regexp.new('^^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$$')).nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies'

  request_url = @base_url || @client.base_url

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_resource_group_next(next_page_link, custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control for the subscription, location

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:

  • (JitNetworkAccessPoliciesList)

    operation results.



1032
1033
1034
1035
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1032

def list_by_resource_group_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



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
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1063

def list_by_resource_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 MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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_resource_group_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Policies for protecting resources using Just-in-Time access control for the subscription, location

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.



1048
1049
1050
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 1048

def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Policies for protecting resources using Just-in-Time access control for the subscription, location

user’s subscription. The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



229
230
231
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 229

def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ JitNetworkAccessPoliciesList

Policies for protecting resources using Just-in-Time access control.

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:

  • (JitNetworkAccessPoliciesList)

    operation results.



848
849
850
851
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 848

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

Policies for protecting resources using Just-in-Time access control.

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.



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
916
917
918
919
920
921
922
923
924
925
926
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 877

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


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Security::Mgmt::V2020_01_01::Models::JitNetworkAccessPoliciesList.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

Policies for protecting resources using Just-in-Time access control.

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.



863
864
865
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 863

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

Policies for protecting resources using Just-in-Time access control.

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.



45
46
47
# File 'lib/2020-01-01/generated/azure_mgmt_security/jit_network_access_policies.rb', line 45

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