1package appconfiguration
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/preview/appconfiguration/mgmt/2019-02-01-preview/appconfiguration"
33
34// ProvisioningState enumerates the values for provisioning state.
35type ProvisioningState string
36
37const (
38	// Canceled ...
39	Canceled ProvisioningState = "Canceled"
40	// Creating ...
41	Creating ProvisioningState = "Creating"
42	// Deleting ...
43	Deleting ProvisioningState = "Deleting"
44	// Failed ...
45	Failed ProvisioningState = "Failed"
46	// Succeeded ...
47	Succeeded ProvisioningState = "Succeeded"
48	// Updating ...
49	Updating ProvisioningState = "Updating"
50)
51
52// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
53func PossibleProvisioningStateValues() []ProvisioningState {
54	return []ProvisioningState{Canceled, Creating, Deleting, Failed, Succeeded, Updating}
55}
56
57// APIKey an API key used for authenticating with a configuration store endpoint.
58type APIKey struct {
59	autorest.Response `json:"-"`
60	// ID - READ-ONLY; The key ID.
61	ID *string `json:"id,omitempty"`
62	// Name - READ-ONLY; A name for the key describing its usage.
63	Name *string `json:"name,omitempty"`
64	// Value - READ-ONLY; The value of the key that is used for authentication purposes.
65	Value *string `json:"value,omitempty"`
66	// ConnectionString - READ-ONLY; A connection string that can be used by supporting clients for authentication.
67	ConnectionString *string `json:"connectionString,omitempty"`
68	// LastModified - READ-ONLY; The last time any of the key's properties were modified.
69	LastModified *date.Time `json:"lastModified,omitempty"`
70	// ReadOnly - READ-ONLY; Whether this key can only be used for read operations.
71	ReadOnly *bool `json:"readOnly,omitempty"`
72}
73
74// APIKeyListResult the result of a request to list API keys.
75type APIKeyListResult struct {
76	autorest.Response `json:"-"`
77	// Value - The collection value.
78	Value *[]APIKey `json:"value,omitempty"`
79	// NextLink - The URI that can be used to request the next set of paged results.
80	NextLink *string `json:"nextLink,omitempty"`
81}
82
83// APIKeyListResultIterator provides access to a complete listing of APIKey values.
84type APIKeyListResultIterator struct {
85	i    int
86	page APIKeyListResultPage
87}
88
89// NextWithContext advances to the next value.  If there was an error making
90// the request the iterator does not advance and the error is returned.
91func (iter *APIKeyListResultIterator) NextWithContext(ctx context.Context) (err error) {
92	if tracing.IsEnabled() {
93		ctx = tracing.StartSpan(ctx, fqdn+"/APIKeyListResultIterator.NextWithContext")
94		defer func() {
95			sc := -1
96			if iter.Response().Response.Response != nil {
97				sc = iter.Response().Response.Response.StatusCode
98			}
99			tracing.EndSpan(ctx, sc, err)
100		}()
101	}
102	iter.i++
103	if iter.i < len(iter.page.Values()) {
104		return nil
105	}
106	err = iter.page.NextWithContext(ctx)
107	if err != nil {
108		iter.i--
109		return err
110	}
111	iter.i = 0
112	return nil
113}
114
115// Next advances to the next value.  If there was an error making
116// the request the iterator does not advance and the error is returned.
117// Deprecated: Use NextWithContext() instead.
118func (iter *APIKeyListResultIterator) Next() error {
119	return iter.NextWithContext(context.Background())
120}
121
122// NotDone returns true if the enumeration should be started or is not yet complete.
123func (iter APIKeyListResultIterator) NotDone() bool {
124	return iter.page.NotDone() && iter.i < len(iter.page.Values())
125}
126
127// Response returns the raw server response from the last page request.
128func (iter APIKeyListResultIterator) Response() APIKeyListResult {
129	return iter.page.Response()
130}
131
132// Value returns the current value or a zero-initialized value if the
133// iterator has advanced beyond the end of the collection.
134func (iter APIKeyListResultIterator) Value() APIKey {
135	if !iter.page.NotDone() {
136		return APIKey{}
137	}
138	return iter.page.Values()[iter.i]
139}
140
141// Creates a new instance of the APIKeyListResultIterator type.
142func NewAPIKeyListResultIterator(page APIKeyListResultPage) APIKeyListResultIterator {
143	return APIKeyListResultIterator{page: page}
144}
145
146// IsEmpty returns true if the ListResult contains no values.
147func (aklr APIKeyListResult) IsEmpty() bool {
148	return aklr.Value == nil || len(*aklr.Value) == 0
149}
150
151// aPIKeyListResultPreparer prepares a request to retrieve the next set of results.
152// It returns nil if no more results exist.
153func (aklr APIKeyListResult) aPIKeyListResultPreparer(ctx context.Context) (*http.Request, error) {
154	if aklr.NextLink == nil || len(to.String(aklr.NextLink)) < 1 {
155		return nil, nil
156	}
157	return autorest.Prepare((&http.Request{}).WithContext(ctx),
158		autorest.AsJSON(),
159		autorest.AsGet(),
160		autorest.WithBaseURL(to.String(aklr.NextLink)))
161}
162
163// APIKeyListResultPage contains a page of APIKey values.
164type APIKeyListResultPage struct {
165	fn   func(context.Context, APIKeyListResult) (APIKeyListResult, error)
166	aklr APIKeyListResult
167}
168
169// NextWithContext advances to the next page of values.  If there was an error making
170// the request the page does not advance and the error is returned.
171func (page *APIKeyListResultPage) NextWithContext(ctx context.Context) (err error) {
172	if tracing.IsEnabled() {
173		ctx = tracing.StartSpan(ctx, fqdn+"/APIKeyListResultPage.NextWithContext")
174		defer func() {
175			sc := -1
176			if page.Response().Response.Response != nil {
177				sc = page.Response().Response.Response.StatusCode
178			}
179			tracing.EndSpan(ctx, sc, err)
180		}()
181	}
182	next, err := page.fn(ctx, page.aklr)
183	if err != nil {
184		return err
185	}
186	page.aklr = next
187	return nil
188}
189
190// Next advances to the next page of values.  If there was an error making
191// the request the page does not advance and the error is returned.
192// Deprecated: Use NextWithContext() instead.
193func (page *APIKeyListResultPage) Next() error {
194	return page.NextWithContext(context.Background())
195}
196
197// NotDone returns true if the page enumeration should be started or is not yet complete.
198func (page APIKeyListResultPage) NotDone() bool {
199	return !page.aklr.IsEmpty()
200}
201
202// Response returns the raw server response from the last page request.
203func (page APIKeyListResultPage) Response() APIKeyListResult {
204	return page.aklr
205}
206
207// Values returns the slice of values for the current page or nil if there are no values.
208func (page APIKeyListResultPage) Values() []APIKey {
209	if page.aklr.IsEmpty() {
210		return nil
211	}
212	return *page.aklr.Value
213}
214
215// Creates a new instance of the APIKeyListResultPage type.
216func NewAPIKeyListResultPage(getNextPage func(context.Context, APIKeyListResult) (APIKeyListResult, error)) APIKeyListResultPage {
217	return APIKeyListResultPage{fn: getNextPage}
218}
219
220// CheckNameAvailabilityParameters parameters used for checking whether a resource name is available.
221type CheckNameAvailabilityParameters struct {
222	// Name - The name to check for availability.
223	Name *string `json:"name,omitempty"`
224	// Type - The resource type to check for name availability.
225	Type *string `json:"type,omitempty"`
226}
227
228// ConfigurationStore the configuration store along with all resource properties. The Configuration Store
229// will have all information to begin utilizing it.
230type ConfigurationStore struct {
231	autorest.Response `json:"-"`
232	// ConfigurationStoreProperties - The properties of a configuration store.
233	*ConfigurationStoreProperties `json:"properties,omitempty"`
234	// ID - READ-ONLY; The resource ID.
235	ID *string `json:"id,omitempty"`
236	// Name - READ-ONLY; The name of the resource.
237	Name *string `json:"name,omitempty"`
238	// Type - READ-ONLY; The type of the resource.
239	Type *string `json:"type,omitempty"`
240	// Location - The location of the resource. This cannot be changed after the resource is created.
241	Location *string `json:"location,omitempty"`
242	// Tags - The tags of the resource.
243	Tags map[string]*string `json:"tags"`
244}
245
246// MarshalJSON is the custom marshaler for ConfigurationStore.
247func (cs ConfigurationStore) MarshalJSON() ([]byte, error) {
248	objectMap := make(map[string]interface{})
249	if cs.ConfigurationStoreProperties != nil {
250		objectMap["properties"] = cs.ConfigurationStoreProperties
251	}
252	if cs.Location != nil {
253		objectMap["location"] = cs.Location
254	}
255	if cs.Tags != nil {
256		objectMap["tags"] = cs.Tags
257	}
258	return json.Marshal(objectMap)
259}
260
261// UnmarshalJSON is the custom unmarshaler for ConfigurationStore struct.
262func (cs *ConfigurationStore) UnmarshalJSON(body []byte) error {
263	var m map[string]*json.RawMessage
264	err := json.Unmarshal(body, &m)
265	if err != nil {
266		return err
267	}
268	for k, v := range m {
269		switch k {
270		case "properties":
271			if v != nil {
272				var configurationStoreProperties ConfigurationStoreProperties
273				err = json.Unmarshal(*v, &configurationStoreProperties)
274				if err != nil {
275					return err
276				}
277				cs.ConfigurationStoreProperties = &configurationStoreProperties
278			}
279		case "id":
280			if v != nil {
281				var ID string
282				err = json.Unmarshal(*v, &ID)
283				if err != nil {
284					return err
285				}
286				cs.ID = &ID
287			}
288		case "name":
289			if v != nil {
290				var name string
291				err = json.Unmarshal(*v, &name)
292				if err != nil {
293					return err
294				}
295				cs.Name = &name
296			}
297		case "type":
298			if v != nil {
299				var typeVar string
300				err = json.Unmarshal(*v, &typeVar)
301				if err != nil {
302					return err
303				}
304				cs.Type = &typeVar
305			}
306		case "location":
307			if v != nil {
308				var location string
309				err = json.Unmarshal(*v, &location)
310				if err != nil {
311					return err
312				}
313				cs.Location = &location
314			}
315		case "tags":
316			if v != nil {
317				var tags map[string]*string
318				err = json.Unmarshal(*v, &tags)
319				if err != nil {
320					return err
321				}
322				cs.Tags = tags
323			}
324		}
325	}
326
327	return nil
328}
329
330// ConfigurationStoreListResult the result of a request to list configuration stores.
331type ConfigurationStoreListResult struct {
332	autorest.Response `json:"-"`
333	// Value - The collection value.
334	Value *[]ConfigurationStore `json:"value,omitempty"`
335	// NextLink - The URI that can be used to request the next set of paged results.
336	NextLink *string `json:"nextLink,omitempty"`
337}
338
339// ConfigurationStoreListResultIterator provides access to a complete listing of ConfigurationStore values.
340type ConfigurationStoreListResultIterator struct {
341	i    int
342	page ConfigurationStoreListResultPage
343}
344
345// NextWithContext advances to the next value.  If there was an error making
346// the request the iterator does not advance and the error is returned.
347func (iter *ConfigurationStoreListResultIterator) NextWithContext(ctx context.Context) (err error) {
348	if tracing.IsEnabled() {
349		ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationStoreListResultIterator.NextWithContext")
350		defer func() {
351			sc := -1
352			if iter.Response().Response.Response != nil {
353				sc = iter.Response().Response.Response.StatusCode
354			}
355			tracing.EndSpan(ctx, sc, err)
356		}()
357	}
358	iter.i++
359	if iter.i < len(iter.page.Values()) {
360		return nil
361	}
362	err = iter.page.NextWithContext(ctx)
363	if err != nil {
364		iter.i--
365		return err
366	}
367	iter.i = 0
368	return nil
369}
370
371// Next advances to the next value.  If there was an error making
372// the request the iterator does not advance and the error is returned.
373// Deprecated: Use NextWithContext() instead.
374func (iter *ConfigurationStoreListResultIterator) Next() error {
375	return iter.NextWithContext(context.Background())
376}
377
378// NotDone returns true if the enumeration should be started or is not yet complete.
379func (iter ConfigurationStoreListResultIterator) NotDone() bool {
380	return iter.page.NotDone() && iter.i < len(iter.page.Values())
381}
382
383// Response returns the raw server response from the last page request.
384func (iter ConfigurationStoreListResultIterator) Response() ConfigurationStoreListResult {
385	return iter.page.Response()
386}
387
388// Value returns the current value or a zero-initialized value if the
389// iterator has advanced beyond the end of the collection.
390func (iter ConfigurationStoreListResultIterator) Value() ConfigurationStore {
391	if !iter.page.NotDone() {
392		return ConfigurationStore{}
393	}
394	return iter.page.Values()[iter.i]
395}
396
397// Creates a new instance of the ConfigurationStoreListResultIterator type.
398func NewConfigurationStoreListResultIterator(page ConfigurationStoreListResultPage) ConfigurationStoreListResultIterator {
399	return ConfigurationStoreListResultIterator{page: page}
400}
401
402// IsEmpty returns true if the ListResult contains no values.
403func (cslr ConfigurationStoreListResult) IsEmpty() bool {
404	return cslr.Value == nil || len(*cslr.Value) == 0
405}
406
407// configurationStoreListResultPreparer prepares a request to retrieve the next set of results.
408// It returns nil if no more results exist.
409func (cslr ConfigurationStoreListResult) configurationStoreListResultPreparer(ctx context.Context) (*http.Request, error) {
410	if cslr.NextLink == nil || len(to.String(cslr.NextLink)) < 1 {
411		return nil, nil
412	}
413	return autorest.Prepare((&http.Request{}).WithContext(ctx),
414		autorest.AsJSON(),
415		autorest.AsGet(),
416		autorest.WithBaseURL(to.String(cslr.NextLink)))
417}
418
419// ConfigurationStoreListResultPage contains a page of ConfigurationStore values.
420type ConfigurationStoreListResultPage struct {
421	fn   func(context.Context, ConfigurationStoreListResult) (ConfigurationStoreListResult, error)
422	cslr ConfigurationStoreListResult
423}
424
425// NextWithContext advances to the next page of values.  If there was an error making
426// the request the page does not advance and the error is returned.
427func (page *ConfigurationStoreListResultPage) NextWithContext(ctx context.Context) (err error) {
428	if tracing.IsEnabled() {
429		ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationStoreListResultPage.NextWithContext")
430		defer func() {
431			sc := -1
432			if page.Response().Response.Response != nil {
433				sc = page.Response().Response.Response.StatusCode
434			}
435			tracing.EndSpan(ctx, sc, err)
436		}()
437	}
438	next, err := page.fn(ctx, page.cslr)
439	if err != nil {
440		return err
441	}
442	page.cslr = next
443	return nil
444}
445
446// Next advances to the next page of values.  If there was an error making
447// the request the page does not advance and the error is returned.
448// Deprecated: Use NextWithContext() instead.
449func (page *ConfigurationStoreListResultPage) Next() error {
450	return page.NextWithContext(context.Background())
451}
452
453// NotDone returns true if the page enumeration should be started or is not yet complete.
454func (page ConfigurationStoreListResultPage) NotDone() bool {
455	return !page.cslr.IsEmpty()
456}
457
458// Response returns the raw server response from the last page request.
459func (page ConfigurationStoreListResultPage) Response() ConfigurationStoreListResult {
460	return page.cslr
461}
462
463// Values returns the slice of values for the current page or nil if there are no values.
464func (page ConfigurationStoreListResultPage) Values() []ConfigurationStore {
465	if page.cslr.IsEmpty() {
466		return nil
467	}
468	return *page.cslr.Value
469}
470
471// Creates a new instance of the ConfigurationStoreListResultPage type.
472func NewConfigurationStoreListResultPage(getNextPage func(context.Context, ConfigurationStoreListResult) (ConfigurationStoreListResult, error)) ConfigurationStoreListResultPage {
473	return ConfigurationStoreListResultPage{fn: getNextPage}
474}
475
476// ConfigurationStoreProperties the properties of a configuration store.
477type ConfigurationStoreProperties struct {
478	// ProvisioningState - READ-ONLY; The provisioning state of the configuration store. Possible values include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled'
479	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
480	// CreationDate - READ-ONLY; The creation date of configuration store.
481	CreationDate *date.Time `json:"creationDate,omitempty"`
482	// Endpoint - READ-ONLY; The DNS endpoint where the configuration store API will be available.
483	Endpoint *string `json:"endpoint,omitempty"`
484}
485
486// ConfigurationStoresCreateFuture an abstraction for monitoring and retrieving the results of a
487// long-running operation.
488type ConfigurationStoresCreateFuture struct {
489	azure.Future
490}
491
492// Result returns the result of the asynchronous operation.
493// If the operation has not completed it will return an error.
494func (future *ConfigurationStoresCreateFuture) Result(client ConfigurationStoresClient) (cs ConfigurationStore, err error) {
495	var done bool
496	done, err = future.DoneWithContext(context.Background(), client)
497	if err != nil {
498		err = autorest.NewErrorWithError(err, "appconfiguration.ConfigurationStoresCreateFuture", "Result", future.Response(), "Polling failure")
499		return
500	}
501	if !done {
502		err = azure.NewAsyncOpIncompleteError("appconfiguration.ConfigurationStoresCreateFuture")
503		return
504	}
505	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
506	if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent {
507		cs, err = client.CreateResponder(cs.Response.Response)
508		if err != nil {
509			err = autorest.NewErrorWithError(err, "appconfiguration.ConfigurationStoresCreateFuture", "Result", cs.Response.Response, "Failure responding to request")
510		}
511	}
512	return
513}
514
515// ConfigurationStoresDeleteFuture an abstraction for monitoring and retrieving the results of a
516// long-running operation.
517type ConfigurationStoresDeleteFuture struct {
518	azure.Future
519}
520
521// Result returns the result of the asynchronous operation.
522// If the operation has not completed it will return an error.
523func (future *ConfigurationStoresDeleteFuture) Result(client ConfigurationStoresClient) (ar autorest.Response, err error) {
524	var done bool
525	done, err = future.DoneWithContext(context.Background(), client)
526	if err != nil {
527		err = autorest.NewErrorWithError(err, "appconfiguration.ConfigurationStoresDeleteFuture", "Result", future.Response(), "Polling failure")
528		return
529	}
530	if !done {
531		err = azure.NewAsyncOpIncompleteError("appconfiguration.ConfigurationStoresDeleteFuture")
532		return
533	}
534	ar.Response = future.Response()
535	return
536}
537
538// ConfigurationStoresUpdateFuture an abstraction for monitoring and retrieving the results of a
539// long-running operation.
540type ConfigurationStoresUpdateFuture struct {
541	azure.Future
542}
543
544// Result returns the result of the asynchronous operation.
545// If the operation has not completed it will return an error.
546func (future *ConfigurationStoresUpdateFuture) Result(client ConfigurationStoresClient) (cs ConfigurationStore, err error) {
547	var done bool
548	done, err = future.DoneWithContext(context.Background(), client)
549	if err != nil {
550		err = autorest.NewErrorWithError(err, "appconfiguration.ConfigurationStoresUpdateFuture", "Result", future.Response(), "Polling failure")
551		return
552	}
553	if !done {
554		err = azure.NewAsyncOpIncompleteError("appconfiguration.ConfigurationStoresUpdateFuture")
555		return
556	}
557	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
558	if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent {
559		cs, err = client.UpdateResponder(cs.Response.Response)
560		if err != nil {
561			err = autorest.NewErrorWithError(err, "appconfiguration.ConfigurationStoresUpdateFuture", "Result", cs.Response.Response, "Failure responding to request")
562		}
563	}
564	return
565}
566
567// ConfigurationStoreUpdateParameters the parameters for updating a configuration store.
568type ConfigurationStoreUpdateParameters struct {
569	// Properties - The properties for updating a configuration store.
570	Properties interface{} `json:"properties,omitempty"`
571	// Tags - The ARM resource tags.
572	Tags map[string]*string `json:"tags"`
573}
574
575// MarshalJSON is the custom marshaler for ConfigurationStoreUpdateParameters.
576func (csup ConfigurationStoreUpdateParameters) MarshalJSON() ([]byte, error) {
577	objectMap := make(map[string]interface{})
578	if csup.Properties != nil {
579		objectMap["properties"] = csup.Properties
580	}
581	if csup.Tags != nil {
582		objectMap["tags"] = csup.Tags
583	}
584	return json.Marshal(objectMap)
585}
586
587// Error appConfiguration error object.
588type Error struct {
589	// Code - Error code.
590	Code *string `json:"code,omitempty"`
591	// Message - Error message.
592	Message *string `json:"message,omitempty"`
593}
594
595// KeyValue the result of a request to retrieve a key-value from the specified configuration store.
596type KeyValue struct {
597	autorest.Response `json:"-"`
598	// Key - READ-ONLY; The primary identifier of a key-value.
599	// The key is used in unison with the label to uniquely identify a key-value.
600	Key *string `json:"key,omitempty"`
601	// Label - READ-ONLY; A value used to group key-values.
602	// The label is used in unison with the key to uniquely identify a key-value.
603	Label *string `json:"label,omitempty"`
604	// Value - READ-ONLY; The value of the key-value.
605	Value *string `json:"value,omitempty"`
606	// ContentType - READ-ONLY; The content type of the key-value's value.
607	// Providing a proper content-type can enable transformations of values when they are retrieved by applications.
608	ContentType *string `json:"contentType,omitempty"`
609	// ETag - READ-ONLY; An ETag indicating the state of a key-value within a configuration store.
610	ETag *string `json:"eTag,omitempty"`
611	// LastModified - READ-ONLY; The last time a modifying operation was performed on the given key-value.
612	LastModified *date.Time `json:"lastModified,omitempty"`
613	// Locked - READ-ONLY; A value indicating whether the key-value is locked.
614	// A locked key-value may not be modified until it is unlocked.
615	Locked *bool `json:"locked,omitempty"`
616	// Tags - READ-ONLY; A dictionary of tags that can help identify what a key-value may be applicable for.
617	Tags map[string]*string `json:"tags"`
618}
619
620// MarshalJSON is the custom marshaler for KeyValue.
621func (kv KeyValue) MarshalJSON() ([]byte, error) {
622	objectMap := make(map[string]interface{})
623	return json.Marshal(objectMap)
624}
625
626// ListKeyValueParameters the parameters used to list a configuration store key-value
627type ListKeyValueParameters struct {
628	// Key - The key to retrieve.
629	Key *string `json:"key,omitempty"`
630	// Label - The label of the key.
631	Label *string `json:"label,omitempty"`
632}
633
634// NameAvailabilityStatus the result of a request to check the availability of a resource name.
635type NameAvailabilityStatus struct {
636	autorest.Response `json:"-"`
637	// NameAvailable - READ-ONLY; The value indicating whether the resource name is available.
638	NameAvailable *bool `json:"nameAvailable,omitempty"`
639	// Message - READ-ONLY; If any, the error message that provides more detail for the reason that the name is not available.
640	Message *string `json:"message,omitempty"`
641	// Reason - READ-ONLY; If any, the reason that the name is not available.
642	Reason *string `json:"reason,omitempty"`
643}
644
645// OperationDefinition the definition of a configuration store operation.
646type OperationDefinition struct {
647	// Name - Operation name: {provider}/{resource}/{operation}.
648	Name *string `json:"name,omitempty"`
649	// Display - The display information for the configuration store operation.
650	Display *OperationDefinitionDisplay `json:"display,omitempty"`
651}
652
653// OperationDefinitionDisplay the display information for a configuration store operation.
654type OperationDefinitionDisplay struct {
655	// Provider - READ-ONLY; The resource provider name: Microsoft App Configuration."
656	Provider *string `json:"provider,omitempty"`
657	// Resource - The resource on which the operation is performed.
658	Resource *string `json:"resource,omitempty"`
659	// Operation - The operation that users can perform.
660	Operation *string `json:"operation,omitempty"`
661	// Description - The description for the operation.
662	Description *string `json:"description,omitempty"`
663}
664
665// OperationDefinitionListResult the result of a request to list configuration store operations.
666type OperationDefinitionListResult struct {
667	autorest.Response `json:"-"`
668	// Value - The collection value.
669	Value *[]OperationDefinition `json:"value,omitempty"`
670	// NextLink - The URI that can be used to request the next set of paged results.
671	NextLink *string `json:"nextLink,omitempty"`
672}
673
674// OperationDefinitionListResultIterator provides access to a complete listing of OperationDefinition
675// values.
676type OperationDefinitionListResultIterator struct {
677	i    int
678	page OperationDefinitionListResultPage
679}
680
681// NextWithContext advances to the next value.  If there was an error making
682// the request the iterator does not advance and the error is returned.
683func (iter *OperationDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) {
684	if tracing.IsEnabled() {
685		ctx = tracing.StartSpan(ctx, fqdn+"/OperationDefinitionListResultIterator.NextWithContext")
686		defer func() {
687			sc := -1
688			if iter.Response().Response.Response != nil {
689				sc = iter.Response().Response.Response.StatusCode
690			}
691			tracing.EndSpan(ctx, sc, err)
692		}()
693	}
694	iter.i++
695	if iter.i < len(iter.page.Values()) {
696		return nil
697	}
698	err = iter.page.NextWithContext(ctx)
699	if err != nil {
700		iter.i--
701		return err
702	}
703	iter.i = 0
704	return nil
705}
706
707// Next advances to the next value.  If there was an error making
708// the request the iterator does not advance and the error is returned.
709// Deprecated: Use NextWithContext() instead.
710func (iter *OperationDefinitionListResultIterator) Next() error {
711	return iter.NextWithContext(context.Background())
712}
713
714// NotDone returns true if the enumeration should be started or is not yet complete.
715func (iter OperationDefinitionListResultIterator) NotDone() bool {
716	return iter.page.NotDone() && iter.i < len(iter.page.Values())
717}
718
719// Response returns the raw server response from the last page request.
720func (iter OperationDefinitionListResultIterator) Response() OperationDefinitionListResult {
721	return iter.page.Response()
722}
723
724// Value returns the current value or a zero-initialized value if the
725// iterator has advanced beyond the end of the collection.
726func (iter OperationDefinitionListResultIterator) Value() OperationDefinition {
727	if !iter.page.NotDone() {
728		return OperationDefinition{}
729	}
730	return iter.page.Values()[iter.i]
731}
732
733// Creates a new instance of the OperationDefinitionListResultIterator type.
734func NewOperationDefinitionListResultIterator(page OperationDefinitionListResultPage) OperationDefinitionListResultIterator {
735	return OperationDefinitionListResultIterator{page: page}
736}
737
738// IsEmpty returns true if the ListResult contains no values.
739func (odlr OperationDefinitionListResult) IsEmpty() bool {
740	return odlr.Value == nil || len(*odlr.Value) == 0
741}
742
743// operationDefinitionListResultPreparer prepares a request to retrieve the next set of results.
744// It returns nil if no more results exist.
745func (odlr OperationDefinitionListResult) operationDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) {
746	if odlr.NextLink == nil || len(to.String(odlr.NextLink)) < 1 {
747		return nil, nil
748	}
749	return autorest.Prepare((&http.Request{}).WithContext(ctx),
750		autorest.AsJSON(),
751		autorest.AsGet(),
752		autorest.WithBaseURL(to.String(odlr.NextLink)))
753}
754
755// OperationDefinitionListResultPage contains a page of OperationDefinition values.
756type OperationDefinitionListResultPage struct {
757	fn   func(context.Context, OperationDefinitionListResult) (OperationDefinitionListResult, error)
758	odlr OperationDefinitionListResult
759}
760
761// NextWithContext advances to the next page of values.  If there was an error making
762// the request the page does not advance and the error is returned.
763func (page *OperationDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) {
764	if tracing.IsEnabled() {
765		ctx = tracing.StartSpan(ctx, fqdn+"/OperationDefinitionListResultPage.NextWithContext")
766		defer func() {
767			sc := -1
768			if page.Response().Response.Response != nil {
769				sc = page.Response().Response.Response.StatusCode
770			}
771			tracing.EndSpan(ctx, sc, err)
772		}()
773	}
774	next, err := page.fn(ctx, page.odlr)
775	if err != nil {
776		return err
777	}
778	page.odlr = next
779	return nil
780}
781
782// Next advances to the next page of values.  If there was an error making
783// the request the page does not advance and the error is returned.
784// Deprecated: Use NextWithContext() instead.
785func (page *OperationDefinitionListResultPage) Next() error {
786	return page.NextWithContext(context.Background())
787}
788
789// NotDone returns true if the page enumeration should be started or is not yet complete.
790func (page OperationDefinitionListResultPage) NotDone() bool {
791	return !page.odlr.IsEmpty()
792}
793
794// Response returns the raw server response from the last page request.
795func (page OperationDefinitionListResultPage) Response() OperationDefinitionListResult {
796	return page.odlr
797}
798
799// Values returns the slice of values for the current page or nil if there are no values.
800func (page OperationDefinitionListResultPage) Values() []OperationDefinition {
801	if page.odlr.IsEmpty() {
802		return nil
803	}
804	return *page.odlr.Value
805}
806
807// Creates a new instance of the OperationDefinitionListResultPage type.
808func NewOperationDefinitionListResultPage(getNextPage func(context.Context, OperationDefinitionListResult) (OperationDefinitionListResult, error)) OperationDefinitionListResultPage {
809	return OperationDefinitionListResultPage{fn: getNextPage}
810}
811
812// RegenerateKeyParameters the parameters used to regenerate an API key.
813type RegenerateKeyParameters struct {
814	// ID - The id of the key to regenerate.
815	ID *string `json:"id,omitempty"`
816}
817
818// Resource an Azure resource.
819type Resource struct {
820	// ID - READ-ONLY; The resource ID.
821	ID *string `json:"id,omitempty"`
822	// Name - READ-ONLY; The name of the resource.
823	Name *string `json:"name,omitempty"`
824	// Type - READ-ONLY; The type of the resource.
825	Type *string `json:"type,omitempty"`
826	// Location - The location of the resource. This cannot be changed after the resource is created.
827	Location *string `json:"location,omitempty"`
828	// Tags - The tags of the resource.
829	Tags map[string]*string `json:"tags"`
830}
831
832// MarshalJSON is the custom marshaler for Resource.
833func (r Resource) MarshalJSON() ([]byte, error) {
834	objectMap := make(map[string]interface{})
835	if r.Location != nil {
836		objectMap["location"] = r.Location
837	}
838	if r.Tags != nil {
839		objectMap["tags"] = r.Tags
840	}
841	return json.Marshal(objectMap)
842}
843