1package cdn
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"net/http"
15)
16
17// The package's fully qualified name.
18const fqdn = "github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2015-06-01/cdn"
19
20// CheckNameAvailabilityInput input of CheckNameAvailability API.
21type CheckNameAvailabilityInput struct {
22	// Name - The resource name to validate.
23	Name *string `json:"name,omitempty"`
24	// Type - The type of the resource whose name is to be validated.
25	Type *string `json:"type,omitempty"`
26}
27
28// CheckNameAvailabilityOutput output of check name availability API.
29type CheckNameAvailabilityOutput struct {
30	autorest.Response `json:"-"`
31	// NameAvailable - Indicates whether the name is available.
32	NameAvailable *bool `json:"NameAvailable,omitempty"`
33	// Reason - The reason why the name is not available.
34	Reason *string `json:"Reason,omitempty"`
35	// Message - The detailed error message describing why the name is not available.
36	Message *string `json:"Message,omitempty"`
37}
38
39// CustomDomain CDN CustomDomain represents a mapping between a user specified domain name and a CDN
40// endpoint. This is to use custom domain names to represent the URLs for branding purposes.
41type CustomDomain struct {
42	autorest.Response       `json:"-"`
43	*CustomDomainProperties `json:"properties,omitempty"`
44	// ID - READ-ONLY; Resource ID
45	ID *string `json:"id,omitempty"`
46	// Name - READ-ONLY; Resource name
47	Name *string `json:"name,omitempty"`
48	// Type - READ-ONLY; Resource type
49	Type *string `json:"type,omitempty"`
50}
51
52// MarshalJSON is the custom marshaler for CustomDomain.
53func (cd CustomDomain) MarshalJSON() ([]byte, error) {
54	objectMap := make(map[string]interface{})
55	if cd.CustomDomainProperties != nil {
56		objectMap["properties"] = cd.CustomDomainProperties
57	}
58	return json.Marshal(objectMap)
59}
60
61// UnmarshalJSON is the custom unmarshaler for CustomDomain struct.
62func (cd *CustomDomain) UnmarshalJSON(body []byte) error {
63	var m map[string]*json.RawMessage
64	err := json.Unmarshal(body, &m)
65	if err != nil {
66		return err
67	}
68	for k, v := range m {
69		switch k {
70		case "properties":
71			if v != nil {
72				var customDomainProperties CustomDomainProperties
73				err = json.Unmarshal(*v, &customDomainProperties)
74				if err != nil {
75					return err
76				}
77				cd.CustomDomainProperties = &customDomainProperties
78			}
79		case "id":
80			if v != nil {
81				var ID string
82				err = json.Unmarshal(*v, &ID)
83				if err != nil {
84					return err
85				}
86				cd.ID = &ID
87			}
88		case "name":
89			if v != nil {
90				var name string
91				err = json.Unmarshal(*v, &name)
92				if err != nil {
93					return err
94				}
95				cd.Name = &name
96			}
97		case "type":
98			if v != nil {
99				var typeVar string
100				err = json.Unmarshal(*v, &typeVar)
101				if err != nil {
102					return err
103				}
104				cd.Type = &typeVar
105			}
106		}
107	}
108
109	return nil
110}
111
112// CustomDomainListResult ...
113type CustomDomainListResult struct {
114	autorest.Response `json:"-"`
115	// Value - List of CDN CustomDomains within an endpoint.
116	Value *[]CustomDomain `json:"value,omitempty"`
117}
118
119// CustomDomainParameters customDomain properties required for custom domain creation or update.
120type CustomDomainParameters struct {
121	*CustomDomainPropertiesParameters `json:"properties,omitempty"`
122}
123
124// MarshalJSON is the custom marshaler for CustomDomainParameters.
125func (cdp CustomDomainParameters) MarshalJSON() ([]byte, error) {
126	objectMap := make(map[string]interface{})
127	if cdp.CustomDomainPropertiesParameters != nil {
128		objectMap["properties"] = cdp.CustomDomainPropertiesParameters
129	}
130	return json.Marshal(objectMap)
131}
132
133// UnmarshalJSON is the custom unmarshaler for CustomDomainParameters struct.
134func (cdp *CustomDomainParameters) UnmarshalJSON(body []byte) error {
135	var m map[string]*json.RawMessage
136	err := json.Unmarshal(body, &m)
137	if err != nil {
138		return err
139	}
140	for k, v := range m {
141		switch k {
142		case "properties":
143			if v != nil {
144				var customDomainPropertiesParameters CustomDomainPropertiesParameters
145				err = json.Unmarshal(*v, &customDomainPropertiesParameters)
146				if err != nil {
147					return err
148				}
149				cdp.CustomDomainPropertiesParameters = &customDomainPropertiesParameters
150			}
151		}
152	}
153
154	return nil
155}
156
157// CustomDomainProperties ...
158type CustomDomainProperties struct {
159	// HostName - The host name of the custom domain. Must be a domain name.
160	HostName *string `json:"hostName,omitempty"`
161	// ResourceState - READ-ONLY; Resource status of the custom domain. Possible values include: 'Creating', 'Active', 'Deleting'
162	ResourceState CustomDomainResourceState `json:"resourceState,omitempty"`
163	// ProvisioningState - Provisioning status of the custom domain. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed'
164	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
165}
166
167// MarshalJSON is the custom marshaler for CustomDomainProperties.
168func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) {
169	objectMap := make(map[string]interface{})
170	if cdp.HostName != nil {
171		objectMap["hostName"] = cdp.HostName
172	}
173	if cdp.ProvisioningState != "" {
174		objectMap["provisioningState"] = cdp.ProvisioningState
175	}
176	return json.Marshal(objectMap)
177}
178
179// CustomDomainPropertiesParameters ...
180type CustomDomainPropertiesParameters struct {
181	// HostName - The host name of the custom domain. Must be a domain name.
182	HostName *string `json:"hostName,omitempty"`
183}
184
185// CustomDomainsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
186// operation.
187type CustomDomainsCreateFuture struct {
188	azure.FutureAPI
189	// Result returns the result of the asynchronous operation.
190	// If the operation has not completed it will return an error.
191	Result func(CustomDomainsClient) (CustomDomain, error)
192}
193
194// UnmarshalJSON is the custom unmarshaller for CreateFuture.
195func (future *CustomDomainsCreateFuture) UnmarshalJSON(body []byte) error {
196	var azFuture azure.Future
197	if err := json.Unmarshal(body, &azFuture); err != nil {
198		return err
199	}
200	future.FutureAPI = &azFuture
201	future.Result = future.result
202	return nil
203}
204
205// result is the default implementation for CustomDomainsCreateFuture.Result.
206func (future *CustomDomainsCreateFuture) result(client CustomDomainsClient) (cd CustomDomain, err error) {
207	var done bool
208	done, err = future.DoneWithContext(context.Background(), client)
209	if err != nil {
210		err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", future.Response(), "Polling failure")
211		return
212	}
213	if !done {
214		cd.Response.Response = future.Response()
215		err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsCreateFuture")
216		return
217	}
218	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
219	if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent {
220		cd, err = client.CreateResponder(cd.Response.Response)
221		if err != nil {
222			err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", cd.Response.Response, "Failure responding to request")
223		}
224	}
225	return
226}
227
228// CustomDomainsDeleteIfExistsFuture an abstraction for monitoring and retrieving the results of a
229// long-running operation.
230type CustomDomainsDeleteIfExistsFuture struct {
231	azure.FutureAPI
232	// Result returns the result of the asynchronous operation.
233	// If the operation has not completed it will return an error.
234	Result func(CustomDomainsClient) (CustomDomain, error)
235}
236
237// UnmarshalJSON is the custom unmarshaller for CreateFuture.
238func (future *CustomDomainsDeleteIfExistsFuture) UnmarshalJSON(body []byte) error {
239	var azFuture azure.Future
240	if err := json.Unmarshal(body, &azFuture); err != nil {
241		return err
242	}
243	future.FutureAPI = &azFuture
244	future.Result = future.result
245	return nil
246}
247
248// result is the default implementation for CustomDomainsDeleteIfExistsFuture.Result.
249func (future *CustomDomainsDeleteIfExistsFuture) result(client CustomDomainsClient) (cd CustomDomain, err error) {
250	var done bool
251	done, err = future.DoneWithContext(context.Background(), client)
252	if err != nil {
253		err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteIfExistsFuture", "Result", future.Response(), "Polling failure")
254		return
255	}
256	if !done {
257		cd.Response.Response = future.Response()
258		err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsDeleteIfExistsFuture")
259		return
260	}
261	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
262	if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent {
263		cd, err = client.DeleteIfExistsResponder(cd.Response.Response)
264		if err != nil {
265			err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteIfExistsFuture", "Result", cd.Response.Response, "Failure responding to request")
266		}
267	}
268	return
269}
270
271// DeepCreatedOrigin deep created origins within a CDN endpoint.
272type DeepCreatedOrigin struct {
273	// Name - Origin name
274	Name                         *string `json:"name,omitempty"`
275	*DeepCreatedOriginProperties `json:"properties,omitempty"`
276}
277
278// MarshalJSON is the custom marshaler for DeepCreatedOrigin.
279func (dco DeepCreatedOrigin) MarshalJSON() ([]byte, error) {
280	objectMap := make(map[string]interface{})
281	if dco.Name != nil {
282		objectMap["name"] = dco.Name
283	}
284	if dco.DeepCreatedOriginProperties != nil {
285		objectMap["properties"] = dco.DeepCreatedOriginProperties
286	}
287	return json.Marshal(objectMap)
288}
289
290// UnmarshalJSON is the custom unmarshaler for DeepCreatedOrigin struct.
291func (dco *DeepCreatedOrigin) UnmarshalJSON(body []byte) error {
292	var m map[string]*json.RawMessage
293	err := json.Unmarshal(body, &m)
294	if err != nil {
295		return err
296	}
297	for k, v := range m {
298		switch k {
299		case "name":
300			if v != nil {
301				var name string
302				err = json.Unmarshal(*v, &name)
303				if err != nil {
304					return err
305				}
306				dco.Name = &name
307			}
308		case "properties":
309			if v != nil {
310				var deepCreatedOriginProperties DeepCreatedOriginProperties
311				err = json.Unmarshal(*v, &deepCreatedOriginProperties)
312				if err != nil {
313					return err
314				}
315				dco.DeepCreatedOriginProperties = &deepCreatedOriginProperties
316			}
317		}
318	}
319
320	return nil
321}
322
323// DeepCreatedOriginProperties properties of deep created origin on a CDN endpoint.
324type DeepCreatedOriginProperties struct {
325	// HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.
326	HostName *string `json:"hostName,omitempty"`
327	// HTTPPort - The value of the HTTP port. Must be between 1 and 65535
328	HTTPPort *int32 `json:"httpPort,omitempty"`
329	// HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535
330	HTTPSPort *int32 `json:"httpsPort,omitempty"`
331}
332
333// Endpoint CDN endpoint is the entity within a CDN profile containing configuration information regarding
334// caching behaviors and origins. The CDN endpoint is exposed using the URL format
335// <endpointname>.azureedge.net by default, but custom domains can also be created.
336type Endpoint struct {
337	autorest.Response   `json:"-"`
338	*EndpointProperties `json:"properties,omitempty"`
339	// Location - Resource location
340	Location *string `json:"location,omitempty"`
341	// Tags - Resource tags
342	Tags map[string]*string `json:"tags"`
343	// ID - READ-ONLY; Resource ID
344	ID *string `json:"id,omitempty"`
345	// Name - READ-ONLY; Resource name
346	Name *string `json:"name,omitempty"`
347	// Type - READ-ONLY; Resource type
348	Type *string `json:"type,omitempty"`
349}
350
351// MarshalJSON is the custom marshaler for Endpoint.
352func (e Endpoint) MarshalJSON() ([]byte, error) {
353	objectMap := make(map[string]interface{})
354	if e.EndpointProperties != nil {
355		objectMap["properties"] = e.EndpointProperties
356	}
357	if e.Location != nil {
358		objectMap["location"] = e.Location
359	}
360	if e.Tags != nil {
361		objectMap["tags"] = e.Tags
362	}
363	return json.Marshal(objectMap)
364}
365
366// UnmarshalJSON is the custom unmarshaler for Endpoint struct.
367func (e *Endpoint) UnmarshalJSON(body []byte) error {
368	var m map[string]*json.RawMessage
369	err := json.Unmarshal(body, &m)
370	if err != nil {
371		return err
372	}
373	for k, v := range m {
374		switch k {
375		case "properties":
376			if v != nil {
377				var endpointProperties EndpointProperties
378				err = json.Unmarshal(*v, &endpointProperties)
379				if err != nil {
380					return err
381				}
382				e.EndpointProperties = &endpointProperties
383			}
384		case "location":
385			if v != nil {
386				var location string
387				err = json.Unmarshal(*v, &location)
388				if err != nil {
389					return err
390				}
391				e.Location = &location
392			}
393		case "tags":
394			if v != nil {
395				var tags map[string]*string
396				err = json.Unmarshal(*v, &tags)
397				if err != nil {
398					return err
399				}
400				e.Tags = tags
401			}
402		case "id":
403			if v != nil {
404				var ID string
405				err = json.Unmarshal(*v, &ID)
406				if err != nil {
407					return err
408				}
409				e.ID = &ID
410			}
411		case "name":
412			if v != nil {
413				var name string
414				err = json.Unmarshal(*v, &name)
415				if err != nil {
416					return err
417				}
418				e.Name = &name
419			}
420		case "type":
421			if v != nil {
422				var typeVar string
423				err = json.Unmarshal(*v, &typeVar)
424				if err != nil {
425					return err
426				}
427				e.Type = &typeVar
428			}
429		}
430	}
431
432	return nil
433}
434
435// EndpointCreateParameters endpoint properties required for new endpoint creation.
436type EndpointCreateParameters struct {
437	// Location - Endpoint location
438	Location *string `json:"location,omitempty"`
439	// Tags - Endpoint tags
440	Tags                                map[string]*string `json:"tags"`
441	*EndpointPropertiesCreateParameters `json:"properties,omitempty"`
442}
443
444// MarshalJSON is the custom marshaler for EndpointCreateParameters.
445func (ecp EndpointCreateParameters) MarshalJSON() ([]byte, error) {
446	objectMap := make(map[string]interface{})
447	if ecp.Location != nil {
448		objectMap["location"] = ecp.Location
449	}
450	if ecp.Tags != nil {
451		objectMap["tags"] = ecp.Tags
452	}
453	if ecp.EndpointPropertiesCreateParameters != nil {
454		objectMap["properties"] = ecp.EndpointPropertiesCreateParameters
455	}
456	return json.Marshal(objectMap)
457}
458
459// UnmarshalJSON is the custom unmarshaler for EndpointCreateParameters struct.
460func (ecp *EndpointCreateParameters) UnmarshalJSON(body []byte) error {
461	var m map[string]*json.RawMessage
462	err := json.Unmarshal(body, &m)
463	if err != nil {
464		return err
465	}
466	for k, v := range m {
467		switch k {
468		case "location":
469			if v != nil {
470				var location string
471				err = json.Unmarshal(*v, &location)
472				if err != nil {
473					return err
474				}
475				ecp.Location = &location
476			}
477		case "tags":
478			if v != nil {
479				var tags map[string]*string
480				err = json.Unmarshal(*v, &tags)
481				if err != nil {
482					return err
483				}
484				ecp.Tags = tags
485			}
486		case "properties":
487			if v != nil {
488				var endpointPropertiesCreateParameters EndpointPropertiesCreateParameters
489				err = json.Unmarshal(*v, &endpointPropertiesCreateParameters)
490				if err != nil {
491					return err
492				}
493				ecp.EndpointPropertiesCreateParameters = &endpointPropertiesCreateParameters
494			}
495		}
496	}
497
498	return nil
499}
500
501// EndpointListResult ...
502type EndpointListResult struct {
503	autorest.Response `json:"-"`
504	// Value - List of CDN endpoints within a profile
505	Value *[]Endpoint `json:"value,omitempty"`
506}
507
508// EndpointProperties ...
509type EndpointProperties struct {
510	// HostName - READ-ONLY; The host name of the endpoint {endpointName}.{DNSZone}
511	HostName *string `json:"hostName,omitempty"`
512	// OriginHostHeader - The host header the CDN provider will send along with content requests to origins. The default value is the host name of the origin.
513	OriginHostHeader *string `json:"originHostHeader,omitempty"`
514	// OriginPath - The path used for origin requests.
515	OriginPath *string `json:"originPath,omitempty"`
516	// ContentTypesToCompress - List of content types on which compression will be applied. The value for the elements should be a valid MIME type.
517	ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"`
518	// IsCompressionEnabled - Indicates whether the compression is enabled. Default value is false. If compression is enabled, the content transferred from cdn endpoint to end user will be compressed. The requested content must be larger than 1 byte and smaller than 1 MB.
519	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
520	// IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
521	IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"`
522	// IsHTTPSAllowed - Indicates whether https traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
523	IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"`
524	// QueryStringCachingBehavior - Defines the query string caching behavior. Possible values include: 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'
525	QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"`
526	// Origins - The set of origins for the CDN endpoint. When multiple origins exist, the first origin will be used as primary and rest will be used as failover options.
527	Origins *[]DeepCreatedOrigin `json:"origins,omitempty"`
528	// ResourceState - READ-ONLY; Resource status of the endpoint. Possible values include: 'EndpointResourceStateCreating', 'EndpointResourceStateDeleting', 'EndpointResourceStateRunning', 'EndpointResourceStateStarting', 'EndpointResourceStateStopped', 'EndpointResourceStateStopping'
529	ResourceState EndpointResourceState `json:"resourceState,omitempty"`
530	// ProvisioningState - Provisioning status of the endpoint. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed'
531	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
532}
533
534// MarshalJSON is the custom marshaler for EndpointProperties.
535func (ep EndpointProperties) MarshalJSON() ([]byte, error) {
536	objectMap := make(map[string]interface{})
537	if ep.OriginHostHeader != nil {
538		objectMap["originHostHeader"] = ep.OriginHostHeader
539	}
540	if ep.OriginPath != nil {
541		objectMap["originPath"] = ep.OriginPath
542	}
543	if ep.ContentTypesToCompress != nil {
544		objectMap["contentTypesToCompress"] = ep.ContentTypesToCompress
545	}
546	if ep.IsCompressionEnabled != nil {
547		objectMap["isCompressionEnabled"] = ep.IsCompressionEnabled
548	}
549	if ep.IsHTTPAllowed != nil {
550		objectMap["isHttpAllowed"] = ep.IsHTTPAllowed
551	}
552	if ep.IsHTTPSAllowed != nil {
553		objectMap["isHttpsAllowed"] = ep.IsHTTPSAllowed
554	}
555	if ep.QueryStringCachingBehavior != "" {
556		objectMap["queryStringCachingBehavior"] = ep.QueryStringCachingBehavior
557	}
558	if ep.Origins != nil {
559		objectMap["origins"] = ep.Origins
560	}
561	if ep.ProvisioningState != "" {
562		objectMap["provisioningState"] = ep.ProvisioningState
563	}
564	return json.Marshal(objectMap)
565}
566
567// EndpointPropertiesCreateParameters ...
568type EndpointPropertiesCreateParameters struct {
569	// OriginHostHeader - The host header CDN provider will send along with content requests to origins. The default value is the host name of the origin.
570	OriginHostHeader *string `json:"originHostHeader,omitempty"`
571	// OriginPath - The path used for origin requests.
572	OriginPath *string `json:"originPath,omitempty"`
573	// ContentTypesToCompress - List of content types on which compression will be applied. The value for the elements should be a valid MIME type.
574	ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"`
575	// IsCompressionEnabled - Indicates whether content compression is enabled. Default value is false. If compression is enabled, the content transferred from the CDN endpoint to the end user will be compressed. The requested content must be larger than 1 byte and smaller than 1 MB.
576	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
577	// IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
578	IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"`
579	// IsHTTPSAllowed - Indicates whether https traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
580	IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"`
581	// QueryStringCachingBehavior - Defines the query string caching behavior. Possible values include: 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'
582	QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"`
583	// Origins - The set of origins for the CDN endpoint. When multiple origins exist, the first origin will be used as primary and rest will be used as failover options.
584	Origins *[]DeepCreatedOrigin `json:"origins,omitempty"`
585}
586
587// EndpointPropertiesUpdateParameters ...
588type EndpointPropertiesUpdateParameters struct {
589	// OriginHostHeader - The host header the CDN provider will send along with content requests to origins. The default value is the host name of the origin.
590	OriginHostHeader *string `json:"originHostHeader,omitempty"`
591	// OriginPath - The path used for origin requests.
592	OriginPath *string `json:"originPath,omitempty"`
593	// ContentTypesToCompress - List of content types on which compression will be applied. The value for the elements should be a valid MIME type.
594	ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"`
595	// IsCompressionEnabled - Indicates whether content compression is enabled. Default value is false. If compression is enabled, the content transferred from the CDN endpoint to the end user will be compressed. The requested content must be larger than 1 byte and smaller than 1 MB.
596	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
597	// IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
598	IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"`
599	// IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
600	IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"`
601	// QueryStringCachingBehavior - Defines the query string caching behavior. Possible values include: 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'
602	QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"`
603}
604
605// EndpointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
606// operation.
607type EndpointsCreateFuture struct {
608	azure.FutureAPI
609	// Result returns the result of the asynchronous operation.
610	// If the operation has not completed it will return an error.
611	Result func(EndpointsClient) (Endpoint, error)
612}
613
614// UnmarshalJSON is the custom unmarshaller for CreateFuture.
615func (future *EndpointsCreateFuture) UnmarshalJSON(body []byte) error {
616	var azFuture azure.Future
617	if err := json.Unmarshal(body, &azFuture); err != nil {
618		return err
619	}
620	future.FutureAPI = &azFuture
621	future.Result = future.result
622	return nil
623}
624
625// result is the default implementation for EndpointsCreateFuture.Result.
626func (future *EndpointsCreateFuture) result(client EndpointsClient) (e Endpoint, err error) {
627	var done bool
628	done, err = future.DoneWithContext(context.Background(), client)
629	if err != nil {
630		err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", future.Response(), "Polling failure")
631		return
632	}
633	if !done {
634		e.Response.Response = future.Response()
635		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsCreateFuture")
636		return
637	}
638	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
639	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
640		e, err = client.CreateResponder(e.Response.Response)
641		if err != nil {
642			err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", e.Response.Response, "Failure responding to request")
643		}
644	}
645	return
646}
647
648// EndpointsDeleteIfExistsFuture an abstraction for monitoring and retrieving the results of a long-running
649// operation.
650type EndpointsDeleteIfExistsFuture struct {
651	azure.FutureAPI
652	// Result returns the result of the asynchronous operation.
653	// If the operation has not completed it will return an error.
654	Result func(EndpointsClient) (autorest.Response, error)
655}
656
657// UnmarshalJSON is the custom unmarshaller for CreateFuture.
658func (future *EndpointsDeleteIfExistsFuture) UnmarshalJSON(body []byte) error {
659	var azFuture azure.Future
660	if err := json.Unmarshal(body, &azFuture); err != nil {
661		return err
662	}
663	future.FutureAPI = &azFuture
664	future.Result = future.result
665	return nil
666}
667
668// result is the default implementation for EndpointsDeleteIfExistsFuture.Result.
669func (future *EndpointsDeleteIfExistsFuture) result(client EndpointsClient) (ar autorest.Response, err error) {
670	var done bool
671	done, err = future.DoneWithContext(context.Background(), client)
672	if err != nil {
673		err = autorest.NewErrorWithError(err, "cdn.EndpointsDeleteIfExistsFuture", "Result", future.Response(), "Polling failure")
674		return
675	}
676	if !done {
677		ar.Response = future.Response()
678		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsDeleteIfExistsFuture")
679		return
680	}
681	ar.Response = future.Response()
682	return
683}
684
685// EndpointsLoadContentFuture an abstraction for monitoring and retrieving the results of a long-running
686// operation.
687type EndpointsLoadContentFuture struct {
688	azure.FutureAPI
689	// Result returns the result of the asynchronous operation.
690	// If the operation has not completed it will return an error.
691	Result func(EndpointsClient) (autorest.Response, error)
692}
693
694// UnmarshalJSON is the custom unmarshaller for CreateFuture.
695func (future *EndpointsLoadContentFuture) UnmarshalJSON(body []byte) error {
696	var azFuture azure.Future
697	if err := json.Unmarshal(body, &azFuture); err != nil {
698		return err
699	}
700	future.FutureAPI = &azFuture
701	future.Result = future.result
702	return nil
703}
704
705// result is the default implementation for EndpointsLoadContentFuture.Result.
706func (future *EndpointsLoadContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) {
707	var done bool
708	done, err = future.DoneWithContext(context.Background(), client)
709	if err != nil {
710		err = autorest.NewErrorWithError(err, "cdn.EndpointsLoadContentFuture", "Result", future.Response(), "Polling failure")
711		return
712	}
713	if !done {
714		ar.Response = future.Response()
715		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsLoadContentFuture")
716		return
717	}
718	ar.Response = future.Response()
719	return
720}
721
722// EndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a long-running
723// operation.
724type EndpointsPurgeContentFuture struct {
725	azure.FutureAPI
726	// Result returns the result of the asynchronous operation.
727	// If the operation has not completed it will return an error.
728	Result func(EndpointsClient) (autorest.Response, error)
729}
730
731// UnmarshalJSON is the custom unmarshaller for CreateFuture.
732func (future *EndpointsPurgeContentFuture) UnmarshalJSON(body []byte) error {
733	var azFuture azure.Future
734	if err := json.Unmarshal(body, &azFuture); err != nil {
735		return err
736	}
737	future.FutureAPI = &azFuture
738	future.Result = future.result
739	return nil
740}
741
742// result is the default implementation for EndpointsPurgeContentFuture.Result.
743func (future *EndpointsPurgeContentFuture) result(client EndpointsClient) (ar autorest.Response, err error) {
744	var done bool
745	done, err = future.DoneWithContext(context.Background(), client)
746	if err != nil {
747		err = autorest.NewErrorWithError(err, "cdn.EndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure")
748		return
749	}
750	if !done {
751		ar.Response = future.Response()
752		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsPurgeContentFuture")
753		return
754	}
755	ar.Response = future.Response()
756	return
757}
758
759// EndpointsStartFuture an abstraction for monitoring and retrieving the results of a long-running
760// operation.
761type EndpointsStartFuture struct {
762	azure.FutureAPI
763	// Result returns the result of the asynchronous operation.
764	// If the operation has not completed it will return an error.
765	Result func(EndpointsClient) (Endpoint, error)
766}
767
768// UnmarshalJSON is the custom unmarshaller for CreateFuture.
769func (future *EndpointsStartFuture) UnmarshalJSON(body []byte) error {
770	var azFuture azure.Future
771	if err := json.Unmarshal(body, &azFuture); err != nil {
772		return err
773	}
774	future.FutureAPI = &azFuture
775	future.Result = future.result
776	return nil
777}
778
779// result is the default implementation for EndpointsStartFuture.Result.
780func (future *EndpointsStartFuture) result(client EndpointsClient) (e Endpoint, err error) {
781	var done bool
782	done, err = future.DoneWithContext(context.Background(), client)
783	if err != nil {
784		err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", future.Response(), "Polling failure")
785		return
786	}
787	if !done {
788		e.Response.Response = future.Response()
789		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStartFuture")
790		return
791	}
792	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
793	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
794		e, err = client.StartResponder(e.Response.Response)
795		if err != nil {
796			err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", e.Response.Response, "Failure responding to request")
797		}
798	}
799	return
800}
801
802// EndpointsStopFuture an abstraction for monitoring and retrieving the results of a long-running
803// operation.
804type EndpointsStopFuture struct {
805	azure.FutureAPI
806	// Result returns the result of the asynchronous operation.
807	// If the operation has not completed it will return an error.
808	Result func(EndpointsClient) (Endpoint, error)
809}
810
811// UnmarshalJSON is the custom unmarshaller for CreateFuture.
812func (future *EndpointsStopFuture) UnmarshalJSON(body []byte) error {
813	var azFuture azure.Future
814	if err := json.Unmarshal(body, &azFuture); err != nil {
815		return err
816	}
817	future.FutureAPI = &azFuture
818	future.Result = future.result
819	return nil
820}
821
822// result is the default implementation for EndpointsStopFuture.Result.
823func (future *EndpointsStopFuture) result(client EndpointsClient) (e Endpoint, err error) {
824	var done bool
825	done, err = future.DoneWithContext(context.Background(), client)
826	if err != nil {
827		err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", future.Response(), "Polling failure")
828		return
829	}
830	if !done {
831		e.Response.Response = future.Response()
832		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStopFuture")
833		return
834	}
835	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
836	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
837		e, err = client.StopResponder(e.Response.Response)
838		if err != nil {
839			err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", e.Response.Response, "Failure responding to request")
840		}
841	}
842	return
843}
844
845// EndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
846// operation.
847type EndpointsUpdateFuture struct {
848	azure.FutureAPI
849	// Result returns the result of the asynchronous operation.
850	// If the operation has not completed it will return an error.
851	Result func(EndpointsClient) (Endpoint, error)
852}
853
854// UnmarshalJSON is the custom unmarshaller for CreateFuture.
855func (future *EndpointsUpdateFuture) UnmarshalJSON(body []byte) error {
856	var azFuture azure.Future
857	if err := json.Unmarshal(body, &azFuture); err != nil {
858		return err
859	}
860	future.FutureAPI = &azFuture
861	future.Result = future.result
862	return nil
863}
864
865// result is the default implementation for EndpointsUpdateFuture.Result.
866func (future *EndpointsUpdateFuture) result(client EndpointsClient) (e Endpoint, err error) {
867	var done bool
868	done, err = future.DoneWithContext(context.Background(), client)
869	if err != nil {
870		err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", future.Response(), "Polling failure")
871		return
872	}
873	if !done {
874		e.Response.Response = future.Response()
875		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsUpdateFuture")
876		return
877	}
878	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
879	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
880		e, err = client.UpdateResponder(e.Response.Response)
881		if err != nil {
882			err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", e.Response.Response, "Failure responding to request")
883		}
884	}
885	return
886}
887
888// EndpointUpdateParameters endpoint properties required for new endpoint creation.
889type EndpointUpdateParameters struct {
890	// Tags - Endpoint tags
891	Tags                                map[string]*string `json:"tags"`
892	*EndpointPropertiesUpdateParameters `json:"properties,omitempty"`
893}
894
895// MarshalJSON is the custom marshaler for EndpointUpdateParameters.
896func (eup EndpointUpdateParameters) MarshalJSON() ([]byte, error) {
897	objectMap := make(map[string]interface{})
898	if eup.Tags != nil {
899		objectMap["tags"] = eup.Tags
900	}
901	if eup.EndpointPropertiesUpdateParameters != nil {
902		objectMap["properties"] = eup.EndpointPropertiesUpdateParameters
903	}
904	return json.Marshal(objectMap)
905}
906
907// UnmarshalJSON is the custom unmarshaler for EndpointUpdateParameters struct.
908func (eup *EndpointUpdateParameters) UnmarshalJSON(body []byte) error {
909	var m map[string]*json.RawMessage
910	err := json.Unmarshal(body, &m)
911	if err != nil {
912		return err
913	}
914	for k, v := range m {
915		switch k {
916		case "tags":
917			if v != nil {
918				var tags map[string]*string
919				err = json.Unmarshal(*v, &tags)
920				if err != nil {
921					return err
922				}
923				eup.Tags = tags
924			}
925		case "properties":
926			if v != nil {
927				var endpointPropertiesUpdateParameters EndpointPropertiesUpdateParameters
928				err = json.Unmarshal(*v, &endpointPropertiesUpdateParameters)
929				if err != nil {
930					return err
931				}
932				eup.EndpointPropertiesUpdateParameters = &endpointPropertiesUpdateParameters
933			}
934		}
935	}
936
937	return nil
938}
939
940// ErrorResponse ...
941type ErrorResponse struct {
942	// Code - Error code
943	Code *string `json:"code,omitempty"`
944	// Message - Error message indicating why the operation failed.
945	Message *string `json:"message,omitempty"`
946}
947
948// LoadParameters parameters required for endpoint load.
949type LoadParameters struct {
950	// ContentPaths - The path to the content to be loaded. Should describe a file path.
951	ContentPaths *[]string `json:"contentPaths,omitempty"`
952}
953
954// Operation CDN REST API operation
955type Operation struct {
956	// Name - Operation name: {provider}/{resource}/{operation}
957	Name    *string           `json:"name,omitempty"`
958	Display *OperationDisplay `json:"display,omitempty"`
959}
960
961// OperationDisplay ...
962type OperationDisplay struct {
963	// Provider - Service provider: Microsoft.Cdn
964	Provider *string `json:"provider,omitempty"`
965	// Resource - Resource on which the operation is performed: Profile, endpoint, etc.
966	Resource *string `json:"resource,omitempty"`
967	// Operation - Operation type: Read, write, delete, etc.
968	Operation *string `json:"operation,omitempty"`
969}
970
971// OperationListResult ...
972type OperationListResult struct {
973	autorest.Response `json:"-"`
974	// Value - List of CDN operations supported by the CDN resource provider.
975	Value *[]Operation `json:"value,omitempty"`
976}
977
978// Origin CDN origin is the source of the content being delivered via CDN. When the edge nodes represented
979// by an endpoint do not have the requested content cached, they attempt to fetch it from one or more of
980// the configured origins.
981type Origin struct {
982	autorest.Response `json:"-"`
983	*OriginProperties `json:"properties,omitempty"`
984	// ID - READ-ONLY; Resource ID
985	ID *string `json:"id,omitempty"`
986	// Name - READ-ONLY; Resource name
987	Name *string `json:"name,omitempty"`
988	// Type - READ-ONLY; Resource type
989	Type *string `json:"type,omitempty"`
990}
991
992// MarshalJSON is the custom marshaler for Origin.
993func (o Origin) MarshalJSON() ([]byte, error) {
994	objectMap := make(map[string]interface{})
995	if o.OriginProperties != nil {
996		objectMap["properties"] = o.OriginProperties
997	}
998	return json.Marshal(objectMap)
999}
1000
1001// UnmarshalJSON is the custom unmarshaler for Origin struct.
1002func (o *Origin) UnmarshalJSON(body []byte) error {
1003	var m map[string]*json.RawMessage
1004	err := json.Unmarshal(body, &m)
1005	if err != nil {
1006		return err
1007	}
1008	for k, v := range m {
1009		switch k {
1010		case "properties":
1011			if v != nil {
1012				var originProperties OriginProperties
1013				err = json.Unmarshal(*v, &originProperties)
1014				if err != nil {
1015					return err
1016				}
1017				o.OriginProperties = &originProperties
1018			}
1019		case "id":
1020			if v != nil {
1021				var ID string
1022				err = json.Unmarshal(*v, &ID)
1023				if err != nil {
1024					return err
1025				}
1026				o.ID = &ID
1027			}
1028		case "name":
1029			if v != nil {
1030				var name string
1031				err = json.Unmarshal(*v, &name)
1032				if err != nil {
1033					return err
1034				}
1035				o.Name = &name
1036			}
1037		case "type":
1038			if v != nil {
1039				var typeVar string
1040				err = json.Unmarshal(*v, &typeVar)
1041				if err != nil {
1042					return err
1043				}
1044				o.Type = &typeVar
1045			}
1046		}
1047	}
1048
1049	return nil
1050}
1051
1052// OriginListResult ...
1053type OriginListResult struct {
1054	autorest.Response `json:"-"`
1055	// Value - List of CDN origins within an endpoint
1056	Value *[]Origin `json:"value,omitempty"`
1057}
1058
1059// OriginParameters origin properties needed for origin creation or update.
1060type OriginParameters struct {
1061	*OriginPropertiesParameters `json:"properties,omitempty"`
1062}
1063
1064// MarshalJSON is the custom marshaler for OriginParameters.
1065func (op OriginParameters) MarshalJSON() ([]byte, error) {
1066	objectMap := make(map[string]interface{})
1067	if op.OriginPropertiesParameters != nil {
1068		objectMap["properties"] = op.OriginPropertiesParameters
1069	}
1070	return json.Marshal(objectMap)
1071}
1072
1073// UnmarshalJSON is the custom unmarshaler for OriginParameters struct.
1074func (op *OriginParameters) UnmarshalJSON(body []byte) error {
1075	var m map[string]*json.RawMessage
1076	err := json.Unmarshal(body, &m)
1077	if err != nil {
1078		return err
1079	}
1080	for k, v := range m {
1081		switch k {
1082		case "properties":
1083			if v != nil {
1084				var originPropertiesParameters OriginPropertiesParameters
1085				err = json.Unmarshal(*v, &originPropertiesParameters)
1086				if err != nil {
1087					return err
1088				}
1089				op.OriginPropertiesParameters = &originPropertiesParameters
1090			}
1091		}
1092	}
1093
1094	return nil
1095}
1096
1097// OriginProperties ...
1098type OriginProperties struct {
1099	// HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.
1100	HostName *string `json:"hostName,omitempty"`
1101	// HTTPPort - The value of the HTTP port. Must be between 1 and 65535.
1102	HTTPPort *int32 `json:"httpPort,omitempty"`
1103	// HTTPSPort - The value of the https port. Must be between 1 and 65535.
1104	HTTPSPort *int32 `json:"httpsPort,omitempty"`
1105	// ResourceState - READ-ONLY; Resource status of the origin. Possible values include: 'OriginResourceStateCreating', 'OriginResourceStateActive', 'OriginResourceStateDeleting'
1106	ResourceState OriginResourceState `json:"resourceState,omitempty"`
1107	// ProvisioningState - Provisioning status of the origin. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed'
1108	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1109}
1110
1111// MarshalJSON is the custom marshaler for OriginProperties.
1112func (op OriginProperties) MarshalJSON() ([]byte, error) {
1113	objectMap := make(map[string]interface{})
1114	if op.HostName != nil {
1115		objectMap["hostName"] = op.HostName
1116	}
1117	if op.HTTPPort != nil {
1118		objectMap["httpPort"] = op.HTTPPort
1119	}
1120	if op.HTTPSPort != nil {
1121		objectMap["httpsPort"] = op.HTTPSPort
1122	}
1123	if op.ProvisioningState != "" {
1124		objectMap["provisioningState"] = op.ProvisioningState
1125	}
1126	return json.Marshal(objectMap)
1127}
1128
1129// OriginPropertiesParameters ...
1130type OriginPropertiesParameters struct {
1131	// HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.
1132	HostName *string `json:"hostName,omitempty"`
1133	// HTTPPort - The value of the HTTP port. Must be between 1 and 65535.
1134	HTTPPort *int32 `json:"httpPort,omitempty"`
1135	// HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535.
1136	HTTPSPort *int32 `json:"httpsPort,omitempty"`
1137}
1138
1139// OriginsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
1140// operation.
1141type OriginsCreateFuture struct {
1142	azure.FutureAPI
1143	// Result returns the result of the asynchronous operation.
1144	// If the operation has not completed it will return an error.
1145	Result func(OriginsClient) (Origin, error)
1146}
1147
1148// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1149func (future *OriginsCreateFuture) UnmarshalJSON(body []byte) error {
1150	var azFuture azure.Future
1151	if err := json.Unmarshal(body, &azFuture); err != nil {
1152		return err
1153	}
1154	future.FutureAPI = &azFuture
1155	future.Result = future.result
1156	return nil
1157}
1158
1159// result is the default implementation for OriginsCreateFuture.Result.
1160func (future *OriginsCreateFuture) result(client OriginsClient) (o Origin, err error) {
1161	var done bool
1162	done, err = future.DoneWithContext(context.Background(), client)
1163	if err != nil {
1164		err = autorest.NewErrorWithError(err, "cdn.OriginsCreateFuture", "Result", future.Response(), "Polling failure")
1165		return
1166	}
1167	if !done {
1168		o.Response.Response = future.Response()
1169		err = azure.NewAsyncOpIncompleteError("cdn.OriginsCreateFuture")
1170		return
1171	}
1172	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1173	if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent {
1174		o, err = client.CreateResponder(o.Response.Response)
1175		if err != nil {
1176			err = autorest.NewErrorWithError(err, "cdn.OriginsCreateFuture", "Result", o.Response.Response, "Failure responding to request")
1177		}
1178	}
1179	return
1180}
1181
1182// OriginsDeleteIfExistsFuture an abstraction for monitoring and retrieving the results of a long-running
1183// operation.
1184type OriginsDeleteIfExistsFuture struct {
1185	azure.FutureAPI
1186	// Result returns the result of the asynchronous operation.
1187	// If the operation has not completed it will return an error.
1188	Result func(OriginsClient) (Origin, error)
1189}
1190
1191// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1192func (future *OriginsDeleteIfExistsFuture) UnmarshalJSON(body []byte) error {
1193	var azFuture azure.Future
1194	if err := json.Unmarshal(body, &azFuture); err != nil {
1195		return err
1196	}
1197	future.FutureAPI = &azFuture
1198	future.Result = future.result
1199	return nil
1200}
1201
1202// result is the default implementation for OriginsDeleteIfExistsFuture.Result.
1203func (future *OriginsDeleteIfExistsFuture) result(client OriginsClient) (o Origin, err error) {
1204	var done bool
1205	done, err = future.DoneWithContext(context.Background(), client)
1206	if err != nil {
1207		err = autorest.NewErrorWithError(err, "cdn.OriginsDeleteIfExistsFuture", "Result", future.Response(), "Polling failure")
1208		return
1209	}
1210	if !done {
1211		o.Response.Response = future.Response()
1212		err = azure.NewAsyncOpIncompleteError("cdn.OriginsDeleteIfExistsFuture")
1213		return
1214	}
1215	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1216	if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent {
1217		o, err = client.DeleteIfExistsResponder(o.Response.Response)
1218		if err != nil {
1219			err = autorest.NewErrorWithError(err, "cdn.OriginsDeleteIfExistsFuture", "Result", o.Response.Response, "Failure responding to request")
1220		}
1221	}
1222	return
1223}
1224
1225// OriginsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1226// operation.
1227type OriginsUpdateFuture struct {
1228	azure.FutureAPI
1229	// Result returns the result of the asynchronous operation.
1230	// If the operation has not completed it will return an error.
1231	Result func(OriginsClient) (Origin, error)
1232}
1233
1234// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1235func (future *OriginsUpdateFuture) UnmarshalJSON(body []byte) error {
1236	var azFuture azure.Future
1237	if err := json.Unmarshal(body, &azFuture); err != nil {
1238		return err
1239	}
1240	future.FutureAPI = &azFuture
1241	future.Result = future.result
1242	return nil
1243}
1244
1245// result is the default implementation for OriginsUpdateFuture.Result.
1246func (future *OriginsUpdateFuture) result(client OriginsClient) (o Origin, err error) {
1247	var done bool
1248	done, err = future.DoneWithContext(context.Background(), client)
1249	if err != nil {
1250		err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", future.Response(), "Polling failure")
1251		return
1252	}
1253	if !done {
1254		o.Response.Response = future.Response()
1255		err = azure.NewAsyncOpIncompleteError("cdn.OriginsUpdateFuture")
1256		return
1257	}
1258	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1259	if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent {
1260		o, err = client.UpdateResponder(o.Response.Response)
1261		if err != nil {
1262			err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", o.Response.Response, "Failure responding to request")
1263		}
1264	}
1265	return
1266}
1267
1268// Profile CDN profile represents the top level resource and the entry point into the CDN API. This allows
1269// users to set up a logical grouping of endpoints in addition to creating shared configuration settings
1270// and selecting pricing tiers and providers.
1271type Profile struct {
1272	autorest.Response  `json:"-"`
1273	*ProfileProperties `json:"properties,omitempty"`
1274	// Location - Resource location
1275	Location *string `json:"location,omitempty"`
1276	// Tags - Resource tags
1277	Tags map[string]*string `json:"tags"`
1278	// ID - READ-ONLY; Resource ID
1279	ID *string `json:"id,omitempty"`
1280	// Name - READ-ONLY; Resource name
1281	Name *string `json:"name,omitempty"`
1282	// Type - READ-ONLY; Resource type
1283	Type *string `json:"type,omitempty"`
1284}
1285
1286// MarshalJSON is the custom marshaler for Profile.
1287func (p Profile) MarshalJSON() ([]byte, error) {
1288	objectMap := make(map[string]interface{})
1289	if p.ProfileProperties != nil {
1290		objectMap["properties"] = p.ProfileProperties
1291	}
1292	if p.Location != nil {
1293		objectMap["location"] = p.Location
1294	}
1295	if p.Tags != nil {
1296		objectMap["tags"] = p.Tags
1297	}
1298	return json.Marshal(objectMap)
1299}
1300
1301// UnmarshalJSON is the custom unmarshaler for Profile struct.
1302func (p *Profile) UnmarshalJSON(body []byte) error {
1303	var m map[string]*json.RawMessage
1304	err := json.Unmarshal(body, &m)
1305	if err != nil {
1306		return err
1307	}
1308	for k, v := range m {
1309		switch k {
1310		case "properties":
1311			if v != nil {
1312				var profileProperties ProfileProperties
1313				err = json.Unmarshal(*v, &profileProperties)
1314				if err != nil {
1315					return err
1316				}
1317				p.ProfileProperties = &profileProperties
1318			}
1319		case "location":
1320			if v != nil {
1321				var location string
1322				err = json.Unmarshal(*v, &location)
1323				if err != nil {
1324					return err
1325				}
1326				p.Location = &location
1327			}
1328		case "tags":
1329			if v != nil {
1330				var tags map[string]*string
1331				err = json.Unmarshal(*v, &tags)
1332				if err != nil {
1333					return err
1334				}
1335				p.Tags = tags
1336			}
1337		case "id":
1338			if v != nil {
1339				var ID string
1340				err = json.Unmarshal(*v, &ID)
1341				if err != nil {
1342					return err
1343				}
1344				p.ID = &ID
1345			}
1346		case "name":
1347			if v != nil {
1348				var name string
1349				err = json.Unmarshal(*v, &name)
1350				if err != nil {
1351					return err
1352				}
1353				p.Name = &name
1354			}
1355		case "type":
1356			if v != nil {
1357				var typeVar string
1358				err = json.Unmarshal(*v, &typeVar)
1359				if err != nil {
1360					return err
1361				}
1362				p.Type = &typeVar
1363			}
1364		}
1365	}
1366
1367	return nil
1368}
1369
1370// ProfileCreateParameters profile properties required for profile creation.
1371type ProfileCreateParameters struct {
1372	// Location - Profile location
1373	Location *string `json:"location,omitempty"`
1374	// Tags - Profile tags
1375	Tags                               map[string]*string `json:"tags"`
1376	*ProfilePropertiesCreateParameters `json:"properties,omitempty"`
1377}
1378
1379// MarshalJSON is the custom marshaler for ProfileCreateParameters.
1380func (pcp ProfileCreateParameters) MarshalJSON() ([]byte, error) {
1381	objectMap := make(map[string]interface{})
1382	if pcp.Location != nil {
1383		objectMap["location"] = pcp.Location
1384	}
1385	if pcp.Tags != nil {
1386		objectMap["tags"] = pcp.Tags
1387	}
1388	if pcp.ProfilePropertiesCreateParameters != nil {
1389		objectMap["properties"] = pcp.ProfilePropertiesCreateParameters
1390	}
1391	return json.Marshal(objectMap)
1392}
1393
1394// UnmarshalJSON is the custom unmarshaler for ProfileCreateParameters struct.
1395func (pcp *ProfileCreateParameters) UnmarshalJSON(body []byte) error {
1396	var m map[string]*json.RawMessage
1397	err := json.Unmarshal(body, &m)
1398	if err != nil {
1399		return err
1400	}
1401	for k, v := range m {
1402		switch k {
1403		case "location":
1404			if v != nil {
1405				var location string
1406				err = json.Unmarshal(*v, &location)
1407				if err != nil {
1408					return err
1409				}
1410				pcp.Location = &location
1411			}
1412		case "tags":
1413			if v != nil {
1414				var tags map[string]*string
1415				err = json.Unmarshal(*v, &tags)
1416				if err != nil {
1417					return err
1418				}
1419				pcp.Tags = tags
1420			}
1421		case "properties":
1422			if v != nil {
1423				var profilePropertiesCreateParameters ProfilePropertiesCreateParameters
1424				err = json.Unmarshal(*v, &profilePropertiesCreateParameters)
1425				if err != nil {
1426					return err
1427				}
1428				pcp.ProfilePropertiesCreateParameters = &profilePropertiesCreateParameters
1429			}
1430		}
1431	}
1432
1433	return nil
1434}
1435
1436// ProfileListResult ...
1437type ProfileListResult struct {
1438	autorest.Response `json:"-"`
1439	// Value - List of CDN profiles within a resource group.
1440	Value *[]Profile `json:"value,omitempty"`
1441}
1442
1443// ProfileProperties ...
1444type ProfileProperties struct {
1445	// Sku - The SKU (pricing tier) of the CDN profile.
1446	Sku *Sku `json:"sku,omitempty"`
1447	// ResourceState - READ-ONLY; Resource status of the profile. Possible values include: 'ProfileResourceStateCreating', 'ProfileResourceStateActive', 'ProfileResourceStateDeleting', 'ProfileResourceStateDisabled'
1448	ResourceState ProfileResourceState `json:"resourceState,omitempty"`
1449	// ProvisioningState - Provisioning status of the profile. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed'
1450	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
1451}
1452
1453// MarshalJSON is the custom marshaler for ProfileProperties.
1454func (pp ProfileProperties) MarshalJSON() ([]byte, error) {
1455	objectMap := make(map[string]interface{})
1456	if pp.Sku != nil {
1457		objectMap["sku"] = pp.Sku
1458	}
1459	if pp.ProvisioningState != "" {
1460		objectMap["provisioningState"] = pp.ProvisioningState
1461	}
1462	return json.Marshal(objectMap)
1463}
1464
1465// ProfilePropertiesCreateParameters ...
1466type ProfilePropertiesCreateParameters struct {
1467	// Sku - Profile SKU
1468	Sku *Sku `json:"sku,omitempty"`
1469}
1470
1471// ProfilesCreateFuture an abstraction for monitoring and retrieving the results of a long-running
1472// operation.
1473type ProfilesCreateFuture struct {
1474	azure.FutureAPI
1475	// Result returns the result of the asynchronous operation.
1476	// If the operation has not completed it will return an error.
1477	Result func(ProfilesClient) (Profile, error)
1478}
1479
1480// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1481func (future *ProfilesCreateFuture) UnmarshalJSON(body []byte) error {
1482	var azFuture azure.Future
1483	if err := json.Unmarshal(body, &azFuture); err != nil {
1484		return err
1485	}
1486	future.FutureAPI = &azFuture
1487	future.Result = future.result
1488	return nil
1489}
1490
1491// result is the default implementation for ProfilesCreateFuture.Result.
1492func (future *ProfilesCreateFuture) result(client ProfilesClient) (p Profile, err error) {
1493	var done bool
1494	done, err = future.DoneWithContext(context.Background(), client)
1495	if err != nil {
1496		err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", future.Response(), "Polling failure")
1497		return
1498	}
1499	if !done {
1500		p.Response.Response = future.Response()
1501		err = azure.NewAsyncOpIncompleteError("cdn.ProfilesCreateFuture")
1502		return
1503	}
1504	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1505	if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent {
1506		p, err = client.CreateResponder(p.Response.Response)
1507		if err != nil {
1508			err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", p.Response.Response, "Failure responding to request")
1509		}
1510	}
1511	return
1512}
1513
1514// ProfilesDeleteIfExistsFuture an abstraction for monitoring and retrieving the results of a long-running
1515// operation.
1516type ProfilesDeleteIfExistsFuture struct {
1517	azure.FutureAPI
1518	// Result returns the result of the asynchronous operation.
1519	// If the operation has not completed it will return an error.
1520	Result func(ProfilesClient) (autorest.Response, error)
1521}
1522
1523// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1524func (future *ProfilesDeleteIfExistsFuture) UnmarshalJSON(body []byte) error {
1525	var azFuture azure.Future
1526	if err := json.Unmarshal(body, &azFuture); err != nil {
1527		return err
1528	}
1529	future.FutureAPI = &azFuture
1530	future.Result = future.result
1531	return nil
1532}
1533
1534// result is the default implementation for ProfilesDeleteIfExistsFuture.Result.
1535func (future *ProfilesDeleteIfExistsFuture) result(client ProfilesClient) (ar autorest.Response, err error) {
1536	var done bool
1537	done, err = future.DoneWithContext(context.Background(), client)
1538	if err != nil {
1539		err = autorest.NewErrorWithError(err, "cdn.ProfilesDeleteIfExistsFuture", "Result", future.Response(), "Polling failure")
1540		return
1541	}
1542	if !done {
1543		ar.Response = future.Response()
1544		err = azure.NewAsyncOpIncompleteError("cdn.ProfilesDeleteIfExistsFuture")
1545		return
1546	}
1547	ar.Response = future.Response()
1548	return
1549}
1550
1551// ProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
1552// operation.
1553type ProfilesUpdateFuture struct {
1554	azure.FutureAPI
1555	// Result returns the result of the asynchronous operation.
1556	// If the operation has not completed it will return an error.
1557	Result func(ProfilesClient) (Profile, error)
1558}
1559
1560// UnmarshalJSON is the custom unmarshaller for CreateFuture.
1561func (future *ProfilesUpdateFuture) UnmarshalJSON(body []byte) error {
1562	var azFuture azure.Future
1563	if err := json.Unmarshal(body, &azFuture); err != nil {
1564		return err
1565	}
1566	future.FutureAPI = &azFuture
1567	future.Result = future.result
1568	return nil
1569}
1570
1571// result is the default implementation for ProfilesUpdateFuture.Result.
1572func (future *ProfilesUpdateFuture) result(client ProfilesClient) (p Profile, err error) {
1573	var done bool
1574	done, err = future.DoneWithContext(context.Background(), client)
1575	if err != nil {
1576		err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", future.Response(), "Polling failure")
1577		return
1578	}
1579	if !done {
1580		p.Response.Response = future.Response()
1581		err = azure.NewAsyncOpIncompleteError("cdn.ProfilesUpdateFuture")
1582		return
1583	}
1584	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1585	if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent {
1586		p, err = client.UpdateResponder(p.Response.Response)
1587		if err != nil {
1588			err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request")
1589		}
1590	}
1591	return
1592}
1593
1594// ProfileUpdateParameters profile properties required for profile update.
1595type ProfileUpdateParameters struct {
1596	// Tags - Profile tags
1597	Tags map[string]*string `json:"tags"`
1598}
1599
1600// MarshalJSON is the custom marshaler for ProfileUpdateParameters.
1601func (pup ProfileUpdateParameters) MarshalJSON() ([]byte, error) {
1602	objectMap := make(map[string]interface{})
1603	if pup.Tags != nil {
1604		objectMap["tags"] = pup.Tags
1605	}
1606	return json.Marshal(objectMap)
1607}
1608
1609// PurgeParameters parameters required for endpoint purge.
1610type PurgeParameters struct {
1611	// ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory.
1612	ContentPaths *[]string `json:"contentPaths,omitempty"`
1613}
1614
1615// Resource ...
1616type Resource struct {
1617	// ID - READ-ONLY; Resource ID
1618	ID *string `json:"id,omitempty"`
1619	// Name - READ-ONLY; Resource name
1620	Name *string `json:"name,omitempty"`
1621	// Type - READ-ONLY; Resource type
1622	Type *string `json:"type,omitempty"`
1623}
1624
1625// MarshalJSON is the custom marshaler for Resource.
1626func (r Resource) MarshalJSON() ([]byte, error) {
1627	objectMap := make(map[string]interface{})
1628	return json.Marshal(objectMap)
1629}
1630
1631// Sku the SKU (pricing tier) of the CDN profile.
1632type Sku struct {
1633	// Name - Name of the pricing tier. Possible values include: 'Standard', 'Premium'
1634	Name SkuName `json:"name,omitempty"`
1635}
1636
1637// SsoURI SSO URI required to login to third party web portal.
1638type SsoURI struct {
1639	autorest.Response `json:"-"`
1640	// SsoURIValue - The URI used to login to third party web portal.
1641	SsoURIValue *string `json:"ssoUriValue,omitempty"`
1642}
1643
1644// TrackedResource ARM tracked resource
1645type TrackedResource struct {
1646	// Location - Resource location
1647	Location *string `json:"location,omitempty"`
1648	// Tags - Resource tags
1649	Tags map[string]*string `json:"tags"`
1650	// ID - READ-ONLY; Resource ID
1651	ID *string `json:"id,omitempty"`
1652	// Name - READ-ONLY; Resource name
1653	Name *string `json:"name,omitempty"`
1654	// Type - READ-ONLY; Resource type
1655	Type *string `json:"type,omitempty"`
1656}
1657
1658// MarshalJSON is the custom marshaler for TrackedResource.
1659func (tr TrackedResource) MarshalJSON() ([]byte, error) {
1660	objectMap := make(map[string]interface{})
1661	if tr.Location != nil {
1662		objectMap["location"] = tr.Location
1663	}
1664	if tr.Tags != nil {
1665		objectMap["tags"] = tr.Tags
1666	}
1667	return json.Marshal(objectMap)
1668}
1669
1670// ValidateCustomDomainInput input of the custom domain to be validated.
1671type ValidateCustomDomainInput struct {
1672	// HostName - The host name of the custom domain. Must be a domain name.
1673	HostName *string `json:"hostName,omitempty"`
1674}
1675
1676// ValidateCustomDomainOutput output of custom domain validation.
1677type ValidateCustomDomainOutput struct {
1678	autorest.Response `json:"-"`
1679	// CustomDomainValidated - Indicates whether the custom domain is validated or not.
1680	CustomDomainValidated *bool `json:"customDomainValidated,omitempty"`
1681	// Reason - The reason why the custom domain is not valid.
1682	Reason *string `json:"reason,omitempty"`
1683	// Message - The message describing why the custom domain is not valid.
1684	Message *string `json:"message,omitempty"`
1685}
1686