1package datacatalog
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)
26
27// The package's fully qualified name.
28const fqdn = "github.com/Azure/azure-sdk-for-go/services/datacatalog/mgmt/2016-03-30/datacatalog"
29
30// SkuType enumerates the values for sku type.
31type SkuType string
32
33const (
34	// Free ...
35	Free SkuType = "Free"
36	// Standard ...
37	Standard SkuType = "Standard"
38)
39
40// PossibleSkuTypeValues returns an array of possible values for the SkuType const type.
41func PossibleSkuTypeValues() []SkuType {
42	return []SkuType{Free, Standard}
43}
44
45// ADCCatalog azure Data Catalog.
46type ADCCatalog struct {
47	autorest.Response `json:"-"`
48	// ADCCatalogProperties - Azure Data Catalog properties.
49	*ADCCatalogProperties `json:"properties,omitempty"`
50	// ID - READ-ONLY; Resource Id
51	ID *string `json:"id,omitempty"`
52	// Name - READ-ONLY; Resource name
53	Name *string `json:"name,omitempty"`
54	// Type - READ-ONLY; Resource type
55	Type *string `json:"type,omitempty"`
56	// Location - Resource location
57	Location *string `json:"location,omitempty"`
58	// Tags - Resource tags
59	Tags map[string]*string `json:"tags"`
60	// Etag - Resource etag
61	Etag *string `json:"etag,omitempty"`
62}
63
64// MarshalJSON is the custom marshaler for ADCCatalog.
65func (ac ADCCatalog) MarshalJSON() ([]byte, error) {
66	objectMap := make(map[string]interface{})
67	if ac.ADCCatalogProperties != nil {
68		objectMap["properties"] = ac.ADCCatalogProperties
69	}
70	if ac.Location != nil {
71		objectMap["location"] = ac.Location
72	}
73	if ac.Tags != nil {
74		objectMap["tags"] = ac.Tags
75	}
76	if ac.Etag != nil {
77		objectMap["etag"] = ac.Etag
78	}
79	return json.Marshal(objectMap)
80}
81
82// UnmarshalJSON is the custom unmarshaler for ADCCatalog struct.
83func (ac *ADCCatalog) UnmarshalJSON(body []byte) error {
84	var m map[string]*json.RawMessage
85	err := json.Unmarshal(body, &m)
86	if err != nil {
87		return err
88	}
89	for k, v := range m {
90		switch k {
91		case "properties":
92			if v != nil {
93				var aDCCatalogProperties ADCCatalogProperties
94				err = json.Unmarshal(*v, &aDCCatalogProperties)
95				if err != nil {
96					return err
97				}
98				ac.ADCCatalogProperties = &aDCCatalogProperties
99			}
100		case "id":
101			if v != nil {
102				var ID string
103				err = json.Unmarshal(*v, &ID)
104				if err != nil {
105					return err
106				}
107				ac.ID = &ID
108			}
109		case "name":
110			if v != nil {
111				var name string
112				err = json.Unmarshal(*v, &name)
113				if err != nil {
114					return err
115				}
116				ac.Name = &name
117			}
118		case "type":
119			if v != nil {
120				var typeVar string
121				err = json.Unmarshal(*v, &typeVar)
122				if err != nil {
123					return err
124				}
125				ac.Type = &typeVar
126			}
127		case "location":
128			if v != nil {
129				var location string
130				err = json.Unmarshal(*v, &location)
131				if err != nil {
132					return err
133				}
134				ac.Location = &location
135			}
136		case "tags":
137			if v != nil {
138				var tags map[string]*string
139				err = json.Unmarshal(*v, &tags)
140				if err != nil {
141					return err
142				}
143				ac.Tags = tags
144			}
145		case "etag":
146			if v != nil {
147				var etag string
148				err = json.Unmarshal(*v, &etag)
149				if err != nil {
150					return err
151				}
152				ac.Etag = &etag
153			}
154		}
155	}
156
157	return nil
158}
159
160// ADCCatalogProperties properties of the data catalog.
161type ADCCatalogProperties struct {
162	// Sku - Azure data catalog SKU. Possible values include: 'Free', 'Standard'
163	Sku SkuType `json:"sku,omitempty"`
164	// Units - Azure data catalog units.
165	Units *int32 `json:"units,omitempty"`
166	// Admins - Azure data catalog admin list.
167	Admins *[]Principals `json:"admins,omitempty"`
168	// Users - Azure data catalog user list.
169	Users *[]Principals `json:"users,omitempty"`
170	// SuccessfullyProvisioned - Azure data catalog provision status.
171	SuccessfullyProvisioned *bool `json:"successfullyProvisioned,omitempty"`
172	// EnableAutomaticUnitAdjustment - Automatic unit adjustment enabled or not.
173	EnableAutomaticUnitAdjustment *bool `json:"enableAutomaticUnitAdjustment,omitempty"`
174}
175
176// ADCCatalogsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
177// operation.
178type ADCCatalogsDeleteFuture struct {
179	azure.Future
180}
181
182// Result returns the result of the asynchronous operation.
183// If the operation has not completed it will return an error.
184func (future *ADCCatalogsDeleteFuture) Result(client ADCCatalogsClient) (ar autorest.Response, err error) {
185	var done bool
186	done, err = future.DoneWithContext(context.Background(), client)
187	if err != nil {
188		err = autorest.NewErrorWithError(err, "datacatalog.ADCCatalogsDeleteFuture", "Result", future.Response(), "Polling failure")
189		return
190	}
191	if !done {
192		err = azure.NewAsyncOpIncompleteError("datacatalog.ADCCatalogsDeleteFuture")
193		return
194	}
195	ar.Response = future.Response()
196	return
197}
198
199// ADCCatalogsListResult the response from the List Azure Data Catalog operation.
200type ADCCatalogsListResult struct {
201	autorest.Response `json:"-"`
202	// Value - the list of Azure Data Catalogs.
203	Value *[]ADCCatalog `json:"value,omitempty"`
204}
205
206// OperationDisplayInfo the operation supported by Azure Data Catalog Service.
207type OperationDisplayInfo struct {
208	// Description - The description of the operation.
209	Description *string `json:"description,omitempty"`
210	// Operation - The action that users can perform, based on their permission level.
211	Operation *string `json:"operation,omitempty"`
212	// Provider - Service provider: Azure Data Catalog Service.
213	Provider *string `json:"provider,omitempty"`
214	// Resource - Resource on which the operation is performed.
215	Resource *string `json:"resource,omitempty"`
216}
217
218// OperationEntity the operation supported by Azure Data Catalog Service.
219type OperationEntity struct {
220	// Name - Operation name: {provider}/{resource}/{operation}.
221	Name *string `json:"name,omitempty"`
222	// Display - The operation supported by Azure Data Catalog Service.
223	Display *OperationDisplayInfo `json:"display,omitempty"`
224}
225
226// OperationEntityListResult the list of Azure data catalog service operation response.
227type OperationEntityListResult struct {
228	autorest.Response `json:"-"`
229	// Value - The list of operations.
230	Value *[]OperationEntity `json:"value,omitempty"`
231}
232
233// Principals user principals.
234type Principals struct {
235	// Upn - UPN of the user.
236	Upn *string `json:"upn,omitempty"`
237	// ObjectID - Object Id for the user
238	ObjectID *string `json:"objectId,omitempty"`
239}
240
241// Resource the Resource model definition.
242type Resource struct {
243	// ID - READ-ONLY; Resource Id
244	ID *string `json:"id,omitempty"`
245	// Name - READ-ONLY; Resource name
246	Name *string `json:"name,omitempty"`
247	// Type - READ-ONLY; Resource type
248	Type *string `json:"type,omitempty"`
249	// Location - Resource location
250	Location *string `json:"location,omitempty"`
251	// Tags - Resource tags
252	Tags map[string]*string `json:"tags"`
253	// Etag - Resource etag
254	Etag *string `json:"etag,omitempty"`
255}
256
257// MarshalJSON is the custom marshaler for Resource.
258func (r Resource) MarshalJSON() ([]byte, error) {
259	objectMap := make(map[string]interface{})
260	if r.Location != nil {
261		objectMap["location"] = r.Location
262	}
263	if r.Tags != nil {
264		objectMap["tags"] = r.Tags
265	}
266	if r.Etag != nil {
267		objectMap["etag"] = r.Etag
268	}
269	return json.Marshal(objectMap)
270}
271