Class: Azure::ARM::CDN::Endpoints

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/azure_mgmt_cdn/endpoints.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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Endpoints

Creates and initializes a new instance of the Endpoints class.

Parameters:

  • client

    service class for accessing basic functionality.



22
23
24
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 22

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns reference to the CdnManagementClient.

Returns:

  • reference to the CdnManagementClient



27
28
29
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 27

def client
  @client
end

Instance Method Details

#begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Creates a new CDN endpoint with the specified parameters

group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • endpoint_properties (EndpointCreateParameters)

    Endpoint properties

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 213

def begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
  fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
  endpoint_properties.validate unless endpoint_properties.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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless endpoint_properties.nil?
    endpoint_properties = EndpointCreateParameters.serialize_object(endpoint_properties)
  end
  request_content = JSON.generate(endpoint_properties, quirks_mode: true)
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'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 || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
  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 == 201 || status_code == 202
      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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          parsed_response = Endpoint.deserialize_object(parsed_response)
        end
        result.body = 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)
        unless parsed_response.nil?
          parsed_response = Endpoint.deserialize_object(parsed_response)
        end
        result.body = 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_delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

deletes an existing CDN endpoint with the specified parameters

group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 462

def begin_delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.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}/endpoints/{endpointName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
  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 == 202 || status_code == 204
      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?

    result
  end

  promise.execute
end

#begin_load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Forcibly pre-loads CDN endpoint content

loaded. Path should describe a file. group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • content_file_paths (LoadParameters)

    The path to the content to be

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



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
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 808

def begin_load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
  fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
  content_file_paths.validate unless content_file_paths.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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless content_file_paths.nil?
    content_file_paths = LoadParameters.serialize_object(content_file_paths)
  end
  request_content = JSON.generate(content_file_paths, quirks_mode: true)
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/load'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'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 || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
  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 == 202
      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?

    result
  end

  promise.execute
end

#begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Forcibly purges CDN endpoint content

purged. Path can describe a file or directory. group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • content_file_paths (PurgeParameters)

    The path to the content to be

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 712

def begin_purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
  fail ArgumentError, 'content_file_paths is nil' if content_file_paths.nil?
  content_file_paths.validate unless content_file_paths.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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless content_file_paths.nil?
    content_file_paths = PurgeParameters.serialize_object(content_file_paths)
  end
  request_content = JSON.generate(content_file_paths, quirks_mode: true)
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'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 || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
  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 == 202
      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?

    result
  end

  promise.execute
end

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

Starts an existing stopped CDN endpoint

group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 544

def begin_start(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.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}/endpoints/{endpointName}/start'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
  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 == 202
      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?

    result
  end

  promise.execute
end

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

Stops an existing running CDN endpoint

group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 626

def begin_stop(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.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}/endpoints/{endpointName}/stop'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
  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 == 202
      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?

    result
  end

  promise.execute
end

#begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation.

group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • endpoint_properties (EndpointUpdateParameters)

    Endpoint properties

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 346

def begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
  fail ArgumentError, 'endpoint_properties is nil' if endpoint_properties.nil?
  endpoint_properties.validate unless endpoint_properties.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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless endpoint_properties.nil?
    endpoint_properties = EndpointUpdateParameters.serialize_object(endpoint_properties)
  end
  request_content = JSON.generate(endpoint_properties, quirks_mode: true)
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'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 || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
  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 || status_code == 202
      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 = Endpoint.deserialize_object(parsed_response)
        end
        result.body = 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)
        unless parsed_response.nil?
          parsed_response = Endpoint.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Creates a new CDN endpoint with the specified parameters

group Azure subscription client request, current version is 2015-06-01 for the response.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • endpoint_properties (EndpointCreateParameters)

    Endpoint properties

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • @client.subscription_id (String)

    Azure Subscription ID

  • @client.api_version (String)

    Version of the API to be used with the

  • @client.accept_language (String)

    Gets or sets the preferred language

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 179

def create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_create(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      unless parsed_response.nil?
        parsed_response = Endpoint.deserialize_object(parsed_response)
      end
    end

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

  promise
end

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

deletes an existing CDN endpoint with the specified parameters

group Azure subscription response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 432

def delete_if_exists(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_delete_if_exists(endpoint_name, 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_post_or_delete_operation_result(response, deserialize_method)
  end

  promise
end

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

Gets an existing CDN endpoint with the specified parameters

group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 108

def get(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.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}/endpoints/{endpointName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      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, options)
  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 = Endpoint.deserialize_object(parsed_response)
        end
        result.body = 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_profile(profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Lists existing CDN endpoints within a profile

group Azure subscription applied to 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

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



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
85
86
87
88
89
90
91
92
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 42

def list_by_profile(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}/endpoints'
  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 || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
  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 = EndpointListResult.deserialize_object(parsed_response)
        end
        result.body = 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

#load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Forcibly pre-loads CDN endpoint content

loaded. Path should describe a file. group Azure subscription response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • content_file_paths (LoadParameters)

    The path to the content to be

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 776

def load_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_load_content(endpoint_name, content_file_paths, 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_post_or_delete_operation_result(response, deserialize_method)
  end

  promise
end

#purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Forcibly purges CDN endpoint content

purged. Path can describe a file or directory. group Azure subscription response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • content_file_paths (PurgeParameters)

    The path to the content to be

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 680

def purge_content(endpoint_name, content_file_paths, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_purge_content(endpoint_name, content_file_paths, 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_post_or_delete_operation_result(response, deserialize_method)
  end

  promise
end

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

Starts an existing stopped CDN endpoint

group Azure subscription response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 514

def start(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_start(endpoint_name, 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_post_or_delete_operation_result(response, deserialize_method)
  end

  promise
end

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

Stops an existing running CDN endpoint

group Azure subscription response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 596

def stop(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_stop(endpoint_name, 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_post_or_delete_operation_result(response, deserialize_method)
  end

  promise
end

#update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Updates an existing CDN endpoint with the specified parameters. Only tags and OriginHostHeader can be updated after creating an endpoint. To update origins, use the Update Origin operation. To update custom domains, use the Update Custom Domain operation.

group Azure subscription client request, current version is 2015-06-01 for the response.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • endpoint_properties (EndpointUpdateParameters)

    Endpoint properties

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • @client.subscription_id (String)

    Azure Subscription ID

  • @client.api_version (String)

    Version of the API to be used with the

  • @client.accept_language (String)

    Gets or sets the preferred language

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 309

def update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers = nil)
  # Send request
  promise = begin_update(endpoint_name, endpoint_properties, profile_name, resource_group_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      unless parsed_response.nil?
        parsed_response = Endpoint.deserialize_object(parsed_response)
      end
    end

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

  promise
end

#validate_custom_domain(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Validates a Custom Domain mapping to ensure it maps to the correct CNAME in DNS

validate group Azure subscription applied to HTTP request.

response.

Parameters:

  • endpoint_name (String)

    Name of the endpoint within the CDN profile

  • custom_domain_properties (ValidateCustomDomainInput)

    Custom domain to

  • profile_name (String)

    Name of the CDN profile within the resource

  • resource_group_name (String)

    Name of the resource group within the

  • The (Hash{String => String})

    hash of custom headers need to be

Returns:

  • (Concurrent::Promise)

    Promise object which allows to get HTTP



876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
# File 'lib/azure_mgmt_cdn/endpoints.rb', line 876

def validate_custom_domain(endpoint_name, custom_domain_properties, profile_name, resource_group_name, custom_headers = nil)
  fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
  fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
  custom_domain_properties.validate unless custom_domain_properties.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?

  # Serialize Request
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
  unless custom_domain_properties.nil?
    custom_domain_properties = ValidateCustomDomainInput.serialize_object(custom_domain_properties)
  end
  request_content = JSON.generate(custom_domain_properties, quirks_mode: true)
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/validateCustomDomain'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'endpointName' => endpoint_name,'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 || {})
  }
  request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
  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 = ValidateCustomDomainOutput.deserialize_object(parsed_response)
        end
        result.body = 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