azure_mgmt_cdn 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_cdn.gemspec +34 -0
  6. data/lib/azure_mgmt_cdn.rb +77 -0
  7. data/lib/azure_mgmt_cdn/cdn_management_client.rb +87 -0
  8. data/lib/azure_mgmt_cdn/custom_domains.rb +482 -0
  9. data/lib/azure_mgmt_cdn/endpoints.rb +940 -0
  10. data/lib/azure_mgmt_cdn/models/check_name_availability_input.rb +66 -0
  11. data/lib/azure_mgmt_cdn/models/check_name_availability_output.rb +75 -0
  12. data/lib/azure_mgmt_cdn/models/custom_domain.rb +82 -0
  13. data/lib/azure_mgmt_cdn/models/custom_domain_list_result.rb +77 -0
  14. data/lib/azure_mgmt_cdn/models/custom_domain_parameters.rb +62 -0
  15. data/lib/azure_mgmt_cdn/models/custom_domain_properties.rb +84 -0
  16. data/lib/azure_mgmt_cdn/models/custom_domain_properties_parameters.rb +56 -0
  17. data/lib/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
  18. data/lib/azure_mgmt_cdn/models/deep_created_origin.rb +72 -0
  19. data/lib/azure_mgmt_cdn/models/deep_created_origin_properties.rb +78 -0
  20. data/lib/azure_mgmt_cdn/models/endpoint.rb +95 -0
  21. data/lib/azure_mgmt_cdn/models/endpoint_create_parameters.rb +82 -0
  22. data/lib/azure_mgmt_cdn/models/endpoint_list_result.rb +76 -0
  23. data/lib/azure_mgmt_cdn/models/endpoint_properties.rb +197 -0
  24. data/lib/azure_mgmt_cdn/models/endpoint_properties_create_parameters.rb +160 -0
  25. data/lib/azure_mgmt_cdn/models/endpoint_properties_update_parameters.rb +127 -0
  26. data/lib/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
  27. data/lib/azure_mgmt_cdn/models/endpoint_update_parameters.rb +72 -0
  28. data/lib/azure_mgmt_cdn/models/error_response.rb +65 -0
  29. data/lib/azure_mgmt_cdn/models/load_parameters.rb +58 -0
  30. data/lib/azure_mgmt_cdn/models/operation.rb +71 -0
  31. data/lib/azure_mgmt_cdn/models/operation_display.rb +75 -0
  32. data/lib/azure_mgmt_cdn/models/operation_list_result.rb +77 -0
  33. data/lib/azure_mgmt_cdn/models/origin.rb +83 -0
  34. data/lib/azure_mgmt_cdn/models/origin_list_result.rb +76 -0
  35. data/lib/azure_mgmt_cdn/models/origin_parameters.rb +62 -0
  36. data/lib/azure_mgmt_cdn/models/origin_properties.rb +106 -0
  37. data/lib/azure_mgmt_cdn/models/origin_properties_parameters.rb +78 -0
  38. data/lib/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
  39. data/lib/azure_mgmt_cdn/models/profile.rb +95 -0
  40. data/lib/azure_mgmt_cdn/models/profile_create_parameters.rb +82 -0
  41. data/lib/azure_mgmt_cdn/models/profile_list_result.rb +76 -0
  42. data/lib/azure_mgmt_cdn/models/profile_properties.rb +90 -0
  43. data/lib/azure_mgmt_cdn/models/profile_properties_create_parameters.rb +63 -0
  44. data/lib/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
  45. data/lib/azure_mgmt_cdn/models/profile_update_parameters.rb +57 -0
  46. data/lib/azure_mgmt_cdn/models/provisioning_state.rb +17 -0
  47. data/lib/azure_mgmt_cdn/models/purge_parameters.rb +58 -0
  48. data/lib/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
  49. data/lib/azure_mgmt_cdn/models/sku.rb +60 -0
  50. data/lib/azure_mgmt_cdn/models/sku_name.rb +16 -0
  51. data/lib/azure_mgmt_cdn/models/sso_uri.rb +56 -0
  52. data/lib/azure_mgmt_cdn/models/tracked_resource.rb +85 -0
  53. data/lib/azure_mgmt_cdn/models/validate_custom_domain_input.rb +56 -0
  54. data/lib/azure_mgmt_cdn/models/validate_custom_domain_output.rb +75 -0
  55. data/lib/azure_mgmt_cdn/module_definition.rb +8 -0
  56. data/lib/azure_mgmt_cdn/name_availability.rb +101 -0
  57. data/lib/azure_mgmt_cdn/operations.rb +87 -0
  58. data/lib/azure_mgmt_cdn/origins.rb +533 -0
  59. data/lib/azure_mgmt_cdn/profiles.rb +607 -0
  60. data/lib/azure_mgmt_cdn/version.rb +8 -0
  61. metadata +172 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f440033360cbda8b5849003d38e85cc25c54c0c3
4
+ data.tar.gz: 0eae340effec2defc722718d389ffa80901909b4
5
+ SHA512:
6
+ metadata.gz: a2c8cc287e007648ecf882f07f5381d46a40f32c685ea510b59243a8ea649111852f1abb7fbda54f3c6769e9646bc449cc482e97b14ed5cc3a38ab17dbb1719d
7
+ data.tar.gz: ec5786a5a6b1dc61c4503e84f6084d7aa3682a69e8363a708027cf400d42805f304c450313304f69d5bfd74b69c695a18a4a995a01ae20bf55c7d510104969b5
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'azure_mgmt_cdn/module_definition'
9
+ require 'azure_mgmt_cdn/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_cdn'
13
+ spec.version = Azure::ARM::CDN::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure CDN Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure CDN Management services.'
18
+ spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
34
+ end
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'ms_rest_azure'
20
+
21
+ module Azure::ARM::CDN
22
+ autoload :Profiles, 'azure_mgmt_cdn/profiles.rb'
23
+ autoload :Endpoints, 'azure_mgmt_cdn/endpoints.rb'
24
+ autoload :Origins, 'azure_mgmt_cdn/origins.rb'
25
+ autoload :CustomDomains, 'azure_mgmt_cdn/custom_domains.rb'
26
+ autoload :NameAvailability, 'azure_mgmt_cdn/name_availability.rb'
27
+ autoload :Operations, 'azure_mgmt_cdn/operations.rb'
28
+ autoload :CdnManagementClient, 'azure_mgmt_cdn/cdn_management_client.rb'
29
+
30
+ module Models
31
+ autoload :ProfileProperties, 'azure_mgmt_cdn/models/profile_properties.rb'
32
+ autoload :Sku, 'azure_mgmt_cdn/models/sku.rb'
33
+ autoload :ProfileListResult, 'azure_mgmt_cdn/models/profile_list_result.rb'
34
+ autoload :ProfileCreateParameters, 'azure_mgmt_cdn/models/profile_create_parameters.rb'
35
+ autoload :ProfilePropertiesCreateParameters, 'azure_mgmt_cdn/models/profile_properties_create_parameters.rb'
36
+ autoload :ProfileUpdateParameters, 'azure_mgmt_cdn/models/profile_update_parameters.rb'
37
+ autoload :SsoUri, 'azure_mgmt_cdn/models/sso_uri.rb'
38
+ autoload :EndpointProperties, 'azure_mgmt_cdn/models/endpoint_properties.rb'
39
+ autoload :DeepCreatedOrigin, 'azure_mgmt_cdn/models/deep_created_origin.rb'
40
+ autoload :DeepCreatedOriginProperties, 'azure_mgmt_cdn/models/deep_created_origin_properties.rb'
41
+ autoload :EndpointListResult, 'azure_mgmt_cdn/models/endpoint_list_result.rb'
42
+ autoload :EndpointCreateParameters, 'azure_mgmt_cdn/models/endpoint_create_parameters.rb'
43
+ autoload :EndpointPropertiesCreateParameters, 'azure_mgmt_cdn/models/endpoint_properties_create_parameters.rb'
44
+ autoload :EndpointUpdateParameters, 'azure_mgmt_cdn/models/endpoint_update_parameters.rb'
45
+ autoload :EndpointPropertiesUpdateParameters, 'azure_mgmt_cdn/models/endpoint_properties_update_parameters.rb'
46
+ autoload :PurgeParameters, 'azure_mgmt_cdn/models/purge_parameters.rb'
47
+ autoload :LoadParameters, 'azure_mgmt_cdn/models/load_parameters.rb'
48
+ autoload :OriginProperties, 'azure_mgmt_cdn/models/origin_properties.rb'
49
+ autoload :OriginParameters, 'azure_mgmt_cdn/models/origin_parameters.rb'
50
+ autoload :OriginPropertiesParameters, 'azure_mgmt_cdn/models/origin_properties_parameters.rb'
51
+ autoload :OriginListResult, 'azure_mgmt_cdn/models/origin_list_result.rb'
52
+ autoload :CustomDomainProperties, 'azure_mgmt_cdn/models/custom_domain_properties.rb'
53
+ autoload :CustomDomainParameters, 'azure_mgmt_cdn/models/custom_domain_parameters.rb'
54
+ autoload :CustomDomainPropertiesParameters, 'azure_mgmt_cdn/models/custom_domain_properties_parameters.rb'
55
+ autoload :CustomDomainListResult, 'azure_mgmt_cdn/models/custom_domain_list_result.rb'
56
+ autoload :ValidateCustomDomainInput, 'azure_mgmt_cdn/models/validate_custom_domain_input.rb'
57
+ autoload :ValidateCustomDomainOutput, 'azure_mgmt_cdn/models/validate_custom_domain_output.rb'
58
+ autoload :CheckNameAvailabilityInput, 'azure_mgmt_cdn/models/check_name_availability_input.rb'
59
+ autoload :CheckNameAvailabilityOutput, 'azure_mgmt_cdn/models/check_name_availability_output.rb'
60
+ autoload :Operation, 'azure_mgmt_cdn/models/operation.rb'
61
+ autoload :OperationDisplay, 'azure_mgmt_cdn/models/operation_display.rb'
62
+ autoload :OperationListResult, 'azure_mgmt_cdn/models/operation_list_result.rb'
63
+ autoload :ErrorResponse, 'azure_mgmt_cdn/models/error_response.rb'
64
+ autoload :Origin, 'azure_mgmt_cdn/models/origin.rb'
65
+ autoload :CustomDomain, 'azure_mgmt_cdn/models/custom_domain.rb'
66
+ autoload :TrackedResource, 'azure_mgmt_cdn/models/tracked_resource.rb'
67
+ autoload :Profile, 'azure_mgmt_cdn/models/profile.rb'
68
+ autoload :Endpoint, 'azure_mgmt_cdn/models/endpoint.rb'
69
+ autoload :SkuName, 'azure_mgmt_cdn/models/sku_name.rb'
70
+ autoload :ProfileResourceState, 'azure_mgmt_cdn/models/profile_resource_state.rb'
71
+ autoload :ProvisioningState, 'azure_mgmt_cdn/models/provisioning_state.rb'
72
+ autoload :QueryStringCachingBehavior, 'azure_mgmt_cdn/models/query_string_caching_behavior.rb'
73
+ autoload :EndpointResourceState, 'azure_mgmt_cdn/models/endpoint_resource_state.rb'
74
+ autoload :OriginResourceState, 'azure_mgmt_cdn/models/origin_resource_state.rb'
75
+ autoload :CustomDomainResourceState, 'azure_mgmt_cdn/models/custom_domain_resource_state.rb'
76
+ end
77
+ end
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::CDN
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class CdnManagementClient < MsRestAzure::AzureServiceClient
11
+ include Azure::ARM::CDN::Models
12
+ include MsRestAzure
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Gets Azure subscription credentials.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Azure Subscription ID
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Version of the API to be used with the client request,
24
+ # current version is 2015-06-01
25
+ attr_reader :api_version
26
+
27
+ # @return [String] Gets or sets the preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
+ # Running Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
35
+ # is generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return Subscription credentials which uniquely identify client
39
+ # subscription.
40
+ attr_accessor :credentials
41
+
42
+ # @return profiles
43
+ attr_reader :profiles
44
+
45
+ # @return endpoints
46
+ attr_reader :endpoints
47
+
48
+ # @return origins
49
+ attr_reader :origins
50
+
51
+ # @return custom_domains
52
+ attr_reader :custom_domains
53
+
54
+ # @return name_availability
55
+ attr_reader :name_availability
56
+
57
+ # @return operations
58
+ attr_reader :operations
59
+
60
+ #
61
+ # Creates initializes a new instance of the CdnManagementClient class.
62
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
63
+ # @param base_url [String] the base URI of the service.
64
+ # @param options [Array] filters to be applied to the HTTP requests.
65
+ #
66
+ def initialize(credentials, base_url = nil, options = nil)
67
+ super(credentials, options)
68
+ @base_url = base_url || 'https://management.azure.com'
69
+
70
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
71
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
72
+ @credentials = credentials
73
+
74
+ @profiles = Profiles.new(self)
75
+ @endpoints = Endpoints.new(self)
76
+ @origins = Origins.new(self)
77
+ @custom_domains = CustomDomains.new(self)
78
+ @name_availability = NameAvailability.new(self)
79
+ @operations = Operations.new(self)
80
+ @api_version = '2015-06-01'
81
+ @accept_language = 'en-US'
82
+ @long_running_operation_retry_timeout = 30
83
+ @generate_client_request_id = true
84
+ end
85
+
86
+ end
87
+ end
@@ -0,0 +1,482 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::CDN
7
+ #
8
+ # Use these APIs to manage Azure CDN resources through the Azure Resource
9
+ # Manager. You must make sure that requests made to these resources are
10
+ # secure. For more information, see <a
11
+ # href="https://msdn.microsoft.com/en-us/library/azure/dn790557.aspx">Authenticating
12
+ # Azure Resource Manager requests.</a>
13
+ #
14
+ class CustomDomains
15
+ include Azure::ARM::CDN::Models
16
+ include MsRestAzure
17
+
18
+ #
19
+ # Creates and initializes a new instance of the CustomDomains class.
20
+ # @param client service class for accessing basic functionality.
21
+ #
22
+ def initialize(client)
23
+ @client = client
24
+ end
25
+
26
+ # @return reference to the CdnManagementClient
27
+ attr_reader :client
28
+
29
+ #
30
+ # Lists the existing CDN Custom Domains within an Endpoint
31
+ #
32
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
33
+ # @param profile_name [String] Name of the CDN profile within the resource
34
+ # group
35
+ # @param resource_group_name [String] Name of the resource group within the
36
+ # Azure subscription
37
+ # @param [Hash{String => String}] The hash of custom headers need to be
38
+ # applied to HTTP request.
39
+ #
40
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
41
+ # response.
42
+ #
43
+ def list_by_endpoint(endpoint_name, profile_name, resource_group_name, custom_headers = nil)
44
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
45
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
46
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
47
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
48
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
49
+ request_headers = {}
50
+
51
+ # Set Headers
52
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
53
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
54
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains'
55
+ options = {
56
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
57
+ path_params: {'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
58
+ query_params: {'api-version' => @client.api_version},
59
+ headers: request_headers.merge(custom_headers || {})
60
+ }
61
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
62
+ promise = request.run_promise do |req|
63
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
64
+ end
65
+
66
+ promise = promise.then do |http_response|
67
+ status_code = http_response.status
68
+ response_content = http_response.body
69
+ unless status_code == 200
70
+ error_model = JSON.load(response_content)
71
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
72
+ end
73
+
74
+ # Create Result
75
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
76
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
77
+ # Deserialize Response
78
+ if status_code == 200
79
+ begin
80
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
81
+ unless parsed_response.nil?
82
+ parsed_response = CustomDomainListResult.deserialize_object(parsed_response)
83
+ end
84
+ result.body = parsed_response
85
+ rescue Exception => e
86
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
87
+ end
88
+ end
89
+
90
+ result
91
+ end
92
+
93
+ promise.execute
94
+ end
95
+
96
+ #
97
+ # Gets an existing CDN Custom Domain within an Endpoint
98
+ #
99
+ # @param custom_domain_name [String] Name of the custom domain within an
100
+ # endpoint
101
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
102
+ # @param profile_name [String] Name of the CDN profile within the resource
103
+ # group
104
+ # @param resource_group_name [String] Name of the resource group within the
105
+ # Azure subscription
106
+ # @param [Hash{String => String}] The hash of custom headers need to be
107
+ # applied to HTTP request.
108
+ #
109
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
110
+ # response.
111
+ #
112
+ def get(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
113
+ fail ArgumentError, 'custom_domain_name is nil' if custom_domain_name.nil?
114
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
115
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
116
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
117
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
118
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
119
+ request_headers = {}
120
+
121
+ # Set Headers
122
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
123
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
124
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'
125
+ options = {
126
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
127
+ path_params: {'customDomainName' => custom_domain_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
128
+ query_params: {'api-version' => @client.api_version},
129
+ headers: request_headers.merge(custom_headers || {})
130
+ }
131
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
132
+ promise = request.run_promise do |req|
133
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
134
+ end
135
+
136
+ promise = promise.then do |http_response|
137
+ status_code = http_response.status
138
+ response_content = http_response.body
139
+ unless status_code == 200
140
+ error_model = JSON.load(response_content)
141
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
142
+ end
143
+
144
+ # Create Result
145
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
146
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
147
+ # Deserialize Response
148
+ if status_code == 200
149
+ begin
150
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
151
+ unless parsed_response.nil?
152
+ parsed_response = CustomDomain.deserialize_object(parsed_response)
153
+ end
154
+ result.body = parsed_response
155
+ rescue Exception => e
156
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
157
+ end
158
+ end
159
+
160
+ result
161
+ end
162
+
163
+ promise.execute
164
+ end
165
+
166
+ #
167
+ # Creates a new CDN Custom Domain within an Endpoint
168
+ #
169
+ # @param custom_domain_name [String] Name of the custom domain within an
170
+ # endpoint
171
+ # @param custom_domain_properties [CustomDomainParameters] Custom domain
172
+ # properties required for creation
173
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
174
+ # @param profile_name [String] Name of the CDN profile within the resource
175
+ # group
176
+ # @param resource_group_name [String] Name of the resource group within the
177
+ # Azure subscription
178
+ # @param @client.subscription_id [String] Azure Subscription ID
179
+ # @param @client.api_version [String] Version of the API to be used with the
180
+ # client request, current version is 2015-06-01
181
+ # @param @client.accept_language [String] Gets or sets the preferred language
182
+ # for the response.
183
+ #
184
+ # @return [Concurrent::Promise] promise which provides async access to http
185
+ # response.
186
+ #
187
+ def create(custom_domain_name, custom_domain_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
188
+ # Send request
189
+ promise = begin_create(custom_domain_name, custom_domain_properties, endpoint_name, profile_name, resource_group_name, custom_headers)
190
+
191
+ promise = promise.then do |response|
192
+ # Defining deserialization method.
193
+ deserialize_method = lambda do |parsed_response|
194
+ unless parsed_response.nil?
195
+ parsed_response = CustomDomain.deserialize_object(parsed_response)
196
+ end
197
+ end
198
+
199
+ # Waiting for response.
200
+ @client.get_put_operation_result(response, deserialize_method)
201
+ end
202
+
203
+ promise
204
+ end
205
+
206
+ #
207
+ # Creates a new CDN Custom Domain within an Endpoint
208
+ #
209
+ # @param custom_domain_name [String] Name of the custom domain within an
210
+ # endpoint
211
+ # @param custom_domain_properties [CustomDomainParameters] Custom domain
212
+ # properties required for creation
213
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
214
+ # @param profile_name [String] Name of the CDN profile within the resource
215
+ # group
216
+ # @param resource_group_name [String] Name of the resource group within the
217
+ # Azure subscription
218
+ # @param [Hash{String => String}] The hash of custom headers need to be
219
+ # applied to HTTP request.
220
+ #
221
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
222
+ # response.
223
+ #
224
+ def begin_create(custom_domain_name, custom_domain_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
225
+ fail ArgumentError, 'custom_domain_name is nil' if custom_domain_name.nil?
226
+ fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
227
+ custom_domain_properties.validate unless custom_domain_properties.nil?
228
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
229
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
230
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
231
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
232
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
233
+ request_headers = {}
234
+
235
+ # Set Headers
236
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
237
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
238
+
239
+ # Serialize Request
240
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
241
+ unless custom_domain_properties.nil?
242
+ custom_domain_properties = CustomDomainParameters.serialize_object(custom_domain_properties)
243
+ end
244
+ request_content = JSON.generate(custom_domain_properties, quirks_mode: true)
245
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'
246
+ options = {
247
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
248
+ path_params: {'customDomainName' => custom_domain_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
249
+ query_params: {'api-version' => @client.api_version},
250
+ body: request_content,
251
+ headers: request_headers.merge(custom_headers || {})
252
+ }
253
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
254
+ promise = request.run_promise do |req|
255
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
256
+ end
257
+
258
+ promise = promise.then do |http_response|
259
+ status_code = http_response.status
260
+ response_content = http_response.body
261
+ unless status_code == 201 || status_code == 202
262
+ error_model = JSON.load(response_content)
263
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
264
+ end
265
+
266
+ # Create Result
267
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
268
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
269
+ # Deserialize Response
270
+ if status_code == 201
271
+ begin
272
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
273
+ unless parsed_response.nil?
274
+ parsed_response = CustomDomain.deserialize_object(parsed_response)
275
+ end
276
+ result.body = parsed_response
277
+ rescue Exception => e
278
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
279
+ end
280
+ end
281
+ # Deserialize Response
282
+ if status_code == 202
283
+ begin
284
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
285
+ unless parsed_response.nil?
286
+ parsed_response = CustomDomain.deserialize_object(parsed_response)
287
+ end
288
+ result.body = parsed_response
289
+ rescue Exception => e
290
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
291
+ end
292
+ end
293
+
294
+ result
295
+ end
296
+
297
+ promise.execute
298
+ end
299
+
300
+ #
301
+ # Updates an existing CDN Custom Domain within an Endpoint
302
+ #
303
+ # @param custom_domain_name [String] Name of the custom domain within an
304
+ # endpoint
305
+ # @param custom_domain_properties [CustomDomainParameters] Custom domain
306
+ # properties to update
307
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
308
+ # @param profile_name [String] Name of the CDN profile within the resource
309
+ # group
310
+ # @param resource_group_name [String] Name of the resource group within the
311
+ # Azure subscription
312
+ # @param [Hash{String => String}] The hash of custom headers need to be
313
+ # applied to HTTP request.
314
+ #
315
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
316
+ # response.
317
+ #
318
+ def update(custom_domain_name, custom_domain_properties, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
319
+ fail ArgumentError, 'custom_domain_name is nil' if custom_domain_name.nil?
320
+ fail ArgumentError, 'custom_domain_properties is nil' if custom_domain_properties.nil?
321
+ custom_domain_properties.validate unless custom_domain_properties.nil?
322
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
323
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
324
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
325
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
326
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
327
+ request_headers = {}
328
+
329
+ # Set Headers
330
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
331
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
332
+
333
+ # Serialize Request
334
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
335
+ unless custom_domain_properties.nil?
336
+ custom_domain_properties = CustomDomainParameters.serialize_object(custom_domain_properties)
337
+ end
338
+ request_content = JSON.generate(custom_domain_properties, quirks_mode: true)
339
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'
340
+ options = {
341
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
342
+ path_params: {'customDomainName' => custom_domain_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
343
+ query_params: {'api-version' => @client.api_version},
344
+ body: request_content,
345
+ headers: request_headers.merge(custom_headers || {})
346
+ }
347
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
348
+ promise = request.run_promise do |req|
349
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
350
+ end
351
+
352
+ promise = promise.then do |http_response|
353
+ status_code = http_response.status
354
+ response_content = http_response.body
355
+ unless status_code >= 200 && status_code < 300
356
+ error_model = JSON.load(response_content)
357
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
358
+ end
359
+
360
+ # Create Result
361
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
362
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
363
+ begin
364
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
365
+ unless parsed_response.nil?
366
+ parsed_response = ErrorResponse.deserialize_object(parsed_response)
367
+ end
368
+ result.body = parsed_response
369
+ rescue Exception => e
370
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
371
+ end
372
+
373
+ result
374
+ end
375
+
376
+ promise.execute
377
+ end
378
+
379
+ #
380
+ # Deletes an existing CDN Custom Domain within an Endpoint
381
+ #
382
+ # @param custom_domain_name [String] Name of the custom domain within an
383
+ # endpoint
384
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
385
+ # @param profile_name [String] Name of the CDN profile within the resource
386
+ # group
387
+ # @param resource_group_name [String] Name of the resource group within the
388
+ # Azure subscription
389
+ # @return [Concurrent::Promise] promise which provides async access to http
390
+ # response.
391
+ #
392
+ def delete_if_exists(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
393
+ # Send request
394
+ promise = begin_delete_if_exists(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers)
395
+
396
+ promise = promise.then do |response|
397
+ # Defining deserialization method.
398
+ deserialize_method = lambda do |parsed_response|
399
+ unless parsed_response.nil?
400
+ parsed_response = CustomDomain.deserialize_object(parsed_response)
401
+ end
402
+ end
403
+
404
+ # Waiting for response.
405
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
406
+ end
407
+
408
+ promise
409
+ end
410
+
411
+ #
412
+ # Deletes an existing CDN Custom Domain within an Endpoint
413
+ #
414
+ # @param custom_domain_name [String] Name of the custom domain within an
415
+ # endpoint
416
+ # @param endpoint_name [String] Name of the endpoint within the CDN profile
417
+ # @param profile_name [String] Name of the CDN profile within the resource
418
+ # group
419
+ # @param resource_group_name [String] Name of the resource group within the
420
+ # Azure subscription
421
+ # @param [Hash{String => String}] The hash of custom headers need to be
422
+ # applied to HTTP request.
423
+ #
424
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
425
+ # response.
426
+ #
427
+ def begin_delete_if_exists(custom_domain_name, endpoint_name, profile_name, resource_group_name, custom_headers = nil)
428
+ fail ArgumentError, 'custom_domain_name is nil' if custom_domain_name.nil?
429
+ fail ArgumentError, 'endpoint_name is nil' if endpoint_name.nil?
430
+ fail ArgumentError, 'profile_name is nil' if profile_name.nil?
431
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
432
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
433
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
434
+ request_headers = {}
435
+
436
+ # Set Headers
437
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
438
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
439
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/customDomains/{customDomainName}'
440
+ options = {
441
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
442
+ path_params: {'customDomainName' => custom_domain_name,'endpointName' => endpoint_name,'profileName' => profile_name,'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
443
+ query_params: {'api-version' => @client.api_version},
444
+ headers: request_headers.merge(custom_headers || {})
445
+ }
446
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
447
+ promise = request.run_promise do |req|
448
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
449
+ end
450
+
451
+ promise = promise.then do |http_response|
452
+ status_code = http_response.status
453
+ response_content = http_response.body
454
+ unless status_code == 200 || status_code == 202 || status_code == 204
455
+ error_model = JSON.load(response_content)
456
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
457
+ end
458
+
459
+ # Create Result
460
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
461
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
462
+ # Deserialize Response
463
+ if status_code == 202
464
+ begin
465
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
466
+ unless parsed_response.nil?
467
+ parsed_response = CustomDomain.deserialize_object(parsed_response)
468
+ end
469
+ result.body = parsed_response
470
+ rescue Exception => e
471
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
472
+ end
473
+ end
474
+
475
+ result
476
+ end
477
+
478
+ promise.execute
479
+ end
480
+
481
+ end
482
+ end