1package cdn
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/to"
25	"net/http"
26)
27
28// CustomDomainResourceState enumerates the values for custom domain resource state.
29type CustomDomainResourceState string
30
31const (
32	// Active ...
33	Active CustomDomainResourceState = "Active"
34	// Creating ...
35	Creating CustomDomainResourceState = "Creating"
36	// Deleting ...
37	Deleting CustomDomainResourceState = "Deleting"
38)
39
40// PossibleCustomDomainResourceStateValues returns an array of possible values for the CustomDomainResourceState const type.
41func PossibleCustomDomainResourceStateValues() []CustomDomainResourceState {
42	return []CustomDomainResourceState{Active, Creating, Deleting}
43}
44
45// CustomHTTPSProvisioningState enumerates the values for custom https provisioning state.
46type CustomHTTPSProvisioningState string
47
48const (
49	// Disabled ...
50	Disabled CustomHTTPSProvisioningState = "Disabled"
51	// Disabling ...
52	Disabling CustomHTTPSProvisioningState = "Disabling"
53	// Enabled ...
54	Enabled CustomHTTPSProvisioningState = "Enabled"
55	// Enabling ...
56	Enabling CustomHTTPSProvisioningState = "Enabling"
57	// Failed ...
58	Failed CustomHTTPSProvisioningState = "Failed"
59)
60
61// PossibleCustomHTTPSProvisioningStateValues returns an array of possible values for the CustomHTTPSProvisioningState const type.
62func PossibleCustomHTTPSProvisioningStateValues() []CustomHTTPSProvisioningState {
63	return []CustomHTTPSProvisioningState{Disabled, Disabling, Enabled, Enabling, Failed}
64}
65
66// CustomHTTPSProvisioningSubstate enumerates the values for custom https provisioning substate.
67type CustomHTTPSProvisioningSubstate string
68
69const (
70	// CertificateDeleted ...
71	CertificateDeleted CustomHTTPSProvisioningSubstate = "CertificateDeleted"
72	// CertificateDeployed ...
73	CertificateDeployed CustomHTTPSProvisioningSubstate = "CertificateDeployed"
74	// DeletingCertificate ...
75	DeletingCertificate CustomHTTPSProvisioningSubstate = "DeletingCertificate"
76	// DeployingCertificate ...
77	DeployingCertificate CustomHTTPSProvisioningSubstate = "DeployingCertificate"
78	// DomainControlValidationRequestApproved ...
79	DomainControlValidationRequestApproved CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestApproved"
80	// DomainControlValidationRequestRejected ...
81	DomainControlValidationRequestRejected CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestRejected"
82	// DomainControlValidationRequestTimedOut ...
83	DomainControlValidationRequestTimedOut CustomHTTPSProvisioningSubstate = "DomainControlValidationRequestTimedOut"
84	// IssuingCertificate ...
85	IssuingCertificate CustomHTTPSProvisioningSubstate = "IssuingCertificate"
86	// PendingDomainControlValidationREquestApproval ...
87	PendingDomainControlValidationREquestApproval CustomHTTPSProvisioningSubstate = "PendingDomainControlValidationREquestApproval"
88	// SubmittingDomainControlValidationRequest ...
89	SubmittingDomainControlValidationRequest CustomHTTPSProvisioningSubstate = "SubmittingDomainControlValidationRequest"
90)
91
92// PossibleCustomHTTPSProvisioningSubstateValues returns an array of possible values for the CustomHTTPSProvisioningSubstate const type.
93func PossibleCustomHTTPSProvisioningSubstateValues() []CustomHTTPSProvisioningSubstate {
94	return []CustomHTTPSProvisioningSubstate{CertificateDeleted, CertificateDeployed, DeletingCertificate, DeployingCertificate, DomainControlValidationRequestApproved, DomainControlValidationRequestRejected, DomainControlValidationRequestTimedOut, IssuingCertificate, PendingDomainControlValidationREquestApproval, SubmittingDomainControlValidationRequest}
95}
96
97// EndpointResourceState enumerates the values for endpoint resource state.
98type EndpointResourceState string
99
100const (
101	// EndpointResourceStateCreating ...
102	EndpointResourceStateCreating EndpointResourceState = "Creating"
103	// EndpointResourceStateDeleting ...
104	EndpointResourceStateDeleting EndpointResourceState = "Deleting"
105	// EndpointResourceStateRunning ...
106	EndpointResourceStateRunning EndpointResourceState = "Running"
107	// EndpointResourceStateStarting ...
108	EndpointResourceStateStarting EndpointResourceState = "Starting"
109	// EndpointResourceStateStopped ...
110	EndpointResourceStateStopped EndpointResourceState = "Stopped"
111	// EndpointResourceStateStopping ...
112	EndpointResourceStateStopping EndpointResourceState = "Stopping"
113)
114
115// PossibleEndpointResourceStateValues returns an array of possible values for the EndpointResourceState const type.
116func PossibleEndpointResourceStateValues() []EndpointResourceState {
117	return []EndpointResourceState{EndpointResourceStateCreating, EndpointResourceStateDeleting, EndpointResourceStateRunning, EndpointResourceStateStarting, EndpointResourceStateStopped, EndpointResourceStateStopping}
118}
119
120// GeoFilterActions enumerates the values for geo filter actions.
121type GeoFilterActions string
122
123const (
124	// Allow ...
125	Allow GeoFilterActions = "Allow"
126	// Block ...
127	Block GeoFilterActions = "Block"
128)
129
130// PossibleGeoFilterActionsValues returns an array of possible values for the GeoFilterActions const type.
131func PossibleGeoFilterActionsValues() []GeoFilterActions {
132	return []GeoFilterActions{Allow, Block}
133}
134
135// OptimizationType enumerates the values for optimization type.
136type OptimizationType string
137
138const (
139	// DynamicSiteAcceleration ...
140	DynamicSiteAcceleration OptimizationType = "DynamicSiteAcceleration"
141	// GeneralMediaStreaming ...
142	GeneralMediaStreaming OptimizationType = "GeneralMediaStreaming"
143	// GeneralWebDelivery ...
144	GeneralWebDelivery OptimizationType = "GeneralWebDelivery"
145	// LargeFileDownload ...
146	LargeFileDownload OptimizationType = "LargeFileDownload"
147	// VideoOnDemandMediaStreaming ...
148	VideoOnDemandMediaStreaming OptimizationType = "VideoOnDemandMediaStreaming"
149)
150
151// PossibleOptimizationTypeValues returns an array of possible values for the OptimizationType const type.
152func PossibleOptimizationTypeValues() []OptimizationType {
153	return []OptimizationType{DynamicSiteAcceleration, GeneralMediaStreaming, GeneralWebDelivery, LargeFileDownload, VideoOnDemandMediaStreaming}
154}
155
156// OriginResourceState enumerates the values for origin resource state.
157type OriginResourceState string
158
159const (
160	// OriginResourceStateActive ...
161	OriginResourceStateActive OriginResourceState = "Active"
162	// OriginResourceStateCreating ...
163	OriginResourceStateCreating OriginResourceState = "Creating"
164	// OriginResourceStateDeleting ...
165	OriginResourceStateDeleting OriginResourceState = "Deleting"
166)
167
168// PossibleOriginResourceStateValues returns an array of possible values for the OriginResourceState const type.
169func PossibleOriginResourceStateValues() []OriginResourceState {
170	return []OriginResourceState{OriginResourceStateActive, OriginResourceStateCreating, OriginResourceStateDeleting}
171}
172
173// ProfileResourceState enumerates the values for profile resource state.
174type ProfileResourceState string
175
176const (
177	// ProfileResourceStateActive ...
178	ProfileResourceStateActive ProfileResourceState = "Active"
179	// ProfileResourceStateCreating ...
180	ProfileResourceStateCreating ProfileResourceState = "Creating"
181	// ProfileResourceStateDeleting ...
182	ProfileResourceStateDeleting ProfileResourceState = "Deleting"
183	// ProfileResourceStateDisabled ...
184	ProfileResourceStateDisabled ProfileResourceState = "Disabled"
185)
186
187// PossibleProfileResourceStateValues returns an array of possible values for the ProfileResourceState const type.
188func PossibleProfileResourceStateValues() []ProfileResourceState {
189	return []ProfileResourceState{ProfileResourceStateActive, ProfileResourceStateCreating, ProfileResourceStateDeleting, ProfileResourceStateDisabled}
190}
191
192// QueryStringCachingBehavior enumerates the values for query string caching behavior.
193type QueryStringCachingBehavior string
194
195const (
196	// BypassCaching ...
197	BypassCaching QueryStringCachingBehavior = "BypassCaching"
198	// IgnoreQueryString ...
199	IgnoreQueryString QueryStringCachingBehavior = "IgnoreQueryString"
200	// NotSet ...
201	NotSet QueryStringCachingBehavior = "NotSet"
202	// UseQueryString ...
203	UseQueryString QueryStringCachingBehavior = "UseQueryString"
204)
205
206// PossibleQueryStringCachingBehaviorValues returns an array of possible values for the QueryStringCachingBehavior const type.
207func PossibleQueryStringCachingBehaviorValues() []QueryStringCachingBehavior {
208	return []QueryStringCachingBehavior{BypassCaching, IgnoreQueryString, NotSet, UseQueryString}
209}
210
211// ResourceType enumerates the values for resource type.
212type ResourceType string
213
214const (
215	// MicrosoftCdnProfilesEndpoints ...
216	MicrosoftCdnProfilesEndpoints ResourceType = "Microsoft.Cdn/Profiles/Endpoints"
217)
218
219// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type.
220func PossibleResourceTypeValues() []ResourceType {
221	return []ResourceType{MicrosoftCdnProfilesEndpoints}
222}
223
224// SkuName enumerates the values for sku name.
225type SkuName string
226
227const (
228	// CustomVerizon ...
229	CustomVerizon SkuName = "Custom_Verizon"
230	// PremiumVerizon ...
231	PremiumVerizon SkuName = "Premium_Verizon"
232	// StandardAkamai ...
233	StandardAkamai SkuName = "Standard_Akamai"
234	// StandardChinaCdn ...
235	StandardChinaCdn SkuName = "Standard_ChinaCdn"
236	// StandardVerizon ...
237	StandardVerizon SkuName = "Standard_Verizon"
238)
239
240// PossibleSkuNameValues returns an array of possible values for the SkuName const type.
241func PossibleSkuNameValues() []SkuName {
242	return []SkuName{CustomVerizon, PremiumVerizon, StandardAkamai, StandardChinaCdn, StandardVerizon}
243}
244
245// CheckNameAvailabilityInput input of CheckNameAvailability API.
246type CheckNameAvailabilityInput struct {
247	// Name - The resource name to validate.
248	Name *string `json:"name,omitempty"`
249	// Type - The type of the resource whose name is to be validated.
250	Type *string `json:"type,omitempty"`
251}
252
253// CheckNameAvailabilityOutput output of check name availability API.
254type CheckNameAvailabilityOutput struct {
255	autorest.Response `json:"-"`
256	// NameAvailable - Indicates whether the name is available.
257	NameAvailable *bool `json:"nameAvailable,omitempty"`
258	// Reason - The reason why the name is not available.
259	Reason *string `json:"reason,omitempty"`
260	// Message - The detailed error message describing why the name is not available.
261	Message *string `json:"message,omitempty"`
262}
263
264// CidrIPAddress CIDR Ip address
265type CidrIPAddress struct {
266	// BaseIPAddress - Ip adress itself.
267	BaseIPAddress *string `json:"baseIpAddress,omitempty"`
268	// PrefixLength - The length of the prefix of the ip address.
269	PrefixLength *int32 `json:"prefixLength,omitempty"`
270}
271
272// CustomDomain friendly domain name mapping to the endpoint hostname that the customer provides for branding
273// purposes, e.g. www.consoto.com.
274type CustomDomain struct {
275	autorest.Response       `json:"-"`
276	*CustomDomainProperties `json:"properties,omitempty"`
277	// ID - Resource ID.
278	ID *string `json:"id,omitempty"`
279	// Name - Resource name.
280	Name *string `json:"name,omitempty"`
281	// Type - Resource type.
282	Type *string `json:"type,omitempty"`
283}
284
285// MarshalJSON is the custom marshaler for CustomDomain.
286func (cd CustomDomain) MarshalJSON() ([]byte, error) {
287	objectMap := make(map[string]interface{})
288	if cd.CustomDomainProperties != nil {
289		objectMap["properties"] = cd.CustomDomainProperties
290	}
291	if cd.ID != nil {
292		objectMap["id"] = cd.ID
293	}
294	if cd.Name != nil {
295		objectMap["name"] = cd.Name
296	}
297	if cd.Type != nil {
298		objectMap["type"] = cd.Type
299	}
300	return json.Marshal(objectMap)
301}
302
303// UnmarshalJSON is the custom unmarshaler for CustomDomain struct.
304func (cd *CustomDomain) UnmarshalJSON(body []byte) error {
305	var m map[string]*json.RawMessage
306	err := json.Unmarshal(body, &m)
307	if err != nil {
308		return err
309	}
310	for k, v := range m {
311		switch k {
312		case "properties":
313			if v != nil {
314				var customDomainProperties CustomDomainProperties
315				err = json.Unmarshal(*v, &customDomainProperties)
316				if err != nil {
317					return err
318				}
319				cd.CustomDomainProperties = &customDomainProperties
320			}
321		case "id":
322			if v != nil {
323				var ID string
324				err = json.Unmarshal(*v, &ID)
325				if err != nil {
326					return err
327				}
328				cd.ID = &ID
329			}
330		case "name":
331			if v != nil {
332				var name string
333				err = json.Unmarshal(*v, &name)
334				if err != nil {
335					return err
336				}
337				cd.Name = &name
338			}
339		case "type":
340			if v != nil {
341				var typeVar string
342				err = json.Unmarshal(*v, &typeVar)
343				if err != nil {
344					return err
345				}
346				cd.Type = &typeVar
347			}
348		}
349	}
350
351	return nil
352}
353
354// CustomDomainListResult result of the request to list custom domains. It contains a list of custom domain objects
355// and a URL link to get the next set of results.
356type CustomDomainListResult struct {
357	autorest.Response `json:"-"`
358	// Value - List of CDN CustomDomains within an endpoint.
359	Value *[]CustomDomain `json:"value,omitempty"`
360	// NextLink - URL to get the next set of custom domain objects if there are any.
361	NextLink *string `json:"nextLink,omitempty"`
362}
363
364// CustomDomainListResultIterator provides access to a complete listing of CustomDomain values.
365type CustomDomainListResultIterator struct {
366	i    int
367	page CustomDomainListResultPage
368}
369
370// Next advances to the next value.  If there was an error making
371// the request the iterator does not advance and the error is returned.
372func (iter *CustomDomainListResultIterator) Next() error {
373	iter.i++
374	if iter.i < len(iter.page.Values()) {
375		return nil
376	}
377	err := iter.page.Next()
378	if err != nil {
379		iter.i--
380		return err
381	}
382	iter.i = 0
383	return nil
384}
385
386// NotDone returns true if the enumeration should be started or is not yet complete.
387func (iter CustomDomainListResultIterator) NotDone() bool {
388	return iter.page.NotDone() && iter.i < len(iter.page.Values())
389}
390
391// Response returns the raw server response from the last page request.
392func (iter CustomDomainListResultIterator) Response() CustomDomainListResult {
393	return iter.page.Response()
394}
395
396// Value returns the current value or a zero-initialized value if the
397// iterator has advanced beyond the end of the collection.
398func (iter CustomDomainListResultIterator) Value() CustomDomain {
399	if !iter.page.NotDone() {
400		return CustomDomain{}
401	}
402	return iter.page.Values()[iter.i]
403}
404
405// IsEmpty returns true if the ListResult contains no values.
406func (cdlr CustomDomainListResult) IsEmpty() bool {
407	return cdlr.Value == nil || len(*cdlr.Value) == 0
408}
409
410// customDomainListResultPreparer prepares a request to retrieve the next set of results.
411// It returns nil if no more results exist.
412func (cdlr CustomDomainListResult) customDomainListResultPreparer() (*http.Request, error) {
413	if cdlr.NextLink == nil || len(to.String(cdlr.NextLink)) < 1 {
414		return nil, nil
415	}
416	return autorest.Prepare(&http.Request{},
417		autorest.AsJSON(),
418		autorest.AsGet(),
419		autorest.WithBaseURL(to.String(cdlr.NextLink)))
420}
421
422// CustomDomainListResultPage contains a page of CustomDomain values.
423type CustomDomainListResultPage struct {
424	fn   func(CustomDomainListResult) (CustomDomainListResult, error)
425	cdlr CustomDomainListResult
426}
427
428// Next advances to the next page of values.  If there was an error making
429// the request the page does not advance and the error is returned.
430func (page *CustomDomainListResultPage) Next() error {
431	next, err := page.fn(page.cdlr)
432	if err != nil {
433		return err
434	}
435	page.cdlr = next
436	return nil
437}
438
439// NotDone returns true if the page enumeration should be started or is not yet complete.
440func (page CustomDomainListResultPage) NotDone() bool {
441	return !page.cdlr.IsEmpty()
442}
443
444// Response returns the raw server response from the last page request.
445func (page CustomDomainListResultPage) Response() CustomDomainListResult {
446	return page.cdlr
447}
448
449// Values returns the slice of values for the current page or nil if there are no values.
450func (page CustomDomainListResultPage) Values() []CustomDomain {
451	if page.cdlr.IsEmpty() {
452		return nil
453	}
454	return *page.cdlr.Value
455}
456
457// CustomDomainParameters the customDomain JSON object required for custom domain creation or update.
458type CustomDomainParameters struct {
459	*CustomDomainPropertiesParameters `json:"properties,omitempty"`
460}
461
462// MarshalJSON is the custom marshaler for CustomDomainParameters.
463func (cdp CustomDomainParameters) MarshalJSON() ([]byte, error) {
464	objectMap := make(map[string]interface{})
465	if cdp.CustomDomainPropertiesParameters != nil {
466		objectMap["properties"] = cdp.CustomDomainPropertiesParameters
467	}
468	return json.Marshal(objectMap)
469}
470
471// UnmarshalJSON is the custom unmarshaler for CustomDomainParameters struct.
472func (cdp *CustomDomainParameters) UnmarshalJSON(body []byte) error {
473	var m map[string]*json.RawMessage
474	err := json.Unmarshal(body, &m)
475	if err != nil {
476		return err
477	}
478	for k, v := range m {
479		switch k {
480		case "properties":
481			if v != nil {
482				var customDomainPropertiesParameters CustomDomainPropertiesParameters
483				err = json.Unmarshal(*v, &customDomainPropertiesParameters)
484				if err != nil {
485					return err
486				}
487				cdp.CustomDomainPropertiesParameters = &customDomainPropertiesParameters
488			}
489		}
490	}
491
492	return nil
493}
494
495// CustomDomainProperties the JSON object that contains the properties of the custom domain to create.
496type CustomDomainProperties struct {
497	// HostName - The host name of the custom domain. Must be a domain name.
498	HostName *string `json:"hostName,omitempty"`
499	// ResourceState - Resource status of the custom domain. Possible values include: 'Creating', 'Active', 'Deleting'
500	ResourceState CustomDomainResourceState `json:"resourceState,omitempty"`
501	// CustomHTTPSProvisioningState - Provisioning status of Custom Https of the custom domain. Possible values include: 'Enabling', 'Enabled', 'Disabling', 'Disabled', 'Failed'
502	CustomHTTPSProvisioningState CustomHTTPSProvisioningState `json:"customHttpsProvisioningState,omitempty"`
503	// CustomHTTPSProvisioningSubstate - Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. Possible values include: 'SubmittingDomainControlValidationRequest', 'PendingDomainControlValidationREquestApproval', 'DomainControlValidationRequestApproved', 'DomainControlValidationRequestRejected', 'DomainControlValidationRequestTimedOut', 'IssuingCertificate', 'DeployingCertificate', 'CertificateDeployed', 'DeletingCertificate', 'CertificateDeleted'
504	CustomHTTPSProvisioningSubstate CustomHTTPSProvisioningSubstate `json:"customHttpsProvisioningSubstate,omitempty"`
505	// ValidationData - Special validation or data may be required when delivering CDN to some regions due to local compliance reasons. E.g. ICP license number of a custom domain is required to deliver content in China.
506	ValidationData *string `json:"validationData,omitempty"`
507	// ProvisioningState - Provisioning status of the custom domain.
508	ProvisioningState *string `json:"provisioningState,omitempty"`
509}
510
511// CustomDomainPropertiesParameters the JSON object that contains the properties of the custom domain to create.
512type CustomDomainPropertiesParameters struct {
513	// HostName - The host name of the custom domain. Must be a domain name.
514	HostName *string `json:"hostName,omitempty"`
515}
516
517// CustomDomainsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
518type CustomDomainsCreateFuture struct {
519	azure.Future
520}
521
522// Result returns the result of the asynchronous operation.
523// If the operation has not completed it will return an error.
524func (future *CustomDomainsCreateFuture) Result(client CustomDomainsClient) (cd CustomDomain, err error) {
525	var done bool
526	done, err = future.Done(client)
527	if err != nil {
528		err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", future.Response(), "Polling failure")
529		return
530	}
531	if !done {
532		err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsCreateFuture")
533		return
534	}
535	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
536	if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent {
537		cd, err = client.CreateResponder(cd.Response.Response)
538		if err != nil {
539			err = autorest.NewErrorWithError(err, "cdn.CustomDomainsCreateFuture", "Result", cd.Response.Response, "Failure responding to request")
540		}
541	}
542	return
543}
544
545// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
546type CustomDomainsDeleteFuture struct {
547	azure.Future
548}
549
550// Result returns the result of the asynchronous operation.
551// If the operation has not completed it will return an error.
552func (future *CustomDomainsDeleteFuture) Result(client CustomDomainsClient) (cd CustomDomain, err error) {
553	var done bool
554	done, err = future.Done(client)
555	if err != nil {
556		err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure")
557		return
558	}
559	if !done {
560		err = azure.NewAsyncOpIncompleteError("cdn.CustomDomainsDeleteFuture")
561		return
562	}
563	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
564	if cd.Response.Response, err = future.GetResult(sender); err == nil && cd.Response.Response.StatusCode != http.StatusNoContent {
565		cd, err = client.DeleteResponder(cd.Response.Response)
566		if err != nil {
567			err = autorest.NewErrorWithError(err, "cdn.CustomDomainsDeleteFuture", "Result", cd.Response.Response, "Failure responding to request")
568		}
569	}
570	return
571}
572
573// DeepCreatedOrigin the main origin of CDN content which is added when creating a CDN endpoint.
574type DeepCreatedOrigin struct {
575	// Name - Origin name
576	Name                         *string `json:"name,omitempty"`
577	*DeepCreatedOriginProperties `json:"properties,omitempty"`
578}
579
580// MarshalJSON is the custom marshaler for DeepCreatedOrigin.
581func (dco DeepCreatedOrigin) MarshalJSON() ([]byte, error) {
582	objectMap := make(map[string]interface{})
583	if dco.Name != nil {
584		objectMap["name"] = dco.Name
585	}
586	if dco.DeepCreatedOriginProperties != nil {
587		objectMap["properties"] = dco.DeepCreatedOriginProperties
588	}
589	return json.Marshal(objectMap)
590}
591
592// UnmarshalJSON is the custom unmarshaler for DeepCreatedOrigin struct.
593func (dco *DeepCreatedOrigin) UnmarshalJSON(body []byte) error {
594	var m map[string]*json.RawMessage
595	err := json.Unmarshal(body, &m)
596	if err != nil {
597		return err
598	}
599	for k, v := range m {
600		switch k {
601		case "name":
602			if v != nil {
603				var name string
604				err = json.Unmarshal(*v, &name)
605				if err != nil {
606					return err
607				}
608				dco.Name = &name
609			}
610		case "properties":
611			if v != nil {
612				var deepCreatedOriginProperties DeepCreatedOriginProperties
613				err = json.Unmarshal(*v, &deepCreatedOriginProperties)
614				if err != nil {
615					return err
616				}
617				dco.DeepCreatedOriginProperties = &deepCreatedOriginProperties
618			}
619		}
620	}
621
622	return nil
623}
624
625// DeepCreatedOriginProperties properties of the origin created on the CDN endpoint.
626type DeepCreatedOriginProperties struct {
627	// HostName - The address of the origin. It can be a domain name, IPv4 address, or IPv6 address.
628	HostName *string `json:"hostName,omitempty"`
629	// HTTPPort - The value of the HTTP port. Must be between 1 and 65535
630	HTTPPort *int32 `json:"httpPort,omitempty"`
631	// HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535
632	HTTPSPort *int32 `json:"httpsPort,omitempty"`
633}
634
635// EdgeNode edgenode is a global Point of Presence (POP) location used to deliver CDN content to end users.
636type EdgeNode struct {
637	*EdgeNodeProperties `json:"properties,omitempty"`
638	// ID - Resource ID.
639	ID *string `json:"id,omitempty"`
640	// Name - Resource name.
641	Name *string `json:"name,omitempty"`
642	// Type - Resource type.
643	Type *string `json:"type,omitempty"`
644}
645
646// MarshalJSON is the custom marshaler for EdgeNode.
647func (en EdgeNode) MarshalJSON() ([]byte, error) {
648	objectMap := make(map[string]interface{})
649	if en.EdgeNodeProperties != nil {
650		objectMap["properties"] = en.EdgeNodeProperties
651	}
652	if en.ID != nil {
653		objectMap["id"] = en.ID
654	}
655	if en.Name != nil {
656		objectMap["name"] = en.Name
657	}
658	if en.Type != nil {
659		objectMap["type"] = en.Type
660	}
661	return json.Marshal(objectMap)
662}
663
664// UnmarshalJSON is the custom unmarshaler for EdgeNode struct.
665func (en *EdgeNode) UnmarshalJSON(body []byte) error {
666	var m map[string]*json.RawMessage
667	err := json.Unmarshal(body, &m)
668	if err != nil {
669		return err
670	}
671	for k, v := range m {
672		switch k {
673		case "properties":
674			if v != nil {
675				var edgeNodeProperties EdgeNodeProperties
676				err = json.Unmarshal(*v, &edgeNodeProperties)
677				if err != nil {
678					return err
679				}
680				en.EdgeNodeProperties = &edgeNodeProperties
681			}
682		case "id":
683			if v != nil {
684				var ID string
685				err = json.Unmarshal(*v, &ID)
686				if err != nil {
687					return err
688				}
689				en.ID = &ID
690			}
691		case "name":
692			if v != nil {
693				var name string
694				err = json.Unmarshal(*v, &name)
695				if err != nil {
696					return err
697				}
698				en.Name = &name
699			}
700		case "type":
701			if v != nil {
702				var typeVar string
703				err = json.Unmarshal(*v, &typeVar)
704				if err != nil {
705					return err
706				}
707				en.Type = &typeVar
708			}
709		}
710	}
711
712	return nil
713}
714
715// EdgeNodeProperties the JSON object that contains the properties required to create an edgenode.
716type EdgeNodeProperties struct {
717	// IPAddressGroups - List of ip address groups.
718	IPAddressGroups *[]IPAddressGroup `json:"ipAddressGroups,omitempty"`
719}
720
721// EdgenodeResult result of the request to list CDN edgenodes. It contains a list of ip address group and a URL
722// link to get the next set of results.
723type EdgenodeResult struct {
724	autorest.Response `json:"-"`
725	// Value - Edge node of CDN service.
726	Value *[]EdgeNode `json:"value,omitempty"`
727	// NextLink - URL to get the next set of edgenode list results if there are any.
728	NextLink *string `json:"nextLink,omitempty"`
729}
730
731// EdgenodeResultIterator provides access to a complete listing of EdgeNode values.
732type EdgenodeResultIterator struct {
733	i    int
734	page EdgenodeResultPage
735}
736
737// Next advances to the next value.  If there was an error making
738// the request the iterator does not advance and the error is returned.
739func (iter *EdgenodeResultIterator) Next() error {
740	iter.i++
741	if iter.i < len(iter.page.Values()) {
742		return nil
743	}
744	err := iter.page.Next()
745	if err != nil {
746		iter.i--
747		return err
748	}
749	iter.i = 0
750	return nil
751}
752
753// NotDone returns true if the enumeration should be started or is not yet complete.
754func (iter EdgenodeResultIterator) NotDone() bool {
755	return iter.page.NotDone() && iter.i < len(iter.page.Values())
756}
757
758// Response returns the raw server response from the last page request.
759func (iter EdgenodeResultIterator) Response() EdgenodeResult {
760	return iter.page.Response()
761}
762
763// Value returns the current value or a zero-initialized value if the
764// iterator has advanced beyond the end of the collection.
765func (iter EdgenodeResultIterator) Value() EdgeNode {
766	if !iter.page.NotDone() {
767		return EdgeNode{}
768	}
769	return iter.page.Values()[iter.i]
770}
771
772// IsEmpty returns true if the ListResult contains no values.
773func (er EdgenodeResult) IsEmpty() bool {
774	return er.Value == nil || len(*er.Value) == 0
775}
776
777// edgenodeResultPreparer prepares a request to retrieve the next set of results.
778// It returns nil if no more results exist.
779func (er EdgenodeResult) edgenodeResultPreparer() (*http.Request, error) {
780	if er.NextLink == nil || len(to.String(er.NextLink)) < 1 {
781		return nil, nil
782	}
783	return autorest.Prepare(&http.Request{},
784		autorest.AsJSON(),
785		autorest.AsGet(),
786		autorest.WithBaseURL(to.String(er.NextLink)))
787}
788
789// EdgenodeResultPage contains a page of EdgeNode values.
790type EdgenodeResultPage struct {
791	fn func(EdgenodeResult) (EdgenodeResult, error)
792	er EdgenodeResult
793}
794
795// Next advances to the next page of values.  If there was an error making
796// the request the page does not advance and the error is returned.
797func (page *EdgenodeResultPage) Next() error {
798	next, err := page.fn(page.er)
799	if err != nil {
800		return err
801	}
802	page.er = next
803	return nil
804}
805
806// NotDone returns true if the page enumeration should be started or is not yet complete.
807func (page EdgenodeResultPage) NotDone() bool {
808	return !page.er.IsEmpty()
809}
810
811// Response returns the raw server response from the last page request.
812func (page EdgenodeResultPage) Response() EdgenodeResult {
813	return page.er
814}
815
816// Values returns the slice of values for the current page or nil if there are no values.
817func (page EdgenodeResultPage) Values() []EdgeNode {
818	if page.er.IsEmpty() {
819		return nil
820	}
821	return *page.er.Value
822}
823
824// Endpoint CDN endpoint is the entity within a CDN profile containing configuration information such as origin,
825// protocol, content caching and delivery behavior. The CDN endpoint uses the URL format
826// <endpointname>.azureedge.net.
827type Endpoint struct {
828	autorest.Response   `json:"-"`
829	*EndpointProperties `json:"properties,omitempty"`
830	// Location - Resource location.
831	Location *string `json:"location,omitempty"`
832	// Tags - Resource tags.
833	Tags map[string]*string `json:"tags"`
834	// ID - Resource ID.
835	ID *string `json:"id,omitempty"`
836	// Name - Resource name.
837	Name *string `json:"name,omitempty"`
838	// Type - Resource type.
839	Type *string `json:"type,omitempty"`
840}
841
842// MarshalJSON is the custom marshaler for Endpoint.
843func (e Endpoint) MarshalJSON() ([]byte, error) {
844	objectMap := make(map[string]interface{})
845	if e.EndpointProperties != nil {
846		objectMap["properties"] = e.EndpointProperties
847	}
848	if e.Location != nil {
849		objectMap["location"] = e.Location
850	}
851	if e.Tags != nil {
852		objectMap["tags"] = e.Tags
853	}
854	if e.ID != nil {
855		objectMap["id"] = e.ID
856	}
857	if e.Name != nil {
858		objectMap["name"] = e.Name
859	}
860	if e.Type != nil {
861		objectMap["type"] = e.Type
862	}
863	return json.Marshal(objectMap)
864}
865
866// UnmarshalJSON is the custom unmarshaler for Endpoint struct.
867func (e *Endpoint) UnmarshalJSON(body []byte) error {
868	var m map[string]*json.RawMessage
869	err := json.Unmarshal(body, &m)
870	if err != nil {
871		return err
872	}
873	for k, v := range m {
874		switch k {
875		case "properties":
876			if v != nil {
877				var endpointProperties EndpointProperties
878				err = json.Unmarshal(*v, &endpointProperties)
879				if err != nil {
880					return err
881				}
882				e.EndpointProperties = &endpointProperties
883			}
884		case "location":
885			if v != nil {
886				var location string
887				err = json.Unmarshal(*v, &location)
888				if err != nil {
889					return err
890				}
891				e.Location = &location
892			}
893		case "tags":
894			if v != nil {
895				var tags map[string]*string
896				err = json.Unmarshal(*v, &tags)
897				if err != nil {
898					return err
899				}
900				e.Tags = tags
901			}
902		case "id":
903			if v != nil {
904				var ID string
905				err = json.Unmarshal(*v, &ID)
906				if err != nil {
907					return err
908				}
909				e.ID = &ID
910			}
911		case "name":
912			if v != nil {
913				var name string
914				err = json.Unmarshal(*v, &name)
915				if err != nil {
916					return err
917				}
918				e.Name = &name
919			}
920		case "type":
921			if v != nil {
922				var typeVar string
923				err = json.Unmarshal(*v, &typeVar)
924				if err != nil {
925					return err
926				}
927				e.Type = &typeVar
928			}
929		}
930	}
931
932	return nil
933}
934
935// EndpointListResult result of the request to list endpoints. It contains a list of endpoint objects and a URL
936// link to get the the next set of results.
937type EndpointListResult struct {
938	autorest.Response `json:"-"`
939	// Value - List of CDN endpoints within a profile
940	Value *[]Endpoint `json:"value,omitempty"`
941	// NextLink - URL to get the next set of endpoint objects if there is any.
942	NextLink *string `json:"nextLink,omitempty"`
943}
944
945// EndpointListResultIterator provides access to a complete listing of Endpoint values.
946type EndpointListResultIterator struct {
947	i    int
948	page EndpointListResultPage
949}
950
951// Next advances to the next value.  If there was an error making
952// the request the iterator does not advance and the error is returned.
953func (iter *EndpointListResultIterator) Next() error {
954	iter.i++
955	if iter.i < len(iter.page.Values()) {
956		return nil
957	}
958	err := iter.page.Next()
959	if err != nil {
960		iter.i--
961		return err
962	}
963	iter.i = 0
964	return nil
965}
966
967// NotDone returns true if the enumeration should be started or is not yet complete.
968func (iter EndpointListResultIterator) NotDone() bool {
969	return iter.page.NotDone() && iter.i < len(iter.page.Values())
970}
971
972// Response returns the raw server response from the last page request.
973func (iter EndpointListResultIterator) Response() EndpointListResult {
974	return iter.page.Response()
975}
976
977// Value returns the current value or a zero-initialized value if the
978// iterator has advanced beyond the end of the collection.
979func (iter EndpointListResultIterator) Value() Endpoint {
980	if !iter.page.NotDone() {
981		return Endpoint{}
982	}
983	return iter.page.Values()[iter.i]
984}
985
986// IsEmpty returns true if the ListResult contains no values.
987func (elr EndpointListResult) IsEmpty() bool {
988	return elr.Value == nil || len(*elr.Value) == 0
989}
990
991// endpointListResultPreparer prepares a request to retrieve the next set of results.
992// It returns nil if no more results exist.
993func (elr EndpointListResult) endpointListResultPreparer() (*http.Request, error) {
994	if elr.NextLink == nil || len(to.String(elr.NextLink)) < 1 {
995		return nil, nil
996	}
997	return autorest.Prepare(&http.Request{},
998		autorest.AsJSON(),
999		autorest.AsGet(),
1000		autorest.WithBaseURL(to.String(elr.NextLink)))
1001}
1002
1003// EndpointListResultPage contains a page of Endpoint values.
1004type EndpointListResultPage struct {
1005	fn  func(EndpointListResult) (EndpointListResult, error)
1006	elr EndpointListResult
1007}
1008
1009// Next advances to the next page of values.  If there was an error making
1010// the request the page does not advance and the error is returned.
1011func (page *EndpointListResultPage) Next() error {
1012	next, err := page.fn(page.elr)
1013	if err != nil {
1014		return err
1015	}
1016	page.elr = next
1017	return nil
1018}
1019
1020// NotDone returns true if the page enumeration should be started or is not yet complete.
1021func (page EndpointListResultPage) NotDone() bool {
1022	return !page.elr.IsEmpty()
1023}
1024
1025// Response returns the raw server response from the last page request.
1026func (page EndpointListResultPage) Response() EndpointListResult {
1027	return page.elr
1028}
1029
1030// Values returns the slice of values for the current page or nil if there are no values.
1031func (page EndpointListResultPage) Values() []Endpoint {
1032	if page.elr.IsEmpty() {
1033		return nil
1034	}
1035	return *page.elr.Value
1036}
1037
1038// EndpointProperties the JSON object that contains the properties required to create an endpoint.
1039type EndpointProperties struct {
1040	// HostName - The host name of the endpoint structured as {endpointName}.{DNSZone}, e.g. consoto.azureedge.net
1041	HostName *string `json:"hostName,omitempty"`
1042	// Origins - The source of the content being delivered via CDN.
1043	Origins *[]DeepCreatedOrigin `json:"origins,omitempty"`
1044	// ResourceState - Resource status of the endpoint. Possible values include: 'EndpointResourceStateCreating', 'EndpointResourceStateDeleting', 'EndpointResourceStateRunning', 'EndpointResourceStateStarting', 'EndpointResourceStateStopped', 'EndpointResourceStateStopping'
1045	ResourceState EndpointResourceState `json:"resourceState,omitempty"`
1046	// ProvisioningState - Provisioning status of the endpoint.
1047	ProvisioningState *string `json:"provisioningState,omitempty"`
1048	// OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default.
1049	OriginHostHeader *string `json:"originHostHeader,omitempty"`
1050	// OriginPath - A directory path on the origin that CDN can use to retreive content from, e.g. contoso.cloudapp.net/originpath.
1051	OriginPath *string `json:"originPath,omitempty"`
1052	// ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type.
1053	ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"`
1054	// IsCompressionEnabled - Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB.
1055	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
1056	// IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
1057	IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"`
1058	// IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
1059	IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"`
1060	// QueryStringCachingBehavior - Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'
1061	QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"`
1062	// OptimizationType - Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: 'GeneralWebDelivery', 'GeneralMediaStreaming', 'VideoOnDemandMediaStreaming', 'LargeFileDownload', 'DynamicSiteAcceleration'
1063	OptimizationType OptimizationType `json:"optimizationType,omitempty"`
1064	// ProbePath - Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path.
1065	ProbePath *string `json:"probePath,omitempty"`
1066	// GeoFilters - List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an acess rule to a specified path or content, e.g. block APAC for path /pictures/
1067	GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"`
1068}
1069
1070// EndpointPropertiesUpdateParameters the JSON object containing endpoint update parameters.
1071type EndpointPropertiesUpdateParameters struct {
1072	// OriginHostHeader - The host header value sent to the origin with each request. If you leave this blank, the request hostname determines this value. Azure CDN origins, such as Web Apps, Blob Storage, and Cloud Services require this host header value to match the origin hostname by default.
1073	OriginHostHeader *string `json:"originHostHeader,omitempty"`
1074	// OriginPath - A directory path on the origin that CDN can use to retreive content from, e.g. contoso.cloudapp.net/originpath.
1075	OriginPath *string `json:"originPath,omitempty"`
1076	// ContentTypesToCompress - List of content types on which compression applies. The value should be a valid MIME type.
1077	ContentTypesToCompress *[]string `json:"contentTypesToCompress,omitempty"`
1078	// IsCompressionEnabled - Indicates whether content compression is enabled on CDN. Default value is false. If compression is enabled, content will be served as compressed if user requests for a compressed version. Content won't be compressed on CDN when requested content is smaller than 1 byte or larger than 1 MB.
1079	IsCompressionEnabled *bool `json:"isCompressionEnabled,omitempty"`
1080	// IsHTTPAllowed - Indicates whether HTTP traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
1081	IsHTTPAllowed *bool `json:"isHttpAllowed,omitempty"`
1082	// IsHTTPSAllowed - Indicates whether HTTPS traffic is allowed on the endpoint. Default value is true. At least one protocol (HTTP or HTTPS) must be allowed.
1083	IsHTTPSAllowed *bool `json:"isHttpsAllowed,omitempty"`
1084	// QueryStringCachingBehavior - Defines how CDN caches requests that include query strings. You can ignore any query strings when caching, bypass caching to prevent requests that contain query strings from being cached, or cache every request with a unique URL. Possible values include: 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet'
1085	QueryStringCachingBehavior QueryStringCachingBehavior `json:"queryStringCachingBehavior,omitempty"`
1086	// OptimizationType - Specifies what scenario the customer wants this CDN endpoint to optimize for, e.g. Download, Media services. With this information, CDN can apply scenario driven optimization. Possible values include: 'GeneralWebDelivery', 'GeneralMediaStreaming', 'VideoOnDemandMediaStreaming', 'LargeFileDownload', 'DynamicSiteAcceleration'
1087	OptimizationType OptimizationType `json:"optimizationType,omitempty"`
1088	// ProbePath - Path to a file hosted on the origin which helps accelerate delivery of the dynamic content and calculate the most optimal routes for the CDN. This is relative to the origin path.
1089	ProbePath *string `json:"probePath,omitempty"`
1090	// GeoFilters - List of rules defining the user's geo access within a CDN endpoint. Each geo filter defines an acess rule to a specified path or content, e.g. block APAC for path /pictures/
1091	GeoFilters *[]GeoFilter `json:"geoFilters,omitempty"`
1092}
1093
1094// EndpointsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1095type EndpointsCreateFuture struct {
1096	azure.Future
1097}
1098
1099// Result returns the result of the asynchronous operation.
1100// If the operation has not completed it will return an error.
1101func (future *EndpointsCreateFuture) Result(client EndpointsClient) (e Endpoint, err error) {
1102	var done bool
1103	done, err = future.Done(client)
1104	if err != nil {
1105		err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", future.Response(), "Polling failure")
1106		return
1107	}
1108	if !done {
1109		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsCreateFuture")
1110		return
1111	}
1112	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1113	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
1114		e, err = client.CreateResponder(e.Response.Response)
1115		if err != nil {
1116			err = autorest.NewErrorWithError(err, "cdn.EndpointsCreateFuture", "Result", e.Response.Response, "Failure responding to request")
1117		}
1118	}
1119	return
1120}
1121
1122// EndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1123type EndpointsDeleteFuture struct {
1124	azure.Future
1125}
1126
1127// Result returns the result of the asynchronous operation.
1128// If the operation has not completed it will return an error.
1129func (future *EndpointsDeleteFuture) Result(client EndpointsClient) (ar autorest.Response, err error) {
1130	var done bool
1131	done, err = future.Done(client)
1132	if err != nil {
1133		err = autorest.NewErrorWithError(err, "cdn.EndpointsDeleteFuture", "Result", future.Response(), "Polling failure")
1134		return
1135	}
1136	if !done {
1137		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsDeleteFuture")
1138		return
1139	}
1140	ar.Response = future.Response()
1141	return
1142}
1143
1144// EndpointsLoadContentFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1145type EndpointsLoadContentFuture struct {
1146	azure.Future
1147}
1148
1149// Result returns the result of the asynchronous operation.
1150// If the operation has not completed it will return an error.
1151func (future *EndpointsLoadContentFuture) Result(client EndpointsClient) (ar autorest.Response, err error) {
1152	var done bool
1153	done, err = future.Done(client)
1154	if err != nil {
1155		err = autorest.NewErrorWithError(err, "cdn.EndpointsLoadContentFuture", "Result", future.Response(), "Polling failure")
1156		return
1157	}
1158	if !done {
1159		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsLoadContentFuture")
1160		return
1161	}
1162	ar.Response = future.Response()
1163	return
1164}
1165
1166// EndpointsPurgeContentFuture an abstraction for monitoring and retrieving the results of a long-running
1167// operation.
1168type EndpointsPurgeContentFuture struct {
1169	azure.Future
1170}
1171
1172// Result returns the result of the asynchronous operation.
1173// If the operation has not completed it will return an error.
1174func (future *EndpointsPurgeContentFuture) Result(client EndpointsClient) (ar autorest.Response, err error) {
1175	var done bool
1176	done, err = future.Done(client)
1177	if err != nil {
1178		err = autorest.NewErrorWithError(err, "cdn.EndpointsPurgeContentFuture", "Result", future.Response(), "Polling failure")
1179		return
1180	}
1181	if !done {
1182		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsPurgeContentFuture")
1183		return
1184	}
1185	ar.Response = future.Response()
1186	return
1187}
1188
1189// EndpointsStartFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1190type EndpointsStartFuture struct {
1191	azure.Future
1192}
1193
1194// Result returns the result of the asynchronous operation.
1195// If the operation has not completed it will return an error.
1196func (future *EndpointsStartFuture) Result(client EndpointsClient) (e Endpoint, err error) {
1197	var done bool
1198	done, err = future.Done(client)
1199	if err != nil {
1200		err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", future.Response(), "Polling failure")
1201		return
1202	}
1203	if !done {
1204		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStartFuture")
1205		return
1206	}
1207	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1208	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
1209		e, err = client.StartResponder(e.Response.Response)
1210		if err != nil {
1211			err = autorest.NewErrorWithError(err, "cdn.EndpointsStartFuture", "Result", e.Response.Response, "Failure responding to request")
1212		}
1213	}
1214	return
1215}
1216
1217// EndpointsStopFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1218type EndpointsStopFuture struct {
1219	azure.Future
1220}
1221
1222// Result returns the result of the asynchronous operation.
1223// If the operation has not completed it will return an error.
1224func (future *EndpointsStopFuture) Result(client EndpointsClient) (e Endpoint, err error) {
1225	var done bool
1226	done, err = future.Done(client)
1227	if err != nil {
1228		err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", future.Response(), "Polling failure")
1229		return
1230	}
1231	if !done {
1232		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsStopFuture")
1233		return
1234	}
1235	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1236	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
1237		e, err = client.StopResponder(e.Response.Response)
1238		if err != nil {
1239			err = autorest.NewErrorWithError(err, "cdn.EndpointsStopFuture", "Result", e.Response.Response, "Failure responding to request")
1240		}
1241	}
1242	return
1243}
1244
1245// EndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1246type EndpointsUpdateFuture struct {
1247	azure.Future
1248}
1249
1250// Result returns the result of the asynchronous operation.
1251// If the operation has not completed it will return an error.
1252func (future *EndpointsUpdateFuture) Result(client EndpointsClient) (e Endpoint, err error) {
1253	var done bool
1254	done, err = future.Done(client)
1255	if err != nil {
1256		err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", future.Response(), "Polling failure")
1257		return
1258	}
1259	if !done {
1260		err = azure.NewAsyncOpIncompleteError("cdn.EndpointsUpdateFuture")
1261		return
1262	}
1263	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1264	if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent {
1265		e, err = client.UpdateResponder(e.Response.Response)
1266		if err != nil {
1267			err = autorest.NewErrorWithError(err, "cdn.EndpointsUpdateFuture", "Result", e.Response.Response, "Failure responding to request")
1268		}
1269	}
1270	return
1271}
1272
1273// EndpointUpdateParameters properties required to create or update an endpoint.
1274type EndpointUpdateParameters struct {
1275	// Tags - Endpoint tags.
1276	Tags                                map[string]*string `json:"tags"`
1277	*EndpointPropertiesUpdateParameters `json:"properties,omitempty"`
1278}
1279
1280// MarshalJSON is the custom marshaler for EndpointUpdateParameters.
1281func (eup EndpointUpdateParameters) MarshalJSON() ([]byte, error) {
1282	objectMap := make(map[string]interface{})
1283	if eup.Tags != nil {
1284		objectMap["tags"] = eup.Tags
1285	}
1286	if eup.EndpointPropertiesUpdateParameters != nil {
1287		objectMap["properties"] = eup.EndpointPropertiesUpdateParameters
1288	}
1289	return json.Marshal(objectMap)
1290}
1291
1292// UnmarshalJSON is the custom unmarshaler for EndpointUpdateParameters struct.
1293func (eup *EndpointUpdateParameters) UnmarshalJSON(body []byte) error {
1294	var m map[string]*json.RawMessage
1295	err := json.Unmarshal(body, &m)
1296	if err != nil {
1297		return err
1298	}
1299	for k, v := range m {
1300		switch k {
1301		case "tags":
1302			if v != nil {
1303				var tags map[string]*string
1304				err = json.Unmarshal(*v, &tags)
1305				if err != nil {
1306					return err
1307				}
1308				eup.Tags = tags
1309			}
1310		case "properties":
1311			if v != nil {
1312				var endpointPropertiesUpdateParameters EndpointPropertiesUpdateParameters
1313				err = json.Unmarshal(*v, &endpointPropertiesUpdateParameters)
1314				if err != nil {
1315					return err
1316				}
1317				eup.EndpointPropertiesUpdateParameters = &endpointPropertiesUpdateParameters
1318			}
1319		}
1320	}
1321
1322	return nil
1323}
1324
1325// ErrorResponse error reponse indicates CDN service is not able to process the incoming request. The reason is
1326// provided in the error message.
1327type ErrorResponse struct {
1328	// Code - Error code.
1329	Code *string `json:"code,omitempty"`
1330	// Message - Error message indicating why the operation failed.
1331	Message *string `json:"message,omitempty"`
1332}
1333
1334// GeoFilter rules defining user's geo access within a CDN endpoint.
1335type GeoFilter struct {
1336	// RelativePath - Relative path applicable to geo filter. (e.g. '/mypictures', '/mypicture/kitty.jpg', and etc.)
1337	RelativePath *string `json:"relativePath,omitempty"`
1338	// Action - Action of the geo filter, i.e. allow or block access. Possible values include: 'Block', 'Allow'
1339	Action GeoFilterActions `json:"action,omitempty"`
1340	// CountryCodes - Two letter country codes defining user country access in a geo filter, e.g. AU, MX, US.
1341	CountryCodes *[]string `json:"countryCodes,omitempty"`
1342}
1343
1344// IPAddressGroup CDN Ip address group
1345type IPAddressGroup struct {
1346	// DeliveryRegion - The delivery region of the ip address group
1347	DeliveryRegion *string `json:"deliveryRegion,omitempty"`
1348	// Ipv4Addresses - The list of ip v4 addresses.
1349	Ipv4Addresses *[]CidrIPAddress `json:"ipv4Addresses,omitempty"`
1350	// Ipv6Addresses - The list of ip v6 addresses.
1351	Ipv6Addresses *[]CidrIPAddress `json:"ipv6Addresses,omitempty"`
1352}
1353
1354// LoadParameters parameters required for content load.
1355type LoadParameters struct {
1356	// ContentPaths - The path to the content to be loaded. Path should be a relative file URL of the origin.
1357	ContentPaths *[]string `json:"contentPaths,omitempty"`
1358}
1359
1360// Operation CDN REST API operation
1361type Operation struct {
1362	// Name - Operation name: {provider}/{resource}/{operation}
1363	Name *string `json:"name,omitempty"`
1364	// Display - The object that represents the operation.
1365	Display *OperationDisplay `json:"display,omitempty"`
1366}
1367
1368// OperationDisplay the object that represents the operation.
1369type OperationDisplay struct {
1370	// Provider - Service provider: Microsoft.Cdn
1371	Provider *string `json:"provider,omitempty"`
1372	// Resource - Resource on which the operation is performed: Profile, endpoint, etc.
1373	Resource *string `json:"resource,omitempty"`
1374	// Operation - Operation type: Read, write, delete, etc.
1375	Operation *string `json:"operation,omitempty"`
1376}
1377
1378// OperationsListResult result of the request to list CDN operations. It contains a list of operations and a URL
1379// link to get the next set of results.
1380type OperationsListResult struct {
1381	autorest.Response `json:"-"`
1382	// Value - List of CDN operations supported by the CDN resource provider.
1383	Value *[]Operation `json:"value,omitempty"`
1384	// NextLink - URL to get the next set of operation list results if there are any.
1385	NextLink *string `json:"nextLink,omitempty"`
1386}
1387
1388// OperationsListResultIterator provides access to a complete listing of Operation values.
1389type OperationsListResultIterator struct {
1390	i    int
1391	page OperationsListResultPage
1392}
1393
1394// Next advances to the next value.  If there was an error making
1395// the request the iterator does not advance and the error is returned.
1396func (iter *OperationsListResultIterator) Next() error {
1397	iter.i++
1398	if iter.i < len(iter.page.Values()) {
1399		return nil
1400	}
1401	err := iter.page.Next()
1402	if err != nil {
1403		iter.i--
1404		return err
1405	}
1406	iter.i = 0
1407	return nil
1408}
1409
1410// NotDone returns true if the enumeration should be started or is not yet complete.
1411func (iter OperationsListResultIterator) NotDone() bool {
1412	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1413}
1414
1415// Response returns the raw server response from the last page request.
1416func (iter OperationsListResultIterator) Response() OperationsListResult {
1417	return iter.page.Response()
1418}
1419
1420// Value returns the current value or a zero-initialized value if the
1421// iterator has advanced beyond the end of the collection.
1422func (iter OperationsListResultIterator) Value() Operation {
1423	if !iter.page.NotDone() {
1424		return Operation{}
1425	}
1426	return iter.page.Values()[iter.i]
1427}
1428
1429// IsEmpty returns true if the ListResult contains no values.
1430func (olr OperationsListResult) IsEmpty() bool {
1431	return olr.Value == nil || len(*olr.Value) == 0
1432}
1433
1434// operationsListResultPreparer prepares a request to retrieve the next set of results.
1435// It returns nil if no more results exist.
1436func (olr OperationsListResult) operationsListResultPreparer() (*http.Request, error) {
1437	if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {
1438		return nil, nil
1439	}
1440	return autorest.Prepare(&http.Request{},
1441		autorest.AsJSON(),
1442		autorest.AsGet(),
1443		autorest.WithBaseURL(to.String(olr.NextLink)))
1444}
1445
1446// OperationsListResultPage contains a page of Operation values.
1447type OperationsListResultPage struct {
1448	fn  func(OperationsListResult) (OperationsListResult, error)
1449	olr OperationsListResult
1450}
1451
1452// Next advances to the next page of values.  If there was an error making
1453// the request the page does not advance and the error is returned.
1454func (page *OperationsListResultPage) Next() error {
1455	next, err := page.fn(page.olr)
1456	if err != nil {
1457		return err
1458	}
1459	page.olr = next
1460	return nil
1461}
1462
1463// NotDone returns true if the page enumeration should be started or is not yet complete.
1464func (page OperationsListResultPage) NotDone() bool {
1465	return !page.olr.IsEmpty()
1466}
1467
1468// Response returns the raw server response from the last page request.
1469func (page OperationsListResultPage) Response() OperationsListResult {
1470	return page.olr
1471}
1472
1473// Values returns the slice of values for the current page or nil if there are no values.
1474func (page OperationsListResultPage) Values() []Operation {
1475	if page.olr.IsEmpty() {
1476		return nil
1477	}
1478	return *page.olr.Value
1479}
1480
1481// Origin CDN origin is the source of the content being delivered via CDN. When the edge nodes represented by an
1482// endpoint do not have the requested content cached, they attempt to fetch it from one or more of the configured
1483// origins.
1484type Origin struct {
1485	autorest.Response `json:"-"`
1486	*OriginProperties `json:"properties,omitempty"`
1487	// Location - Resource location.
1488	Location *string `json:"location,omitempty"`
1489	// Tags - Resource tags.
1490	Tags map[string]*string `json:"tags"`
1491	// ID - Resource ID.
1492	ID *string `json:"id,omitempty"`
1493	// Name - Resource name.
1494	Name *string `json:"name,omitempty"`
1495	// Type - Resource type.
1496	Type *string `json:"type,omitempty"`
1497}
1498
1499// MarshalJSON is the custom marshaler for Origin.
1500func (o Origin) MarshalJSON() ([]byte, error) {
1501	objectMap := make(map[string]interface{})
1502	if o.OriginProperties != nil {
1503		objectMap["properties"] = o.OriginProperties
1504	}
1505	if o.Location != nil {
1506		objectMap["location"] = o.Location
1507	}
1508	if o.Tags != nil {
1509		objectMap["tags"] = o.Tags
1510	}
1511	if o.ID != nil {
1512		objectMap["id"] = o.ID
1513	}
1514	if o.Name != nil {
1515		objectMap["name"] = o.Name
1516	}
1517	if o.Type != nil {
1518		objectMap["type"] = o.Type
1519	}
1520	return json.Marshal(objectMap)
1521}
1522
1523// UnmarshalJSON is the custom unmarshaler for Origin struct.
1524func (o *Origin) UnmarshalJSON(body []byte) error {
1525	var m map[string]*json.RawMessage
1526	err := json.Unmarshal(body, &m)
1527	if err != nil {
1528		return err
1529	}
1530	for k, v := range m {
1531		switch k {
1532		case "properties":
1533			if v != nil {
1534				var originProperties OriginProperties
1535				err = json.Unmarshal(*v, &originProperties)
1536				if err != nil {
1537					return err
1538				}
1539				o.OriginProperties = &originProperties
1540			}
1541		case "location":
1542			if v != nil {
1543				var location string
1544				err = json.Unmarshal(*v, &location)
1545				if err != nil {
1546					return err
1547				}
1548				o.Location = &location
1549			}
1550		case "tags":
1551			if v != nil {
1552				var tags map[string]*string
1553				err = json.Unmarshal(*v, &tags)
1554				if err != nil {
1555					return err
1556				}
1557				o.Tags = tags
1558			}
1559		case "id":
1560			if v != nil {
1561				var ID string
1562				err = json.Unmarshal(*v, &ID)
1563				if err != nil {
1564					return err
1565				}
1566				o.ID = &ID
1567			}
1568		case "name":
1569			if v != nil {
1570				var name string
1571				err = json.Unmarshal(*v, &name)
1572				if err != nil {
1573					return err
1574				}
1575				o.Name = &name
1576			}
1577		case "type":
1578			if v != nil {
1579				var typeVar string
1580				err = json.Unmarshal(*v, &typeVar)
1581				if err != nil {
1582					return err
1583				}
1584				o.Type = &typeVar
1585			}
1586		}
1587	}
1588
1589	return nil
1590}
1591
1592// OriginListResult result of the request to list origins. It contains a list of origin objects and a URL link to
1593// get the next set of results.
1594type OriginListResult struct {
1595	autorest.Response `json:"-"`
1596	// Value - List of CDN origins within an endpoint
1597	Value *[]Origin `json:"value,omitempty"`
1598	// NextLink - URL to get the next set of origin objects if there are any.
1599	NextLink *string `json:"nextLink,omitempty"`
1600}
1601
1602// OriginListResultIterator provides access to a complete listing of Origin values.
1603type OriginListResultIterator struct {
1604	i    int
1605	page OriginListResultPage
1606}
1607
1608// Next advances to the next value.  If there was an error making
1609// the request the iterator does not advance and the error is returned.
1610func (iter *OriginListResultIterator) Next() error {
1611	iter.i++
1612	if iter.i < len(iter.page.Values()) {
1613		return nil
1614	}
1615	err := iter.page.Next()
1616	if err != nil {
1617		iter.i--
1618		return err
1619	}
1620	iter.i = 0
1621	return nil
1622}
1623
1624// NotDone returns true if the enumeration should be started or is not yet complete.
1625func (iter OriginListResultIterator) NotDone() bool {
1626	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1627}
1628
1629// Response returns the raw server response from the last page request.
1630func (iter OriginListResultIterator) Response() OriginListResult {
1631	return iter.page.Response()
1632}
1633
1634// Value returns the current value or a zero-initialized value if the
1635// iterator has advanced beyond the end of the collection.
1636func (iter OriginListResultIterator) Value() Origin {
1637	if !iter.page.NotDone() {
1638		return Origin{}
1639	}
1640	return iter.page.Values()[iter.i]
1641}
1642
1643// IsEmpty returns true if the ListResult contains no values.
1644func (olr OriginListResult) IsEmpty() bool {
1645	return olr.Value == nil || len(*olr.Value) == 0
1646}
1647
1648// originListResultPreparer prepares a request to retrieve the next set of results.
1649// It returns nil if no more results exist.
1650func (olr OriginListResult) originListResultPreparer() (*http.Request, error) {
1651	if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {
1652		return nil, nil
1653	}
1654	return autorest.Prepare(&http.Request{},
1655		autorest.AsJSON(),
1656		autorest.AsGet(),
1657		autorest.WithBaseURL(to.String(olr.NextLink)))
1658}
1659
1660// OriginListResultPage contains a page of Origin values.
1661type OriginListResultPage struct {
1662	fn  func(OriginListResult) (OriginListResult, error)
1663	olr OriginListResult
1664}
1665
1666// Next advances to the next page of values.  If there was an error making
1667// the request the page does not advance and the error is returned.
1668func (page *OriginListResultPage) Next() error {
1669	next, err := page.fn(page.olr)
1670	if err != nil {
1671		return err
1672	}
1673	page.olr = next
1674	return nil
1675}
1676
1677// NotDone returns true if the page enumeration should be started or is not yet complete.
1678func (page OriginListResultPage) NotDone() bool {
1679	return !page.olr.IsEmpty()
1680}
1681
1682// Response returns the raw server response from the last page request.
1683func (page OriginListResultPage) Response() OriginListResult {
1684	return page.olr
1685}
1686
1687// Values returns the slice of values for the current page or nil if there are no values.
1688func (page OriginListResultPage) Values() []Origin {
1689	if page.olr.IsEmpty() {
1690		return nil
1691	}
1692	return *page.olr.Value
1693}
1694
1695// OriginProperties the JSON object that contains the properties of the origin.
1696type OriginProperties struct {
1697	// HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.
1698	HostName *string `json:"hostName,omitempty"`
1699	// HTTPPort - The value of the HTTP port. Must be between 1 and 65535.
1700	HTTPPort *int32 `json:"httpPort,omitempty"`
1701	// HTTPSPort - The value of the https port. Must be between 1 and 65535.
1702	HTTPSPort *int32 `json:"httpsPort,omitempty"`
1703	// ResourceState - Resource status of the origin. Possible values include: 'OriginResourceStateCreating', 'OriginResourceStateActive', 'OriginResourceStateDeleting'
1704	ResourceState OriginResourceState `json:"resourceState,omitempty"`
1705	// ProvisioningState - Provisioning status of the origin.
1706	ProvisioningState *string `json:"provisioningState,omitempty"`
1707}
1708
1709// OriginPropertiesParameters the JSON object that contains the properties of the origin.
1710type OriginPropertiesParameters struct {
1711	// HostName - The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.
1712	HostName *string `json:"hostName,omitempty"`
1713	// HTTPPort - The value of the HTTP port. Must be between 1 and 65535.
1714	HTTPPort *int32 `json:"httpPort,omitempty"`
1715	// HTTPSPort - The value of the HTTPS port. Must be between 1 and 65535.
1716	HTTPSPort *int32 `json:"httpsPort,omitempty"`
1717}
1718
1719// OriginsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
1720type OriginsUpdateFuture struct {
1721	azure.Future
1722}
1723
1724// Result returns the result of the asynchronous operation.
1725// If the operation has not completed it will return an error.
1726func (future *OriginsUpdateFuture) Result(client OriginsClient) (o Origin, err error) {
1727	var done bool
1728	done, err = future.Done(client)
1729	if err != nil {
1730		err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", future.Response(), "Polling failure")
1731		return
1732	}
1733	if !done {
1734		err = azure.NewAsyncOpIncompleteError("cdn.OriginsUpdateFuture")
1735		return
1736	}
1737	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1738	if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent {
1739		o, err = client.UpdateResponder(o.Response.Response)
1740		if err != nil {
1741			err = autorest.NewErrorWithError(err, "cdn.OriginsUpdateFuture", "Result", o.Response.Response, "Failure responding to request")
1742		}
1743	}
1744	return
1745}
1746
1747// OriginUpdateParameters origin properties needed for origin creation or update.
1748type OriginUpdateParameters struct {
1749	*OriginPropertiesParameters `json:"properties,omitempty"`
1750}
1751
1752// MarshalJSON is the custom marshaler for OriginUpdateParameters.
1753func (oup OriginUpdateParameters) MarshalJSON() ([]byte, error) {
1754	objectMap := make(map[string]interface{})
1755	if oup.OriginPropertiesParameters != nil {
1756		objectMap["properties"] = oup.OriginPropertiesParameters
1757	}
1758	return json.Marshal(objectMap)
1759}
1760
1761// UnmarshalJSON is the custom unmarshaler for OriginUpdateParameters struct.
1762func (oup *OriginUpdateParameters) UnmarshalJSON(body []byte) error {
1763	var m map[string]*json.RawMessage
1764	err := json.Unmarshal(body, &m)
1765	if err != nil {
1766		return err
1767	}
1768	for k, v := range m {
1769		switch k {
1770		case "properties":
1771			if v != nil {
1772				var originPropertiesParameters OriginPropertiesParameters
1773				err = json.Unmarshal(*v, &originPropertiesParameters)
1774				if err != nil {
1775					return err
1776				}
1777				oup.OriginPropertiesParameters = &originPropertiesParameters
1778			}
1779		}
1780	}
1781
1782	return nil
1783}
1784
1785// Profile CDN profile is a logical grouping of endpoints that share the same settings, such as CDN provider and
1786// pricing tier.
1787type Profile struct {
1788	autorest.Response `json:"-"`
1789	// Sku - The pricing tier (defines a CDN provider, feature list and rate) of the CDN profile.
1790	Sku                *Sku `json:"sku,omitempty"`
1791	*ProfileProperties `json:"properties,omitempty"`
1792	// Location - Resource location.
1793	Location *string `json:"location,omitempty"`
1794	// Tags - Resource tags.
1795	Tags map[string]*string `json:"tags"`
1796	// ID - Resource ID.
1797	ID *string `json:"id,omitempty"`
1798	// Name - Resource name.
1799	Name *string `json:"name,omitempty"`
1800	// Type - Resource type.
1801	Type *string `json:"type,omitempty"`
1802}
1803
1804// MarshalJSON is the custom marshaler for Profile.
1805func (p Profile) MarshalJSON() ([]byte, error) {
1806	objectMap := make(map[string]interface{})
1807	if p.Sku != nil {
1808		objectMap["sku"] = p.Sku
1809	}
1810	if p.ProfileProperties != nil {
1811		objectMap["properties"] = p.ProfileProperties
1812	}
1813	if p.Location != nil {
1814		objectMap["location"] = p.Location
1815	}
1816	if p.Tags != nil {
1817		objectMap["tags"] = p.Tags
1818	}
1819	if p.ID != nil {
1820		objectMap["id"] = p.ID
1821	}
1822	if p.Name != nil {
1823		objectMap["name"] = p.Name
1824	}
1825	if p.Type != nil {
1826		objectMap["type"] = p.Type
1827	}
1828	return json.Marshal(objectMap)
1829}
1830
1831// UnmarshalJSON is the custom unmarshaler for Profile struct.
1832func (p *Profile) UnmarshalJSON(body []byte) error {
1833	var m map[string]*json.RawMessage
1834	err := json.Unmarshal(body, &m)
1835	if err != nil {
1836		return err
1837	}
1838	for k, v := range m {
1839		switch k {
1840		case "sku":
1841			if v != nil {
1842				var sku Sku
1843				err = json.Unmarshal(*v, &sku)
1844				if err != nil {
1845					return err
1846				}
1847				p.Sku = &sku
1848			}
1849		case "properties":
1850			if v != nil {
1851				var profileProperties ProfileProperties
1852				err = json.Unmarshal(*v, &profileProperties)
1853				if err != nil {
1854					return err
1855				}
1856				p.ProfileProperties = &profileProperties
1857			}
1858		case "location":
1859			if v != nil {
1860				var location string
1861				err = json.Unmarshal(*v, &location)
1862				if err != nil {
1863					return err
1864				}
1865				p.Location = &location
1866			}
1867		case "tags":
1868			if v != nil {
1869				var tags map[string]*string
1870				err = json.Unmarshal(*v, &tags)
1871				if err != nil {
1872					return err
1873				}
1874				p.Tags = tags
1875			}
1876		case "id":
1877			if v != nil {
1878				var ID string
1879				err = json.Unmarshal(*v, &ID)
1880				if err != nil {
1881					return err
1882				}
1883				p.ID = &ID
1884			}
1885		case "name":
1886			if v != nil {
1887				var name string
1888				err = json.Unmarshal(*v, &name)
1889				if err != nil {
1890					return err
1891				}
1892				p.Name = &name
1893			}
1894		case "type":
1895			if v != nil {
1896				var typeVar string
1897				err = json.Unmarshal(*v, &typeVar)
1898				if err != nil {
1899					return err
1900				}
1901				p.Type = &typeVar
1902			}
1903		}
1904	}
1905
1906	return nil
1907}
1908
1909// ProfileListResult result of the request to list profiles. It contains a list of profile objects and a URL link
1910// to get the the next set of results.
1911type ProfileListResult struct {
1912	autorest.Response `json:"-"`
1913	// Value - List of CDN profiles within a resource group.
1914	Value *[]Profile `json:"value,omitempty"`
1915	// NextLink - URL to get the next set of profile objects if there are any.
1916	NextLink *string `json:"nextLink,omitempty"`
1917}
1918
1919// ProfileListResultIterator provides access to a complete listing of Profile values.
1920type ProfileListResultIterator struct {
1921	i    int
1922	page ProfileListResultPage
1923}
1924
1925// Next advances to the next value.  If there was an error making
1926// the request the iterator does not advance and the error is returned.
1927func (iter *ProfileListResultIterator) Next() error {
1928	iter.i++
1929	if iter.i < len(iter.page.Values()) {
1930		return nil
1931	}
1932	err := iter.page.Next()
1933	if err != nil {
1934		iter.i--
1935		return err
1936	}
1937	iter.i = 0
1938	return nil
1939}
1940
1941// NotDone returns true if the enumeration should be started or is not yet complete.
1942func (iter ProfileListResultIterator) NotDone() bool {
1943	return iter.page.NotDone() && iter.i < len(iter.page.Values())
1944}
1945
1946// Response returns the raw server response from the last page request.
1947func (iter ProfileListResultIterator) Response() ProfileListResult {
1948	return iter.page.Response()
1949}
1950
1951// Value returns the current value or a zero-initialized value if the
1952// iterator has advanced beyond the end of the collection.
1953func (iter ProfileListResultIterator) Value() Profile {
1954	if !iter.page.NotDone() {
1955		return Profile{}
1956	}
1957	return iter.page.Values()[iter.i]
1958}
1959
1960// IsEmpty returns true if the ListResult contains no values.
1961func (plr ProfileListResult) IsEmpty() bool {
1962	return plr.Value == nil || len(*plr.Value) == 0
1963}
1964
1965// profileListResultPreparer prepares a request to retrieve the next set of results.
1966// It returns nil if no more results exist.
1967func (plr ProfileListResult) profileListResultPreparer() (*http.Request, error) {
1968	if plr.NextLink == nil || len(to.String(plr.NextLink)) < 1 {
1969		return nil, nil
1970	}
1971	return autorest.Prepare(&http.Request{},
1972		autorest.AsJSON(),
1973		autorest.AsGet(),
1974		autorest.WithBaseURL(to.String(plr.NextLink)))
1975}
1976
1977// ProfileListResultPage contains a page of Profile values.
1978type ProfileListResultPage struct {
1979	fn  func(ProfileListResult) (ProfileListResult, error)
1980	plr ProfileListResult
1981}
1982
1983// Next advances to the next page of values.  If there was an error making
1984// the request the page does not advance and the error is returned.
1985func (page *ProfileListResultPage) Next() error {
1986	next, err := page.fn(page.plr)
1987	if err != nil {
1988		return err
1989	}
1990	page.plr = next
1991	return nil
1992}
1993
1994// NotDone returns true if the page enumeration should be started or is not yet complete.
1995func (page ProfileListResultPage) NotDone() bool {
1996	return !page.plr.IsEmpty()
1997}
1998
1999// Response returns the raw server response from the last page request.
2000func (page ProfileListResultPage) Response() ProfileListResult {
2001	return page.plr
2002}
2003
2004// Values returns the slice of values for the current page or nil if there are no values.
2005func (page ProfileListResultPage) Values() []Profile {
2006	if page.plr.IsEmpty() {
2007		return nil
2008	}
2009	return *page.plr.Value
2010}
2011
2012// ProfileProperties the JSON object that contains the properties required to create a profile.
2013type ProfileProperties struct {
2014	// ResourceState - Resource status of the profile. Possible values include: 'ProfileResourceStateCreating', 'ProfileResourceStateActive', 'ProfileResourceStateDeleting', 'ProfileResourceStateDisabled'
2015	ResourceState ProfileResourceState `json:"resourceState,omitempty"`
2016	// ProvisioningState - Provisioning status of the profile.
2017	ProvisioningState *string `json:"provisioningState,omitempty"`
2018}
2019
2020// ProfilesCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
2021type ProfilesCreateFuture struct {
2022	azure.Future
2023}
2024
2025// Result returns the result of the asynchronous operation.
2026// If the operation has not completed it will return an error.
2027func (future *ProfilesCreateFuture) Result(client ProfilesClient) (p Profile, err error) {
2028	var done bool
2029	done, err = future.Done(client)
2030	if err != nil {
2031		err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", future.Response(), "Polling failure")
2032		return
2033	}
2034	if !done {
2035		err = azure.NewAsyncOpIncompleteError("cdn.ProfilesCreateFuture")
2036		return
2037	}
2038	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2039	if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent {
2040		p, err = client.CreateResponder(p.Response.Response)
2041		if err != nil {
2042			err = autorest.NewErrorWithError(err, "cdn.ProfilesCreateFuture", "Result", p.Response.Response, "Failure responding to request")
2043		}
2044	}
2045	return
2046}
2047
2048// ProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
2049type ProfilesDeleteFuture struct {
2050	azure.Future
2051}
2052
2053// Result returns the result of the asynchronous operation.
2054// If the operation has not completed it will return an error.
2055func (future *ProfilesDeleteFuture) Result(client ProfilesClient) (ar autorest.Response, err error) {
2056	var done bool
2057	done, err = future.Done(client)
2058	if err != nil {
2059		err = autorest.NewErrorWithError(err, "cdn.ProfilesDeleteFuture", "Result", future.Response(), "Polling failure")
2060		return
2061	}
2062	if !done {
2063		err = azure.NewAsyncOpIncompleteError("cdn.ProfilesDeleteFuture")
2064		return
2065	}
2066	ar.Response = future.Response()
2067	return
2068}
2069
2070// ProfilesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
2071type ProfilesUpdateFuture struct {
2072	azure.Future
2073}
2074
2075// Result returns the result of the asynchronous operation.
2076// If the operation has not completed it will return an error.
2077func (future *ProfilesUpdateFuture) Result(client ProfilesClient) (p Profile, err error) {
2078	var done bool
2079	done, err = future.Done(client)
2080	if err != nil {
2081		err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", future.Response(), "Polling failure")
2082		return
2083	}
2084	if !done {
2085		err = azure.NewAsyncOpIncompleteError("cdn.ProfilesUpdateFuture")
2086		return
2087	}
2088	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
2089	if p.Response.Response, err = future.GetResult(sender); err == nil && p.Response.Response.StatusCode != http.StatusNoContent {
2090		p, err = client.UpdateResponder(p.Response.Response)
2091		if err != nil {
2092			err = autorest.NewErrorWithError(err, "cdn.ProfilesUpdateFuture", "Result", p.Response.Response, "Failure responding to request")
2093		}
2094	}
2095	return
2096}
2097
2098// ProfileUpdateParameters properties required to update a profile.
2099type ProfileUpdateParameters struct {
2100	// Tags - Profile tags
2101	Tags map[string]*string `json:"tags"`
2102}
2103
2104// MarshalJSON is the custom marshaler for ProfileUpdateParameters.
2105func (pup ProfileUpdateParameters) MarshalJSON() ([]byte, error) {
2106	objectMap := make(map[string]interface{})
2107	if pup.Tags != nil {
2108		objectMap["tags"] = pup.Tags
2109	}
2110	return json.Marshal(objectMap)
2111}
2112
2113// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than
2114// required location and tags
2115type ProxyResource struct {
2116	// ID - Resource ID.
2117	ID *string `json:"id,omitempty"`
2118	// Name - Resource name.
2119	Name *string `json:"name,omitempty"`
2120	// Type - Resource type.
2121	Type *string `json:"type,omitempty"`
2122}
2123
2124// PurgeParameters parameters required for content purge.
2125type PurgeParameters struct {
2126	// ContentPaths - The path to the content to be purged. Can describe a file path or a wild card directory.
2127	ContentPaths *[]string `json:"contentPaths,omitempty"`
2128}
2129
2130// Resource the core properties of ARM resources
2131type Resource struct {
2132	// ID - Resource ID.
2133	ID *string `json:"id,omitempty"`
2134	// Name - Resource name.
2135	Name *string `json:"name,omitempty"`
2136	// Type - Resource type.
2137	Type *string `json:"type,omitempty"`
2138}
2139
2140// ResourceUsage output of check resource usage API.
2141type ResourceUsage struct {
2142	// ResourceType - Resource type for which the usage is provided.
2143	ResourceType *string `json:"resourceType,omitempty"`
2144	// Unit - Unit of the usage. e.g. Count.
2145	Unit *string `json:"unit,omitempty"`
2146	// CurrentValue - Actual value of usage on the specified resource type.
2147	CurrentValue *int32 `json:"currentValue,omitempty"`
2148	// Limit - Quota of the specified resource type.
2149	Limit *int32 `json:"limit,omitempty"`
2150}
2151
2152// ResourceUsageListResult output of check resource usage API.
2153type ResourceUsageListResult struct {
2154	autorest.Response `json:"-"`
2155	// Value - List of resource usages.
2156	Value *[]ResourceUsage `json:"value,omitempty"`
2157	// NextLink - URL to get the next set of custom domain objects if there are any.
2158	NextLink *string `json:"nextLink,omitempty"`
2159}
2160
2161// ResourceUsageListResultIterator provides access to a complete listing of ResourceUsage values.
2162type ResourceUsageListResultIterator struct {
2163	i    int
2164	page ResourceUsageListResultPage
2165}
2166
2167// Next advances to the next value.  If there was an error making
2168// the request the iterator does not advance and the error is returned.
2169func (iter *ResourceUsageListResultIterator) Next() error {
2170	iter.i++
2171	if iter.i < len(iter.page.Values()) {
2172		return nil
2173	}
2174	err := iter.page.Next()
2175	if err != nil {
2176		iter.i--
2177		return err
2178	}
2179	iter.i = 0
2180	return nil
2181}
2182
2183// NotDone returns true if the enumeration should be started or is not yet complete.
2184func (iter ResourceUsageListResultIterator) NotDone() bool {
2185	return iter.page.NotDone() && iter.i < len(iter.page.Values())
2186}
2187
2188// Response returns the raw server response from the last page request.
2189func (iter ResourceUsageListResultIterator) Response() ResourceUsageListResult {
2190	return iter.page.Response()
2191}
2192
2193// Value returns the current value or a zero-initialized value if the
2194// iterator has advanced beyond the end of the collection.
2195func (iter ResourceUsageListResultIterator) Value() ResourceUsage {
2196	if !iter.page.NotDone() {
2197		return ResourceUsage{}
2198	}
2199	return iter.page.Values()[iter.i]
2200}
2201
2202// IsEmpty returns true if the ListResult contains no values.
2203func (rulr ResourceUsageListResult) IsEmpty() bool {
2204	return rulr.Value == nil || len(*rulr.Value) == 0
2205}
2206
2207// resourceUsageListResultPreparer prepares a request to retrieve the next set of results.
2208// It returns nil if no more results exist.
2209func (rulr ResourceUsageListResult) resourceUsageListResultPreparer() (*http.Request, error) {
2210	if rulr.NextLink == nil || len(to.String(rulr.NextLink)) < 1 {
2211		return nil, nil
2212	}
2213	return autorest.Prepare(&http.Request{},
2214		autorest.AsJSON(),
2215		autorest.AsGet(),
2216		autorest.WithBaseURL(to.String(rulr.NextLink)))
2217}
2218
2219// ResourceUsageListResultPage contains a page of ResourceUsage values.
2220type ResourceUsageListResultPage struct {
2221	fn   func(ResourceUsageListResult) (ResourceUsageListResult, error)
2222	rulr ResourceUsageListResult
2223}
2224
2225// Next advances to the next page of values.  If there was an error making
2226// the request the page does not advance and the error is returned.
2227func (page *ResourceUsageListResultPage) Next() error {
2228	next, err := page.fn(page.rulr)
2229	if err != nil {
2230		return err
2231	}
2232	page.rulr = next
2233	return nil
2234}
2235
2236// NotDone returns true if the page enumeration should be started or is not yet complete.
2237func (page ResourceUsageListResultPage) NotDone() bool {
2238	return !page.rulr.IsEmpty()
2239}
2240
2241// Response returns the raw server response from the last page request.
2242func (page ResourceUsageListResultPage) Response() ResourceUsageListResult {
2243	return page.rulr
2244}
2245
2246// Values returns the slice of values for the current page or nil if there are no values.
2247func (page ResourceUsageListResultPage) Values() []ResourceUsage {
2248	if page.rulr.IsEmpty() {
2249		return nil
2250	}
2251	return *page.rulr.Value
2252}
2253
2254// Sku the pricing tier (defines a CDN provider, feature list and rate) of the CDN profile.
2255type Sku struct {
2256	// Name - Name of the pricing tier. Possible values include: 'StandardVerizon', 'PremiumVerizon', 'CustomVerizon', 'StandardAkamai', 'StandardChinaCdn'
2257	Name SkuName `json:"name,omitempty"`
2258}
2259
2260// SsoURI the URI required to login to the supplemental portal from the Azure portal.
2261type SsoURI struct {
2262	autorest.Response `json:"-"`
2263	// SsoURIValue - The URI used to login to the supplemental portal.
2264	SsoURIValue *string `json:"ssoUriValue,omitempty"`
2265}
2266
2267// SupportedOptimizationTypesListResult the result of the GetSupportedOptimizationTypes API
2268type SupportedOptimizationTypesListResult struct {
2269	autorest.Response `json:"-"`
2270	// SupportedOptimizationTypes - Supported optimization types for a profile.
2271	SupportedOptimizationTypes *[]OptimizationType `json:"supportedOptimizationTypes,omitempty"`
2272}
2273
2274// TrackedResource the resource model definition for a ARM tracked top level resource.
2275type TrackedResource struct {
2276	// Location - Resource location.
2277	Location *string `json:"location,omitempty"`
2278	// Tags - Resource tags.
2279	Tags map[string]*string `json:"tags"`
2280	// ID - Resource ID.
2281	ID *string `json:"id,omitempty"`
2282	// Name - Resource name.
2283	Name *string `json:"name,omitempty"`
2284	// Type - Resource type.
2285	Type *string `json:"type,omitempty"`
2286}
2287
2288// MarshalJSON is the custom marshaler for TrackedResource.
2289func (tr TrackedResource) MarshalJSON() ([]byte, error) {
2290	objectMap := make(map[string]interface{})
2291	if tr.Location != nil {
2292		objectMap["location"] = tr.Location
2293	}
2294	if tr.Tags != nil {
2295		objectMap["tags"] = tr.Tags
2296	}
2297	if tr.ID != nil {
2298		objectMap["id"] = tr.ID
2299	}
2300	if tr.Name != nil {
2301		objectMap["name"] = tr.Name
2302	}
2303	if tr.Type != nil {
2304		objectMap["type"] = tr.Type
2305	}
2306	return json.Marshal(objectMap)
2307}
2308
2309// ValidateCustomDomainInput input of the custom domain to be validated for DNS mapping.
2310type ValidateCustomDomainInput struct {
2311	// HostName - The host name of the custom domain. Must be a domain name.
2312	HostName *string `json:"hostName,omitempty"`
2313}
2314
2315// ValidateCustomDomainOutput output of custom domain validation.
2316type ValidateCustomDomainOutput struct {
2317	autorest.Response `json:"-"`
2318	// CustomDomainValidated - Indicates whether the custom domain is valid or not.
2319	CustomDomainValidated *bool `json:"customDomainValidated,omitempty"`
2320	// Reason - The reason why the custom domain is not valid.
2321	Reason *string `json:"reason,omitempty"`
2322	// Message - Error message describing why the custom domain is not valid.
2323	Message *string `json:"message,omitempty"`
2324}
2325
2326// ValidateProbeInput input of the validate probe API.
2327type ValidateProbeInput struct {
2328	// ProbeURL - The probe URL to validate.
2329	ProbeURL *string `json:"probeURL,omitempty"`
2330}
2331
2332// ValidateProbeOutput output of the validate probe API.
2333type ValidateProbeOutput struct {
2334	autorest.Response `json:"-"`
2335	// IsValid - Indicates whether the probe URL is accepted or not.
2336	IsValid *bool `json:"isValid,omitempty"`
2337	// ErrorCode - Specifies the error code when the probe url is not accepted.
2338	ErrorCode *string `json:"errorCode,omitempty"`
2339	// Message - The detailed error message describing why the probe URL is not accepted.
2340	Message *string `json:"message,omitempty"`
2341}
2342