Class: Azure::ARM::CDN::Operations
- Inherits:
-
Object
- Object
- Azure::ARM::CDN::Operations
- Includes:
- Models, MsRestAzure
- Defined in:
- lib/azure_mgmt_cdn/operations.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 <a href=“msdn.microsoft.com/en-us/library/azure/dn790557.aspx”>Authenticating Azure Resource Manager requests.</a>
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Reference to the CdnManagementClient.
Instance Method Summary collapse
-
#initialize(client) ⇒ Operations
constructor
Creates and initializes a new instance of the Operations class.
-
#list(custom_headers = nil) ⇒ Concurrent::Promise
Lists all of the available CDN REST API operations.
Constructor Details
#initialize(client) ⇒ Operations
Creates and initializes a new instance of the Operations class.
22 23 24 |
# File 'lib/azure_mgmt_cdn/operations.rb', line 22 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns reference to the CdnManagementClient.
27 28 29 |
# File 'lib/azure_mgmt_cdn/operations.rb', line 27 def client @client end |
Instance Method Details
#list(custom_headers = nil) ⇒ Concurrent::Promise
Lists all of the available CDN REST API operations
applied to HTTP request.
response.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/azure_mgmt_cdn/operations.rb', line 38 def list(custom_headers = 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 = '/providers/Microsoft.Cdn/operations' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) 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) unless parsed_response.nil? parsed_response = OperationListResult.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |