Class: Azure::CDN::Mgmt::V2017_04_02::Profiles

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-04-02/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.

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.



19
20
21
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 19

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCdnManagementClient (readonly)

Returns reference to the CdnManagementClient.

Returns:



24
25
26
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 24

def client
  @client
end

Instance Method Details

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

Creates a new CDN profile with a profile name under the specified subscription and resource group.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile (Profile)

    Profile properties needed to create a new profile.

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



763
764
765
766
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 763

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

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

Creates a new CDN profile with a profile name under the specified subscription and resource group.

Azure subscription. the resource group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile (Profile)

    Profile properties needed to create a new profile.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
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
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 800

def begin_create_async(resource_group_name, profile_name, profile, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'profile is nil' if profile.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::V2017_04_02::Models::Profile.mapper()
  request_content = @client.serialize(request_mapper,  profile)
  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: {'resourceGroupName' => resource_group_name,'profileName' => profile_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::V2017_04_02::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::V2017_04_02::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::V2017_04_02::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(resource_group_name, profile_name, profile, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a new CDN profile with a profile name under the specified subscription and resource group.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile (Profile)

    Profile properties needed to create a new profile.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



782
783
784
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 782

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

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

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

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that



1021
1022
1023
1024
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1021

def begin_delete(resource_group_name, profile_name, custom_headers = nil)
  response = begin_delete_async(resource_group_name, profile_name, custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, profile_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 of the sub-resources including endpoints, origins and custom domains.

Azure subscription. the resource group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1058

def begin_delete_async(resource_group_name, profile_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_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: {'resourceGroupName' => resource_group_name,'profileName' => profile_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_with_http_info(resource_group_name, profile_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 of the sub-resources including endpoints, origins and custom domains.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1040
1041
1042
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1040

def begin_delete_with_http_info(resource_group_name, profile_name, custom_headers = nil)
  begin_delete_async(resource_group_name, profile_name, custom_headers).value!
end

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

Updates an existing CDN profile with the specified profile name under the specified subscription and resource group.

Azure subscription. the resource group. needed to update an existing profile. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile_update_parameters (ProfileUpdateParameters)

    Profile properties

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



897
898
899
900
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 897

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

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

Updates an existing CDN profile with the specified profile name under the specified subscription and resource group.

Azure subscription. the resource group. needed to update an existing profile. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile_update_parameters (ProfileUpdateParameters)

    Profile properties

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 936

def begin_update_async(resource_group_name, profile_name, profile_update_parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_name.nil?
  fail ArgumentError, 'profile_update_parameters is nil' if profile_update_parameters.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::V2017_04_02::Models::ProfileUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  profile_update_parameters)
  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: {'resourceGroupName' => resource_group_name,'profileName' => profile_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::V2017_04_02::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::V2017_04_02::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(resource_group_name, profile_name, profile_update_parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates an existing CDN profile with the specified profile name under the specified subscription and resource group.

Azure subscription. the resource group. needed to update an existing profile. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile_update_parameters (ProfileUpdateParameters)

    Profile properties

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



917
918
919
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 917

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

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

Creates a new CDN profile with a profile name under the specified subscription and resource group.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile (Profile)

    Profile properties needed to create a new profile.

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



313
314
315
316
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 313

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

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

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

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile (Profile)

    Profile properties needed to create a new profile.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 330

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::CDN::Mgmt::V2017_04_02::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(resource_group_name, profile_name, custom_headers = nil) ⇒ Object

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

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that



411
412
413
414
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 411

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

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

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

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 427

def delete_async(resource_group_name, profile_name, custom_headers = nil)
  # Send request
  promise = begin_delete_async(resource_group_name, profile_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(resource_group_name, profile_name, custom_headers = nil) ⇒ SsoUri

Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (SsoUri)

    operation results.



459
460
461
462
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 459

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

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

Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes.

Azure subscription. the resource group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
546
547
548
549
550
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 500

def generate_sso_uri_async(resource_group_name, profile_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_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: {'resourceGroupName' => resource_group_name,'profileName' => profile_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::V2017_04_02::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(resource_group_name, profile_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Generates a dynamic SSO URI used to sign in to the CDN supplemental portal. Supplemnetal portal is used to configure advanced feature capabilities that are not yet available in the Azure portal, such as core reports in a standard profile; rules engine, advanced HTTP reports, and real-time stats and alerts in a premium profile. The SSO URI changes approximately every 10 minutes.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



480
481
482
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 480

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

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

Gets a CDN profile with the specified profile name under the specified subscription and resource group.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



212
213
214
215
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 212

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

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

Gets a CDN profile with the specified profile name under the specified subscription and resource group.

Azure subscription. the resource group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 247

def get_async(resource_group_name, profile_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_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: {'resourceGroupName' => resource_group_name,'profileName' => profile_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::V2017_04_02::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(resource_group_name, profile_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a CDN profile with the specified profile name under the specified subscription and resource group.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



230
231
232
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 230

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

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

Lists all of the CDN profiles within an Azure subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<Profile>)

    operation results.



34
35
36
37
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 34

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

#list_as_lazy(custom_headers = nil) ⇒ ProfileListResult

Lists all of the CDN profiles within an Azure subscription.

will be added to the HTTP request.

response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (ProfileListResult)

    which provide lazy access to pages of the



1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1370

def list_as_lazy(custom_headers = nil)
  response = list_async(custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers)
    end
    page
  end
end

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

Lists all of the CDN profiles within an Azure subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 59

def list_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::V2017_04_02::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(resource_group_name, custom_headers = nil) ⇒ Array<Profile>

Lists all of 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:

  • (Array<Profile>)

    operation results.



119
120
121
122
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 119

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

#list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil) ⇒ ProfileListResult

Lists all of the CDN profiles within a resource group.

Azure subscription. will be added to the HTTP request.

response.

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)

    which provide lazy access to pages of the



1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1392

def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, 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)
    end
    page
  end
end

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

Lists all of 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.



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
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 148

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::V2017_04_02::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_next(next_page_link, custom_headers = nil) ⇒ ProfileListResult

Lists all of the CDN profiles within a resource group.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (ProfileListResult)

    operation results.



1197
1198
1199
1200
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1197

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

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

Lists all of the CDN profiles within a resource group.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1226

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

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

  request_url = @base_url || @client.base_url

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

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

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

Lists all of the CDN profiles within a resource group.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1212
1213
1214
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1212

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

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

Lists all of 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.



134
135
136
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 134

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_next(next_page_link, custom_headers = nil) ⇒ ProfileListResult

Lists all of the CDN profiles within an Azure subscription.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (ProfileListResult)

    operation results.



1110
1111
1112
1113
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1110

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

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

Lists all of the CDN profiles within an Azure subscription.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1139

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


  request_headers = {}

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

  request_url = @base_url || @client.base_url

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

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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::V2017_04_02::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_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all of the CDN profiles within an Azure subscription.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1125
1126
1127
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1125

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

#list_resource_usage(resource_group_name, profile_name, custom_headers = nil) ⇒ Array<ResourceUsage>

Checks the quota and actual usage of endpoints under the given CDN profile.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (Array<ResourceUsage>)

    operation results.



664
665
666
667
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 664

def list_resource_usage(resource_group_name, profile_name, custom_headers = nil)
  first_page = list_resource_usage_as_lazy(resource_group_name, profile_name, custom_headers)
  first_page.get_all_items
end

#list_resource_usage_as_lazy(resource_group_name, profile_name, custom_headers = nil) ⇒ ResourceUsageListResult

Checks the quota and actual usage of endpoints under the given CDN profile.

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

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (ResourceUsageListResult)

    which provide lazy access to pages of the



1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1416

def list_resource_usage_as_lazy(resource_group_name, profile_name, custom_headers = nil)
  response = list_resource_usage_async(resource_group_name, profile_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_resource_usage_next_async(next_page_link, custom_headers)
    end
    page
  end
end

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

Checks the quota and actual usage of endpoints under the given CDN profile.

Azure subscription. the resource group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 697

def list_resource_usage_async(resource_group_name, profile_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_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}/checkResourceUsage'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_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::V2017_04_02::Models::ResourceUsageListResult.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_resource_usage_next(next_page_link, custom_headers = nil) ⇒ ResourceUsageListResult

Checks the quota and actual usage of endpoints under the given CDN profile.

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:

  • (ResourceUsageListResult)

    operation results.



1284
1285
1286
1287
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1284

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

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

Checks the quota and actual usage of endpoints under the given CDN profile.

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.



1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1313

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


  request_headers = {}

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(: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::V2017_04_02::Models::ResourceUsageListResult.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_resource_usage_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Checks the quota and actual usage of endpoints under the given CDN profile.

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.



1299
1300
1301
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 1299

def list_resource_usage_next_with_http_info(next_page_link, custom_headers = nil)
  list_resource_usage_next_async(next_page_link, custom_headers).value!
end

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

Checks the quota and actual usage of endpoints under the given CDN profile.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



681
682
683
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 681

def list_resource_usage_with_http_info(resource_group_name, profile_name, custom_headers = nil)
  list_resource_usage_async(resource_group_name, profile_name, custom_headers).value!
end

#list_supported_optimization_types(resource_group_name, profile_name, custom_headers = nil) ⇒ SupportedOptimizationTypesListResult

Gets the supported optimization types for the current profile. A user can create an endpoint with an optimization type from the listed values.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (SupportedOptimizationTypesListResult)

    operation results.



565
566
567
568
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 565

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

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

Gets the supported optimization types for the current profile. A user can create an endpoint with an optimization type from the listed values.

Azure subscription. the resource group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 600

def list_supported_optimization_types_async(resource_group_name, profile_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'profile_name is nil' if profile_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}/getSupportedOptimizationTypes'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'profileName' => profile_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::V2017_04_02::Models::SupportedOptimizationTypesListResult.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_supported_optimization_types_with_http_info(resource_group_name, profile_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the supported optimization types for the current profile. A user can create an endpoint with an optimization type from the listed values.

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

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



583
584
585
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 583

def list_supported_optimization_types_with_http_info(resource_group_name, profile_name, custom_headers = nil)
  list_supported_optimization_types_async(resource_group_name, profile_name, custom_headers).value!
end

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

Lists all of the CDN profiles within an Azure subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



47
48
49
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 47

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

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

Updates an existing CDN profile with the specified profile name under the specified subscription and resource group.

Azure subscription. the resource group. needed to update an existing profile. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile_update_parameters (ProfileUpdateParameters)

    Profile properties

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

    A hash of custom headers that

Returns:

  • (Profile)

    operation results.



363
364
365
366
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 363

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

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

Azure subscription. the resource group. needed to update an existing profile. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the Resource group within the

  • profile_name (String)

    Name of the CDN profile which is unique within

  • profile_update_parameters (ProfileUpdateParameters)

    Profile properties

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/2017-04-02/generated/azure_mgmt_cdn/profiles.rb', line 381

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::CDN::Mgmt::V2017_04_02::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