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