1package support
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	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"net/http"
29)
30
31// The package's fully qualified name.
32const fqdn = "github.com/Azure/azure-sdk-for-go/services/support/mgmt/2020-04-01/support"
33
34// CheckNameAvailabilityInput input of CheckNameAvailability API.
35type CheckNameAvailabilityInput struct {
36	// Name - The resource name to validate.
37	Name *string `json:"name,omitempty"`
38	// Type - The type of resource. Possible values include: 'MicrosoftSupportsupportTickets', 'MicrosoftSupportcommunications'
39	Type Type `json:"type,omitempty"`
40}
41
42// CheckNameAvailabilityOutput output of check name availability API.
43type CheckNameAvailabilityOutput struct {
44	autorest.Response `json:"-"`
45	// NameAvailable - READ-ONLY; Indicates whether the name is available.
46	NameAvailable *bool `json:"nameAvailable,omitempty"`
47	// Reason - READ-ONLY; The reason why the name is not available.
48	Reason *string `json:"reason,omitempty"`
49	// Message - READ-ONLY; The detailed error message describing why the name is not available.
50	Message *string `json:"message,omitempty"`
51}
52
53// CommunicationDetails object that represents a Communication resource.
54type CommunicationDetails struct {
55	autorest.Response `json:"-"`
56	// ID - READ-ONLY; Id of the resource.
57	ID *string `json:"id,omitempty"`
58	// Name - READ-ONLY; Name of the resource.
59	Name *string `json:"name,omitempty"`
60	// Type - READ-ONLY; Type of the resource 'Microsoft.Support/communications'.
61	Type *string `json:"type,omitempty"`
62	// CommunicationDetailsProperties - Properties of the resource.
63	*CommunicationDetailsProperties `json:"properties,omitempty"`
64}
65
66// MarshalJSON is the custom marshaler for CommunicationDetails.
67func (cd CommunicationDetails) MarshalJSON() ([]byte, error) {
68	objectMap := make(map[string]interface{})
69	if cd.CommunicationDetailsProperties != nil {
70		objectMap["properties"] = cd.CommunicationDetailsProperties
71	}
72	return json.Marshal(objectMap)
73}
74
75// UnmarshalJSON is the custom unmarshaler for CommunicationDetails struct.
76func (cd *CommunicationDetails) UnmarshalJSON(body []byte) error {
77	var m map[string]*json.RawMessage
78	err := json.Unmarshal(body, &m)
79	if err != nil {
80		return err
81	}
82	for k, v := range m {
83		switch k {
84		case "id":
85			if v != nil {
86				var ID string
87				err = json.Unmarshal(*v, &ID)
88				if err != nil {
89					return err
90				}
91				cd.ID = &ID
92			}
93		case "name":
94			if v != nil {
95				var name string
96				err = json.Unmarshal(*v, &name)
97				if err != nil {
98					return err
99				}
100				cd.Name = &name
101			}
102		case "type":
103			if v != nil {
104				var typeVar string
105				err = json.Unmarshal(*v, &typeVar)
106				if err != nil {
107					return err
108				}
109				cd.Type = &typeVar
110			}
111		case "properties":
112			if v != nil {
113				var communicationDetailsProperties CommunicationDetailsProperties
114				err = json.Unmarshal(*v, &communicationDetailsProperties)
115				if err != nil {
116					return err
117				}
118				cd.CommunicationDetailsProperties = &communicationDetailsProperties
119			}
120		}
121	}
122
123	return nil
124}
125
126// CommunicationDetailsProperties describes the properties of a communication resource.
127type CommunicationDetailsProperties struct {
128	// CommunicationType - READ-ONLY; Communication type. Possible values include: 'Web', 'Phone'
129	CommunicationType CommunicationType `json:"communicationType,omitempty"`
130	// CommunicationDirection - READ-ONLY; Direction of communication. Possible values include: 'Inbound', 'Outbound'
131	CommunicationDirection CommunicationDirection `json:"communicationDirection,omitempty"`
132	// Sender - Email address of the sender. This property is required if called by a service principal.
133	Sender *string `json:"sender,omitempty"`
134	// Subject - Subject of the communication.
135	Subject *string `json:"subject,omitempty"`
136	// Body - Body of the communication.
137	Body *string `json:"body,omitempty"`
138	// CreatedDate - READ-ONLY; Time in UTC (ISO 8601 format) when the communication was created.
139	CreatedDate *date.Time `json:"createdDate,omitempty"`
140}
141
142// MarshalJSON is the custom marshaler for CommunicationDetailsProperties.
143func (cdp CommunicationDetailsProperties) MarshalJSON() ([]byte, error) {
144	objectMap := make(map[string]interface{})
145	if cdp.Sender != nil {
146		objectMap["sender"] = cdp.Sender
147	}
148	if cdp.Subject != nil {
149		objectMap["subject"] = cdp.Subject
150	}
151	if cdp.Body != nil {
152		objectMap["body"] = cdp.Body
153	}
154	return json.Marshal(objectMap)
155}
156
157// CommunicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
158// operation.
159type CommunicationsCreateFuture struct {
160	azure.FutureAPI
161	// Result returns the result of the asynchronous operation.
162	// If the operation has not completed it will return an error.
163	Result func(CommunicationsClient) (CommunicationDetails, error)
164}
165
166// CommunicationsListResult collection of Communication resources.
167type CommunicationsListResult struct {
168	autorest.Response `json:"-"`
169	// Value - List of Communication resources.
170	Value *[]CommunicationDetails `json:"value,omitempty"`
171	// NextLink - The URI to fetch the next page of Communication resources.
172	NextLink *string `json:"nextLink,omitempty"`
173}
174
175// CommunicationsListResultIterator provides access to a complete listing of CommunicationDetails values.
176type CommunicationsListResultIterator struct {
177	i    int
178	page CommunicationsListResultPage
179}
180
181// NextWithContext advances to the next value.  If there was an error making
182// the request the iterator does not advance and the error is returned.
183func (iter *CommunicationsListResultIterator) NextWithContext(ctx context.Context) (err error) {
184	if tracing.IsEnabled() {
185		ctx = tracing.StartSpan(ctx, fqdn+"/CommunicationsListResultIterator.NextWithContext")
186		defer func() {
187			sc := -1
188			if iter.Response().Response.Response != nil {
189				sc = iter.Response().Response.Response.StatusCode
190			}
191			tracing.EndSpan(ctx, sc, err)
192		}()
193	}
194	iter.i++
195	if iter.i < len(iter.page.Values()) {
196		return nil
197	}
198	err = iter.page.NextWithContext(ctx)
199	if err != nil {
200		iter.i--
201		return err
202	}
203	iter.i = 0
204	return nil
205}
206
207// Next advances to the next value.  If there was an error making
208// the request the iterator does not advance and the error is returned.
209// Deprecated: Use NextWithContext() instead.
210func (iter *CommunicationsListResultIterator) Next() error {
211	return iter.NextWithContext(context.Background())
212}
213
214// NotDone returns true if the enumeration should be started or is not yet complete.
215func (iter CommunicationsListResultIterator) NotDone() bool {
216	return iter.page.NotDone() && iter.i < len(iter.page.Values())
217}
218
219// Response returns the raw server response from the last page request.
220func (iter CommunicationsListResultIterator) Response() CommunicationsListResult {
221	return iter.page.Response()
222}
223
224// Value returns the current value or a zero-initialized value if the
225// iterator has advanced beyond the end of the collection.
226func (iter CommunicationsListResultIterator) Value() CommunicationDetails {
227	if !iter.page.NotDone() {
228		return CommunicationDetails{}
229	}
230	return iter.page.Values()[iter.i]
231}
232
233// Creates a new instance of the CommunicationsListResultIterator type.
234func NewCommunicationsListResultIterator(page CommunicationsListResultPage) CommunicationsListResultIterator {
235	return CommunicationsListResultIterator{page: page}
236}
237
238// IsEmpty returns true if the ListResult contains no values.
239func (clr CommunicationsListResult) IsEmpty() bool {
240	return clr.Value == nil || len(*clr.Value) == 0
241}
242
243// hasNextLink returns true if the NextLink is not empty.
244func (clr CommunicationsListResult) hasNextLink() bool {
245	return clr.NextLink != nil && len(*clr.NextLink) != 0
246}
247
248// communicationsListResultPreparer prepares a request to retrieve the next set of results.
249// It returns nil if no more results exist.
250func (clr CommunicationsListResult) communicationsListResultPreparer(ctx context.Context) (*http.Request, error) {
251	if !clr.hasNextLink() {
252		return nil, nil
253	}
254	return autorest.Prepare((&http.Request{}).WithContext(ctx),
255		autorest.AsJSON(),
256		autorest.AsGet(),
257		autorest.WithBaseURL(to.String(clr.NextLink)))
258}
259
260// CommunicationsListResultPage contains a page of CommunicationDetails values.
261type CommunicationsListResultPage struct {
262	fn  func(context.Context, CommunicationsListResult) (CommunicationsListResult, error)
263	clr CommunicationsListResult
264}
265
266// NextWithContext advances to the next page of values.  If there was an error making
267// the request the page does not advance and the error is returned.
268func (page *CommunicationsListResultPage) NextWithContext(ctx context.Context) (err error) {
269	if tracing.IsEnabled() {
270		ctx = tracing.StartSpan(ctx, fqdn+"/CommunicationsListResultPage.NextWithContext")
271		defer func() {
272			sc := -1
273			if page.Response().Response.Response != nil {
274				sc = page.Response().Response.Response.StatusCode
275			}
276			tracing.EndSpan(ctx, sc, err)
277		}()
278	}
279	for {
280		next, err := page.fn(ctx, page.clr)
281		if err != nil {
282			return err
283		}
284		page.clr = next
285		if !next.hasNextLink() || !next.IsEmpty() {
286			break
287		}
288	}
289	return nil
290}
291
292// Next advances to the next page of values.  If there was an error making
293// the request the page does not advance and the error is returned.
294// Deprecated: Use NextWithContext() instead.
295func (page *CommunicationsListResultPage) Next() error {
296	return page.NextWithContext(context.Background())
297}
298
299// NotDone returns true if the page enumeration should be started or is not yet complete.
300func (page CommunicationsListResultPage) NotDone() bool {
301	return !page.clr.IsEmpty()
302}
303
304// Response returns the raw server response from the last page request.
305func (page CommunicationsListResultPage) Response() CommunicationsListResult {
306	return page.clr
307}
308
309// Values returns the slice of values for the current page or nil if there are no values.
310func (page CommunicationsListResultPage) Values() []CommunicationDetails {
311	if page.clr.IsEmpty() {
312		return nil
313	}
314	return *page.clr.Value
315}
316
317// Creates a new instance of the CommunicationsListResultPage type.
318func NewCommunicationsListResultPage(cur CommunicationsListResult, getNextPage func(context.Context, CommunicationsListResult) (CommunicationsListResult, error)) CommunicationsListResultPage {
319	return CommunicationsListResultPage{
320		fn:  getNextPage,
321		clr: cur,
322	}
323}
324
325// ContactProfile contact information associated with the support ticket.
326type ContactProfile struct {
327	// FirstName - First name.
328	FirstName *string `json:"firstName,omitempty"`
329	// LastName - Last name.
330	LastName *string `json:"lastName,omitempty"`
331	// PreferredContactMethod - Preferred contact method. Possible values include: 'PreferredContactMethodEmail', 'PreferredContactMethodPhone'
332	PreferredContactMethod PreferredContactMethod `json:"preferredContactMethod,omitempty"`
333	// PrimaryEmailAddress - Primary email address.
334	PrimaryEmailAddress *string `json:"primaryEmailAddress,omitempty"`
335	// AdditionalEmailAddresses - Additional email addresses listed will be copied on any correspondence about the support ticket.
336	AdditionalEmailAddresses *[]string `json:"additionalEmailAddresses,omitempty"`
337	// PhoneNumber - Phone number. This is required if preferred contact method is phone.
338	PhoneNumber *string `json:"phoneNumber,omitempty"`
339	// PreferredTimeZone - Time zone of the user. This is the name of the time zone from [Microsoft Time Zone Index Values](https://support.microsoft.com/help/973627/microsoft-time-zone-index-values).
340	PreferredTimeZone *string `json:"preferredTimeZone,omitempty"`
341	// Country - Country of the user. This is the ISO 3166-1 alpha-3 code.
342	Country *string `json:"country,omitempty"`
343	// PreferredSupportLanguage - Preferred language of support from Azure. Support languages vary based on the severity you choose for your support ticket. Learn more at [Azure Severity and responsiveness](https://azure.microsoft.com/support/plans/response). Use the standard language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German.
344	PreferredSupportLanguage *string `json:"preferredSupportLanguage,omitempty"`
345}
346
347// Engineer support engineer information.
348type Engineer struct {
349	// EmailAddress - READ-ONLY; Email address of the Azure Support engineer assigned to the support ticket.
350	EmailAddress *string `json:"emailAddress,omitempty"`
351}
352
353// ExceptionResponse the API error.
354type ExceptionResponse struct {
355	// Error - The API error details.
356	Error *ServiceError `json:"error,omitempty"`
357}
358
359// Operation the operation supported by Microsoft Support resource provider.
360type Operation struct {
361	// Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}.
362	Name *string `json:"name,omitempty"`
363	// Display - The object that describes the operation.
364	Display *OperationDisplay `json:"display,omitempty"`
365}
366
367// MarshalJSON is the custom marshaler for Operation.
368func (o Operation) MarshalJSON() ([]byte, error) {
369	objectMap := make(map[string]interface{})
370	if o.Display != nil {
371		objectMap["display"] = o.Display
372	}
373	return json.Marshal(objectMap)
374}
375
376// OperationDisplay the object that describes the operation.
377type OperationDisplay struct {
378	// Description - READ-ONLY; The description of the operation.
379	Description *string `json:"description,omitempty"`
380	// Operation - READ-ONLY; The action that users can perform, based on their permission level.
381	Operation *string `json:"operation,omitempty"`
382	// Provider - READ-ONLY; Service provider: Microsoft Support.
383	Provider *string `json:"provider,omitempty"`
384	// Resource - READ-ONLY; Resource on which the operation is performed.
385	Resource *string `json:"resource,omitempty"`
386}
387
388// OperationsListResult the list of operations supported by Microsoft Support resource provider.
389type OperationsListResult struct {
390	autorest.Response `json:"-"`
391	// Value - The list of operations supported by Microsoft Support resource provider.
392	Value *[]Operation `json:"value,omitempty"`
393}
394
395// ProblemClassification problemClassification resource object.
396type ProblemClassification struct {
397	autorest.Response `json:"-"`
398	// ID - READ-ONLY; Id of the resource.
399	ID *string `json:"id,omitempty"`
400	// Name - READ-ONLY; Name of the resource.
401	Name *string `json:"name,omitempty"`
402	// Type - READ-ONLY; Type of the resource 'Microsoft.Support/problemClassification'.
403	Type *string `json:"type,omitempty"`
404	// ProblemClassificationProperties - Properties of the resource.
405	*ProblemClassificationProperties `json:"properties,omitempty"`
406}
407
408// MarshalJSON is the custom marshaler for ProblemClassification.
409func (pc ProblemClassification) MarshalJSON() ([]byte, error) {
410	objectMap := make(map[string]interface{})
411	if pc.ProblemClassificationProperties != nil {
412		objectMap["properties"] = pc.ProblemClassificationProperties
413	}
414	return json.Marshal(objectMap)
415}
416
417// UnmarshalJSON is the custom unmarshaler for ProblemClassification struct.
418func (pc *ProblemClassification) UnmarshalJSON(body []byte) error {
419	var m map[string]*json.RawMessage
420	err := json.Unmarshal(body, &m)
421	if err != nil {
422		return err
423	}
424	for k, v := range m {
425		switch k {
426		case "id":
427			if v != nil {
428				var ID string
429				err = json.Unmarshal(*v, &ID)
430				if err != nil {
431					return err
432				}
433				pc.ID = &ID
434			}
435		case "name":
436			if v != nil {
437				var name string
438				err = json.Unmarshal(*v, &name)
439				if err != nil {
440					return err
441				}
442				pc.Name = &name
443			}
444		case "type":
445			if v != nil {
446				var typeVar string
447				err = json.Unmarshal(*v, &typeVar)
448				if err != nil {
449					return err
450				}
451				pc.Type = &typeVar
452			}
453		case "properties":
454			if v != nil {
455				var problemClassificationProperties ProblemClassificationProperties
456				err = json.Unmarshal(*v, &problemClassificationProperties)
457				if err != nil {
458					return err
459				}
460				pc.ProblemClassificationProperties = &problemClassificationProperties
461			}
462		}
463	}
464
465	return nil
466}
467
468// ProblemClassificationProperties details about a problem classification available for an Azure service.
469type ProblemClassificationProperties struct {
470	// DisplayName - Localized name of problem classification.
471	DisplayName *string `json:"displayName,omitempty"`
472}
473
474// ProblemClassificationsListResult collection of ProblemClassification resources.
475type ProblemClassificationsListResult struct {
476	autorest.Response `json:"-"`
477	// Value - List of ProblemClassification resources.
478	Value *[]ProblemClassification `json:"value,omitempty"`
479}
480
481// QuotaChangeRequest this property is required for providing the region and new quota limits.
482type QuotaChangeRequest struct {
483	// Region - Region for which the quota increase request is being made.
484	Region *string `json:"region,omitempty"`
485	// Payload - Payload of the quota increase request.
486	Payload *string `json:"payload,omitempty"`
487}
488
489// QuotaTicketDetails additional set of information required for quota increase support ticket for certain
490// quota types, e.g.: Virtual machine cores. Get complete details about Quota payload support request along
491// with examples at [Support quota request](https://aka.ms/supportrpquotarequestpayload).
492type QuotaTicketDetails struct {
493	// QuotaChangeRequestSubType - Required for certain quota types when there is a sub type, such as Batch, for which you are requesting a quota increase.
494	QuotaChangeRequestSubType *string `json:"quotaChangeRequestSubType,omitempty"`
495	// QuotaChangeRequestVersion - Quota change request version.
496	QuotaChangeRequestVersion *string `json:"quotaChangeRequestVersion,omitempty"`
497	// QuotaChangeRequests - This property is required for providing the region and new quota limits.
498	QuotaChangeRequests *[]QuotaChangeRequest `json:"quotaChangeRequests,omitempty"`
499}
500
501// Service object that represents a Service resource.
502type Service struct {
503	autorest.Response `json:"-"`
504	// ID - READ-ONLY; Id of the resource.
505	ID *string `json:"id,omitempty"`
506	// Name - READ-ONLY; Name of the resource.
507	Name *string `json:"name,omitempty"`
508	// Type - READ-ONLY; Type of the resource 'Microsoft.Support/services'.
509	Type *string `json:"type,omitempty"`
510	// ServiceProperties - Properties of the resource.
511	*ServiceProperties `json:"properties,omitempty"`
512}
513
514// MarshalJSON is the custom marshaler for Service.
515func (s Service) MarshalJSON() ([]byte, error) {
516	objectMap := make(map[string]interface{})
517	if s.ServiceProperties != nil {
518		objectMap["properties"] = s.ServiceProperties
519	}
520	return json.Marshal(objectMap)
521}
522
523// UnmarshalJSON is the custom unmarshaler for Service struct.
524func (s *Service) UnmarshalJSON(body []byte) error {
525	var m map[string]*json.RawMessage
526	err := json.Unmarshal(body, &m)
527	if err != nil {
528		return err
529	}
530	for k, v := range m {
531		switch k {
532		case "id":
533			if v != nil {
534				var ID string
535				err = json.Unmarshal(*v, &ID)
536				if err != nil {
537					return err
538				}
539				s.ID = &ID
540			}
541		case "name":
542			if v != nil {
543				var name string
544				err = json.Unmarshal(*v, &name)
545				if err != nil {
546					return err
547				}
548				s.Name = &name
549			}
550		case "type":
551			if v != nil {
552				var typeVar string
553				err = json.Unmarshal(*v, &typeVar)
554				if err != nil {
555					return err
556				}
557				s.Type = &typeVar
558			}
559		case "properties":
560			if v != nil {
561				var serviceProperties ServiceProperties
562				err = json.Unmarshal(*v, &serviceProperties)
563				if err != nil {
564					return err
565				}
566				s.ServiceProperties = &serviceProperties
567			}
568		}
569	}
570
571	return nil
572}
573
574// ServiceError the API error details.
575type ServiceError struct {
576	// Code - The error code.
577	Code *string `json:"code,omitempty"`
578	// Message - The error message.
579	Message *string `json:"message,omitempty"`
580	// Target - The target of the error.
581	Target *string `json:"target,omitempty"`
582	// Details - READ-ONLY; The list of error details.
583	Details *[]ServiceErrorDetail `json:"details,omitempty"`
584}
585
586// MarshalJSON is the custom marshaler for ServiceError.
587func (se ServiceError) MarshalJSON() ([]byte, error) {
588	objectMap := make(map[string]interface{})
589	if se.Code != nil {
590		objectMap["code"] = se.Code
591	}
592	if se.Message != nil {
593		objectMap["message"] = se.Message
594	}
595	if se.Target != nil {
596		objectMap["target"] = se.Target
597	}
598	return json.Marshal(objectMap)
599}
600
601// ServiceErrorDetail the error details.
602type ServiceErrorDetail struct {
603	// Code - READ-ONLY; The error code.
604	Code *string `json:"code,omitempty"`
605	// Message - READ-ONLY; The error message.
606	Message *string `json:"message,omitempty"`
607	// Target - The target of the error.
608	Target *string `json:"target,omitempty"`
609}
610
611// MarshalJSON is the custom marshaler for ServiceErrorDetail.
612func (sed ServiceErrorDetail) MarshalJSON() ([]byte, error) {
613	objectMap := make(map[string]interface{})
614	if sed.Target != nil {
615		objectMap["target"] = sed.Target
616	}
617	return json.Marshal(objectMap)
618}
619
620// ServiceLevelAgreement service Level Agreement details for a support ticket.
621type ServiceLevelAgreement struct {
622	// StartTime - READ-ONLY; Time in UTC (ISO 8601 format) when the service level agreement starts.
623	StartTime *date.Time `json:"startTime,omitempty"`
624	// ExpirationTime - READ-ONLY; Time in UTC (ISO 8601 format) when the service level agreement expires.
625	ExpirationTime *date.Time `json:"expirationTime,omitempty"`
626	// SLAMinutes - READ-ONLY; Service Level Agreement in minutes.
627	SLAMinutes *int32 `json:"slaMinutes,omitempty"`
628}
629
630// ServiceProperties details about an Azure service available for support ticket creation.
631type ServiceProperties struct {
632	// DisplayName - Localized name of the Azure service.
633	DisplayName *string `json:"displayName,omitempty"`
634	// ResourceTypes - ARM Resource types.
635	ResourceTypes *[]string `json:"resourceTypes,omitempty"`
636}
637
638// ServicesListResult collection of Service resources.
639type ServicesListResult struct {
640	autorest.Response `json:"-"`
641	// Value - List of Service resources.
642	Value *[]Service `json:"value,omitempty"`
643}
644
645// TechnicalTicketDetails additional information for technical support ticket.
646type TechnicalTicketDetails struct {
647	// ResourceID - This is the resource Id of the Azure service resource (For example: A virtual machine resource or an HDInsight resource) for which the support ticket is created.
648	ResourceID *string `json:"resourceId,omitempty"`
649}
650
651// TicketDetails object that represents SupportTicketDetails resource.
652type TicketDetails struct {
653	autorest.Response `json:"-"`
654	// ID - READ-ONLY; Id of the resource.
655	ID *string `json:"id,omitempty"`
656	// Name - READ-ONLY; Name of the resource.
657	Name *string `json:"name,omitempty"`
658	// Type - READ-ONLY; Type of the resource 'Microsoft.Support/supportTickets'.
659	Type *string `json:"type,omitempty"`
660	// TicketDetailsProperties - Properties of the resource.
661	*TicketDetailsProperties `json:"properties,omitempty"`
662}
663
664// MarshalJSON is the custom marshaler for TicketDetails.
665func (td TicketDetails) MarshalJSON() ([]byte, error) {
666	objectMap := make(map[string]interface{})
667	if td.TicketDetailsProperties != nil {
668		objectMap["properties"] = td.TicketDetailsProperties
669	}
670	return json.Marshal(objectMap)
671}
672
673// UnmarshalJSON is the custom unmarshaler for TicketDetails struct.
674func (td *TicketDetails) UnmarshalJSON(body []byte) error {
675	var m map[string]*json.RawMessage
676	err := json.Unmarshal(body, &m)
677	if err != nil {
678		return err
679	}
680	for k, v := range m {
681		switch k {
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				td.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				td.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				td.Type = &typeVar
708			}
709		case "properties":
710			if v != nil {
711				var ticketDetailsProperties TicketDetailsProperties
712				err = json.Unmarshal(*v, &ticketDetailsProperties)
713				if err != nil {
714					return err
715				}
716				td.TicketDetailsProperties = &ticketDetailsProperties
717			}
718		}
719	}
720
721	return nil
722}
723
724// TicketDetailsProperties describes the properties of a support ticket.
725type TicketDetailsProperties struct {
726	// SupportTicketID - System generated support ticket Id that is unique.
727	SupportTicketID *string `json:"supportTicketId,omitempty"`
728	// Description - Detailed description of the question or issue.
729	Description *string `json:"description,omitempty"`
730	// ProblemClassificationID - Each Azure service has its own set of issue categories, also known as problem classification. This parameter is the unique Id for the type of problem you are experiencing.
731	ProblemClassificationID *string `json:"problemClassificationId,omitempty"`
732	// ProblemClassificationDisplayName - READ-ONLY; Localized name of problem classification.
733	ProblemClassificationDisplayName *string `json:"problemClassificationDisplayName,omitempty"`
734	// Severity - A value that indicates the urgency of the case, which in turn determines the response time according to the service level agreement of the technical support plan you have with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' level in the Azure portal is reserved only for our Premium customers. Possible values include: 'Minimal', 'Moderate', 'Critical', 'Highestcriticalimpact'
735	Severity SeverityLevel `json:"severity,omitempty"`
736	// EnrollmentID - READ-ONLY; Enrollment Id associated with the support ticket.
737	EnrollmentID *string `json:"enrollmentId,omitempty"`
738	// Require24X7Response - Indicates if this requires a 24x7 response from Azure.
739	Require24X7Response *bool `json:"require24X7Response,omitempty"`
740	// ContactDetails - Contact information of the user requesting to create a support ticket.
741	ContactDetails *ContactProfile `json:"contactDetails,omitempty"`
742	// ServiceLevelAgreement - Service Level Agreement information for this support ticket.
743	ServiceLevelAgreement *ServiceLevelAgreement `json:"serviceLevelAgreement,omitempty"`
744	// SupportEngineer - Information about the support engineer working on this support ticket.
745	SupportEngineer *Engineer `json:"supportEngineer,omitempty"`
746	// SupportPlanType - READ-ONLY; Support plan type associated with the support ticket.
747	SupportPlanType *string `json:"supportPlanType,omitempty"`
748	// Title - Title of the support ticket.
749	Title *string `json:"title,omitempty"`
750	// ProblemStartTime - Time in UTC (ISO 8601 format) when the problem started.
751	ProblemStartTime *date.Time `json:"problemStartTime,omitempty"`
752	// ServiceID - This is the resource Id of the Azure service resource associated with the support ticket.
753	ServiceID *string `json:"serviceId,omitempty"`
754	// ServiceDisplayName - READ-ONLY; Localized name of the Azure service.
755	ServiceDisplayName *string `json:"serviceDisplayName,omitempty"`
756	// Status - READ-ONLY; Status of the support ticket.
757	Status *string `json:"status,omitempty"`
758	// CreatedDate - READ-ONLY; Time in UTC (ISO 8601 format) when the support ticket was created.
759	CreatedDate *date.Time `json:"createdDate,omitempty"`
760	// ModifiedDate - READ-ONLY; Time in UTC (ISO 8601 format) when the support ticket was last modified.
761	ModifiedDate *date.Time `json:"modifiedDate,omitempty"`
762	// TechnicalTicketDetails - Additional ticket details associated with a technical support ticket request.
763	TechnicalTicketDetails *TechnicalTicketDetails `json:"technicalTicketDetails,omitempty"`
764	// QuotaTicketDetails - Additional ticket details associated with a quota support ticket request.
765	QuotaTicketDetails *QuotaTicketDetails `json:"quotaTicketDetails,omitempty"`
766}
767
768// MarshalJSON is the custom marshaler for TicketDetailsProperties.
769func (tdp TicketDetailsProperties) MarshalJSON() ([]byte, error) {
770	objectMap := make(map[string]interface{})
771	if tdp.SupportTicketID != nil {
772		objectMap["supportTicketId"] = tdp.SupportTicketID
773	}
774	if tdp.Description != nil {
775		objectMap["description"] = tdp.Description
776	}
777	if tdp.ProblemClassificationID != nil {
778		objectMap["problemClassificationId"] = tdp.ProblemClassificationID
779	}
780	if tdp.Severity != "" {
781		objectMap["severity"] = tdp.Severity
782	}
783	if tdp.Require24X7Response != nil {
784		objectMap["require24X7Response"] = tdp.Require24X7Response
785	}
786	if tdp.ContactDetails != nil {
787		objectMap["contactDetails"] = tdp.ContactDetails
788	}
789	if tdp.ServiceLevelAgreement != nil {
790		objectMap["serviceLevelAgreement"] = tdp.ServiceLevelAgreement
791	}
792	if tdp.SupportEngineer != nil {
793		objectMap["supportEngineer"] = tdp.SupportEngineer
794	}
795	if tdp.Title != nil {
796		objectMap["title"] = tdp.Title
797	}
798	if tdp.ProblemStartTime != nil {
799		objectMap["problemStartTime"] = tdp.ProblemStartTime
800	}
801	if tdp.ServiceID != nil {
802		objectMap["serviceId"] = tdp.ServiceID
803	}
804	if tdp.TechnicalTicketDetails != nil {
805		objectMap["technicalTicketDetails"] = tdp.TechnicalTicketDetails
806	}
807	if tdp.QuotaTicketDetails != nil {
808		objectMap["quotaTicketDetails"] = tdp.QuotaTicketDetails
809	}
810	return json.Marshal(objectMap)
811}
812
813// TicketsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
814// operation.
815type TicketsCreateFuture struct {
816	azure.FutureAPI
817	// Result returns the result of the asynchronous operation.
818	// If the operation has not completed it will return an error.
819	Result func(TicketsClient) (TicketDetails, error)
820}
821
822// TicketsListResult object that represents a collection of SupportTicket resources.
823type TicketsListResult struct {
824	autorest.Response `json:"-"`
825	// Value - List of SupportTicket resources.
826	Value *[]TicketDetails `json:"value,omitempty"`
827	// NextLink - The URI to fetch the next page of SupportTicket resources.
828	NextLink *string `json:"nextLink,omitempty"`
829}
830
831// TicketsListResultIterator provides access to a complete listing of TicketDetails values.
832type TicketsListResultIterator struct {
833	i    int
834	page TicketsListResultPage
835}
836
837// NextWithContext advances to the next value.  If there was an error making
838// the request the iterator does not advance and the error is returned.
839func (iter *TicketsListResultIterator) NextWithContext(ctx context.Context) (err error) {
840	if tracing.IsEnabled() {
841		ctx = tracing.StartSpan(ctx, fqdn+"/TicketsListResultIterator.NextWithContext")
842		defer func() {
843			sc := -1
844			if iter.Response().Response.Response != nil {
845				sc = iter.Response().Response.Response.StatusCode
846			}
847			tracing.EndSpan(ctx, sc, err)
848		}()
849	}
850	iter.i++
851	if iter.i < len(iter.page.Values()) {
852		return nil
853	}
854	err = iter.page.NextWithContext(ctx)
855	if err != nil {
856		iter.i--
857		return err
858	}
859	iter.i = 0
860	return nil
861}
862
863// Next advances to the next value.  If there was an error making
864// the request the iterator does not advance and the error is returned.
865// Deprecated: Use NextWithContext() instead.
866func (iter *TicketsListResultIterator) Next() error {
867	return iter.NextWithContext(context.Background())
868}
869
870// NotDone returns true if the enumeration should be started or is not yet complete.
871func (iter TicketsListResultIterator) NotDone() bool {
872	return iter.page.NotDone() && iter.i < len(iter.page.Values())
873}
874
875// Response returns the raw server response from the last page request.
876func (iter TicketsListResultIterator) Response() TicketsListResult {
877	return iter.page.Response()
878}
879
880// Value returns the current value or a zero-initialized value if the
881// iterator has advanced beyond the end of the collection.
882func (iter TicketsListResultIterator) Value() TicketDetails {
883	if !iter.page.NotDone() {
884		return TicketDetails{}
885	}
886	return iter.page.Values()[iter.i]
887}
888
889// Creates a new instance of the TicketsListResultIterator type.
890func NewTicketsListResultIterator(page TicketsListResultPage) TicketsListResultIterator {
891	return TicketsListResultIterator{page: page}
892}
893
894// IsEmpty returns true if the ListResult contains no values.
895func (tlr TicketsListResult) IsEmpty() bool {
896	return tlr.Value == nil || len(*tlr.Value) == 0
897}
898
899// hasNextLink returns true if the NextLink is not empty.
900func (tlr TicketsListResult) hasNextLink() bool {
901	return tlr.NextLink != nil && len(*tlr.NextLink) != 0
902}
903
904// ticketsListResultPreparer prepares a request to retrieve the next set of results.
905// It returns nil if no more results exist.
906func (tlr TicketsListResult) ticketsListResultPreparer(ctx context.Context) (*http.Request, error) {
907	if !tlr.hasNextLink() {
908		return nil, nil
909	}
910	return autorest.Prepare((&http.Request{}).WithContext(ctx),
911		autorest.AsJSON(),
912		autorest.AsGet(),
913		autorest.WithBaseURL(to.String(tlr.NextLink)))
914}
915
916// TicketsListResultPage contains a page of TicketDetails values.
917type TicketsListResultPage struct {
918	fn  func(context.Context, TicketsListResult) (TicketsListResult, error)
919	tlr TicketsListResult
920}
921
922// NextWithContext advances to the next page of values.  If there was an error making
923// the request the page does not advance and the error is returned.
924func (page *TicketsListResultPage) NextWithContext(ctx context.Context) (err error) {
925	if tracing.IsEnabled() {
926		ctx = tracing.StartSpan(ctx, fqdn+"/TicketsListResultPage.NextWithContext")
927		defer func() {
928			sc := -1
929			if page.Response().Response.Response != nil {
930				sc = page.Response().Response.Response.StatusCode
931			}
932			tracing.EndSpan(ctx, sc, err)
933		}()
934	}
935	for {
936		next, err := page.fn(ctx, page.tlr)
937		if err != nil {
938			return err
939		}
940		page.tlr = next
941		if !next.hasNextLink() || !next.IsEmpty() {
942			break
943		}
944	}
945	return nil
946}
947
948// Next advances to the next page of values.  If there was an error making
949// the request the page does not advance and the error is returned.
950// Deprecated: Use NextWithContext() instead.
951func (page *TicketsListResultPage) Next() error {
952	return page.NextWithContext(context.Background())
953}
954
955// NotDone returns true if the page enumeration should be started or is not yet complete.
956func (page TicketsListResultPage) NotDone() bool {
957	return !page.tlr.IsEmpty()
958}
959
960// Response returns the raw server response from the last page request.
961func (page TicketsListResultPage) Response() TicketsListResult {
962	return page.tlr
963}
964
965// Values returns the slice of values for the current page or nil if there are no values.
966func (page TicketsListResultPage) Values() []TicketDetails {
967	if page.tlr.IsEmpty() {
968		return nil
969	}
970	return *page.tlr.Value
971}
972
973// Creates a new instance of the TicketsListResultPage type.
974func NewTicketsListResultPage(cur TicketsListResult, getNextPage func(context.Context, TicketsListResult) (TicketsListResult, error)) TicketsListResultPage {
975	return TicketsListResultPage{
976		fn:  getNextPage,
977		tlr: cur,
978	}
979}
980
981// UpdateContactProfile contact information associated with the support ticket.
982type UpdateContactProfile struct {
983	// FirstName - First name.
984	FirstName *string `json:"firstName,omitempty"`
985	// LastName - Last name.
986	LastName *string `json:"lastName,omitempty"`
987	// PreferredContactMethod - Preferred contact method. Possible values include: 'PreferredContactMethodEmail', 'PreferredContactMethodPhone'
988	PreferredContactMethod PreferredContactMethod `json:"preferredContactMethod,omitempty"`
989	// PrimaryEmailAddress - Primary email address.
990	PrimaryEmailAddress *string `json:"primaryEmailAddress,omitempty"`
991	// AdditionalEmailAddresses - Email addresses listed will be copied on any correspondence about the support ticket.
992	AdditionalEmailAddresses *[]string `json:"additionalEmailAddresses,omitempty"`
993	// PhoneNumber - Phone number. This is required if preferred contact method is phone.
994	PhoneNumber *string `json:"phoneNumber,omitempty"`
995	// PreferredTimeZone - Time zone of the user. This is the name of the time zone from [Microsoft Time Zone Index Values](https://support.microsoft.com/help/973627/microsoft-time-zone-index-values).
996	PreferredTimeZone *string `json:"preferredTimeZone,omitempty"`
997	// Country - Country of the user. This is the ISO 3166-1 alpha-3 code.
998	Country *string `json:"country,omitempty"`
999	// PreferredSupportLanguage - Preferred language of support from Azure. Support languages vary based on the severity you choose for your support ticket. Learn more at [Azure Severity and responsiveness](https://azure.microsoft.com/support/plans/response/). Use the standard language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German.
1000	PreferredSupportLanguage *string `json:"preferredSupportLanguage,omitempty"`
1001}
1002
1003// UpdateSupportTicket updates severity, ticket status, and contact details in the support ticket.
1004type UpdateSupportTicket struct {
1005	// Severity - Severity level. Possible values include: 'Minimal', 'Moderate', 'Critical', 'Highestcriticalimpact'
1006	Severity SeverityLevel `json:"severity,omitempty"`
1007	// Status - Status to be updated on the ticket. Possible values include: 'Open', 'Closed'
1008	Status Status `json:"status,omitempty"`
1009	// ContactDetails - Contact details to be updated on the support ticket.
1010	ContactDetails *UpdateContactProfile `json:"contactDetails,omitempty"`
1011}
1012