Class: Azure::CDN::Mgmt::V2015_06_01::Profiles

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb

Overview

Use these APIs to manage Azure CDN resources through the Azure Resource Manager. You must make sure that requests made to these resources are secure. For more information, see msdn.microsoft.com/en-us/library/azure/dn790557.aspx.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Profiles

Creates and initializes a new instance of the Profiles class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCdnManagementClient (readonly)

Returns reference to the CdnManagementClient.

Returns:



25
26
27
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 25

def client
  @client
end

Instance Method Details

#begin_create(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Profile

Creates a new CDN profile with the specified parameters.

group. for creation. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileCreateParameters)

    Profile properties needed

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



561
562
563
564
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 561

def begin_create(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  response = begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Creates a new CDN profile with the specified parameters.

group. for creation. Azure subscription. to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileCreateParameters)

    Profile properties needed

  • resource_group_name (String)

    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.



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
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
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 598

def begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'profile_properties is nil' if profile_properties.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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::CDN::Mgmt::V2015_06_01::Models::ProfileCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  profile_properties)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.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

#begin_create_with_http_info(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a new CDN profile with the specified parameters.

group. for creation. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileCreateParameters)

    Profile properties needed

  • resource_group_name (String)

    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.



580
581
582
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 580

def begin_create_with_http_info(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
end

#begin_delete_if_exists(profile_name, resource_group_name, custom_headers = nil) ⇒ Object

Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that



816
817
818
819
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 816

def begin_delete_if_exists(profile_name, resource_group_name, custom_headers = nil)
  response = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers).value!
  nil
end

#begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains.

group. Azure subscription. to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    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.



853
854
855
856
857
858
859
860
861
862
863
864
865
866
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
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 853

def begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_if_exists_with_http_info(profile_name, resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    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.



835
836
837
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 835

def begin_delete_if_exists_with_http_info(profile_name, resource_group_name, custom_headers = nil)
  begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers).value!
end

#begin_update(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Profile

Updates an existing CDN profile with the specified parameters.

group. for update. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileUpdateParameters)

    Profile properties needed

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



694
695
696
697
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 694

def begin_update(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  response = begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

#begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Updates an existing CDN profile with the specified parameters.

group. for update. Azure subscription. to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileUpdateParameters)

    Profile properties needed

  • resource_group_name (String)

    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.



731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
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
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 731

def begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'profile_properties is nil' if profile_properties.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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::CDN::Mgmt::V2015_06_01::Models::ProfileUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  profile_properties)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, 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 == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.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

#begin_update_with_http_info(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates an existing CDN profile with the specified parameters.

group. for update. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileUpdateParameters)

    Profile properties needed

  • resource_group_name (String)

    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.



713
714
715
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 713

def begin_update_with_http_info(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
end

#create(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Profile

Creates a new CDN profile with the specified parameters.

group. for creation. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileCreateParameters)

    Profile properties needed

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



311
312
313
314
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 311

def create(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  response = create_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

#create_async(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

group. for creation. Azure subscription. will be added to the HTTP request.

response.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileCreateParameters)

    Profile properties needed

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 329

def create_async(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_create_async(profile_name, profile_properties, resource_group_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete_if_exists(profile_name, resource_group_name, custom_headers = nil) ⇒ Object

Deletes an existing CDN profile with the specified parameters. Deleting a profile will result in the deletion of all subresources including endpoints, origins and custom domains.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that



409
410
411
412
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 409

def delete_if_exists(profile_name, resource_group_name, custom_headers = nil)
  response = delete_if_exists_async(profile_name, resource_group_name, custom_headers).value!
  nil
end

#delete_if_exists_async(profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

group. Azure subscription. will be added to the HTTP request.

response.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 425

def delete_if_exists_async(profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_delete_if_exists_async(profile_name, resource_group_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#generate_sso_uri(profile_name, resource_group_name, custom_headers = nil) ⇒ SsoUri

Generates a dynamic SSO URI used to sign in to the CDN Supplemental Portal used for advanced management tasks, such as Country Filtering, Advanced HTTP Reports, and Real-time Stats and Alerts. The SSO URI changes approximately every 10 minutes.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (SsoUri)

    operation results.



456
457
458
459
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 456

def generate_sso_uri(profile_name, resource_group_name, custom_headers = nil)
  response = generate_sso_uri_async(profile_name, resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

#generate_sso_uri_async(profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Generates a dynamic SSO URI used to sign in to the CDN Supplemental Portal used for advanced management tasks, such as Country Filtering, Advanced HTTP Reports, and Real-time Stats and Alerts. The SSO URI changes approximately every 10 minutes.

group. Azure subscription. to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    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.



495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 495

def generate_sso_uri_async(profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/generateSsoUri'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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 == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

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

#generate_sso_uri_with_http_info(profile_name, resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Generates a dynamic SSO URI used to sign in to the CDN Supplemental Portal used for advanced management tasks, such as Country Filtering, Advanced HTTP Reports, and Real-time Stats and Alerts. The SSO URI changes approximately every 10 minutes.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    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.



476
477
478
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 476

def generate_sso_uri_with_http_info(profile_name, resource_group_name, custom_headers = nil)
  generate_sso_uri_async(profile_name, resource_group_name, custom_headers).value!
end

#get(profile_name, resource_group_name, custom_headers = nil) ⇒ Profile

Gets a CDN profile with the specified parameters.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



212
213
214
215
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 212

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

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

Gets a CDN profile with the specified parameters.

group. Azure subscription. to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    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.



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
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 245

def get_async(profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}'

  request_url = @base_url || @client.base_url

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

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

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

Gets a CDN profile with the specified parameters.

group. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    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/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 229

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

#list_by_resource_group(resource_group_name, custom_headers = nil) ⇒ ProfileListResult

Lists the CDN profiles within a resource group.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (ProfileListResult)

    operation results.



120
121
122
123
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 120

def list_by_resource_group(resource_group_name, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

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

Lists the CDN profiles within a resource group.

Azure subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    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.



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
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 149

def list_by_resource_group_async(resource_group_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles'

  request_url = @base_url || @client.base_url

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

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

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

Lists the CDN profiles within a resource group.

Azure subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    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.



135
136
137
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 135

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

#list_by_subscription_id(custom_headers = nil) ⇒ ProfileListResult

Lists the CDN profiles within an Azure subscitption.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (ProfileListResult)

    operation results.



35
36
37
38
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 35

def list_by_subscription_id(custom_headers = nil)
  response = list_by_subscription_id_async(custom_headers).value!
  response.body unless response.nil?
end

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

Lists the CDN profiles within an Azure subscitption.

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.



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
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 60

def list_by_subscription_id_async(custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.Cdn/profiles'

  request_url = @base_url || @client.base_url

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

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

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

Lists the CDN profiles within an Azure subscitption.

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.



48
49
50
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 48

def list_by_subscription_id_with_http_info(custom_headers = nil)
  list_by_subscription_id_async(custom_headers).value!
end

#update(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Profile

Updates an existing CDN profile with the specified parameters.

group. for update. Azure subscription. will be added to the HTTP request.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileUpdateParameters)

    Profile properties needed

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



361
362
363
364
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 361

def update(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  response = update_async(profile_name, profile_properties, resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

#update_async(profile_name, profile_properties, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

group. for update. Azure subscription. will be added to the HTTP request.

response.

Parameters:

  • profile_name (String)

    Name of the CDN profile within the resource

  • profile_properties (ProfileUpdateParameters)

    Profile properties needed

  • resource_group_name (String)

    Name of the resource group within the

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/2015-06-01/generated/azure_mgmt_cdn/profiles.rb', line 379

def update_async(profile_name, profile_properties, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_update_async(profile_name, profile_properties, resource_group_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::CDN::Mgmt::V2015_06_01::Models::Profile.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end