1package analysisservices
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24)
25
26// The package's fully qualified name.
27const fqdn = "github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2016-05-16/analysisservices"
28
29// CheckServerNameAvailabilityParameters details of server name request body.
30type CheckServerNameAvailabilityParameters struct {
31	// Name - Name for checking availability.
32	Name *string `json:"name,omitempty"`
33	// Type - The resource type of azure analysis services.
34	Type *string `json:"type,omitempty"`
35}
36
37// CheckServerNameAvailabilityResult the checking result of server name availability.
38type CheckServerNameAvailabilityResult struct {
39	autorest.Response `json:"-"`
40	// NameAvailable - Indicator of available of the server name.
41	NameAvailable *bool `json:"nameAvailable,omitempty"`
42	// Reason - The reason of unavailability.
43	Reason *string `json:"reason,omitempty"`
44	// Message - The detailed message of the request unavailability.
45	Message *string `json:"message,omitempty"`
46}
47
48// ErrorResponse describes the format of Error response.
49type ErrorResponse struct {
50	// Code - Error code
51	Code *string `json:"code,omitempty"`
52	// Message - Error message indicating why the operation failed.
53	Message *string `json:"message,omitempty"`
54}
55
56// OperationStatus the status of operation.
57type OperationStatus struct {
58	autorest.Response `json:"-"`
59	// ID - The operation Id.
60	ID *string `json:"id,omitempty"`
61	// Name - The operation name.
62	Name *string `json:"name,omitempty"`
63	// StartTime - The start time of the operation.
64	StartTime *string `json:"startTime,omitempty"`
65	// EndTime - The end time of the operation.
66	EndTime *string `json:"endTime,omitempty"`
67	// Status - The status of the operation.
68	Status *string `json:"status,omitempty"`
69	// Error - The error detail of the operation if any.
70	Error *ErrorResponse `json:"error,omitempty"`
71}
72
73// Resource represents an instance of an Analysis Services resource.
74type Resource struct {
75	// ID - READ-ONLY; An identifier that represents the Analysis Services resource.
76	ID *string `json:"id,omitempty"`
77	// Name - READ-ONLY; The name of the Analysis Services resource.
78	Name *string `json:"name,omitempty"`
79	// Type - READ-ONLY; The type of the Analysis Services resource.
80	Type *string `json:"type,omitempty"`
81	// Location - Location of the Analysis Services resource.
82	Location *string `json:"location,omitempty"`
83	// Sku - The SKU of the Analysis Services resource.
84	Sku *ResourceSku `json:"sku,omitempty"`
85	// Tags - Key-value pairs of additional resource provisioning properties.
86	Tags map[string]*string `json:"tags"`
87}
88
89// MarshalJSON is the custom marshaler for Resource.
90func (r Resource) MarshalJSON() ([]byte, error) {
91	objectMap := make(map[string]interface{})
92	if r.Location != nil {
93		objectMap["location"] = r.Location
94	}
95	if r.Sku != nil {
96		objectMap["sku"] = r.Sku
97	}
98	if r.Tags != nil {
99		objectMap["tags"] = r.Tags
100	}
101	return json.Marshal(objectMap)
102}
103
104// ResourceSku represents the SKU name and Azure pricing tier for Analysis Services resource.
105type ResourceSku struct {
106	// Name - Name of the SKU level.
107	Name *string `json:"name,omitempty"`
108	// Tier - The name of the Azure pricing tier to which the SKU applies. Possible values include: 'Development', 'Basic', 'Standard'
109	Tier SkuTier `json:"tier,omitempty"`
110}
111
112// Server represents an instance of an Analysis Services resource.
113type Server struct {
114	autorest.Response `json:"-"`
115	// ServerProperties - Properties of the provision operation request.
116	*ServerProperties `json:"properties,omitempty"`
117	// ID - READ-ONLY; An identifier that represents the Analysis Services resource.
118	ID *string `json:"id,omitempty"`
119	// Name - READ-ONLY; The name of the Analysis Services resource.
120	Name *string `json:"name,omitempty"`
121	// Type - READ-ONLY; The type of the Analysis Services resource.
122	Type *string `json:"type,omitempty"`
123	// Location - Location of the Analysis Services resource.
124	Location *string `json:"location,omitempty"`
125	// Sku - The SKU of the Analysis Services resource.
126	Sku *ResourceSku `json:"sku,omitempty"`
127	// Tags - Key-value pairs of additional resource provisioning properties.
128	Tags map[string]*string `json:"tags"`
129}
130
131// MarshalJSON is the custom marshaler for Server.
132func (s Server) MarshalJSON() ([]byte, error) {
133	objectMap := make(map[string]interface{})
134	if s.ServerProperties != nil {
135		objectMap["properties"] = s.ServerProperties
136	}
137	if s.Location != nil {
138		objectMap["location"] = s.Location
139	}
140	if s.Sku != nil {
141		objectMap["sku"] = s.Sku
142	}
143	if s.Tags != nil {
144		objectMap["tags"] = s.Tags
145	}
146	return json.Marshal(objectMap)
147}
148
149// UnmarshalJSON is the custom unmarshaler for Server struct.
150func (s *Server) UnmarshalJSON(body []byte) error {
151	var m map[string]*json.RawMessage
152	err := json.Unmarshal(body, &m)
153	if err != nil {
154		return err
155	}
156	for k, v := range m {
157		switch k {
158		case "properties":
159			if v != nil {
160				var serverProperties ServerProperties
161				err = json.Unmarshal(*v, &serverProperties)
162				if err != nil {
163					return err
164				}
165				s.ServerProperties = &serverProperties
166			}
167		case "id":
168			if v != nil {
169				var ID string
170				err = json.Unmarshal(*v, &ID)
171				if err != nil {
172					return err
173				}
174				s.ID = &ID
175			}
176		case "name":
177			if v != nil {
178				var name string
179				err = json.Unmarshal(*v, &name)
180				if err != nil {
181					return err
182				}
183				s.Name = &name
184			}
185		case "type":
186			if v != nil {
187				var typeVar string
188				err = json.Unmarshal(*v, &typeVar)
189				if err != nil {
190					return err
191				}
192				s.Type = &typeVar
193			}
194		case "location":
195			if v != nil {
196				var location string
197				err = json.Unmarshal(*v, &location)
198				if err != nil {
199					return err
200				}
201				s.Location = &location
202			}
203		case "sku":
204			if v != nil {
205				var sku ResourceSku
206				err = json.Unmarshal(*v, &sku)
207				if err != nil {
208					return err
209				}
210				s.Sku = &sku
211			}
212		case "tags":
213			if v != nil {
214				var tags map[string]*string
215				err = json.Unmarshal(*v, &tags)
216				if err != nil {
217					return err
218				}
219				s.Tags = tags
220			}
221		}
222	}
223
224	return nil
225}
226
227// ServerAdministrators an array of administrator user identities
228type ServerAdministrators struct {
229	// Members - An array of administrator user identities.
230	Members *[]string `json:"members,omitempty"`
231}
232
233// ServerMutableProperties an object that represents a set of mutable Analysis Services resource
234// properties.
235type ServerMutableProperties struct {
236	// AsAdministrators - A collection of AS server administrators
237	AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"`
238	// BackupBlobContainerURI - The container URI of backup blob.
239	BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"`
240}
241
242// ServerProperties properties of Analysis Services resource.
243type ServerProperties struct {
244	// State - READ-ONLY; The current state of Analysis Services resource. The state is to indicate more states outside of resource provisioning. Possible values include: 'StateDeleting', 'StateSucceeded', 'StateFailed', 'StatePaused', 'StateSuspended', 'StateProvisioning', 'StateUpdating', 'StateSuspending', 'StatePausing', 'StateResuming', 'StatePreparing', 'StateScaling'
245	State State `json:"state,omitempty"`
246	// ProvisioningState - READ-ONLY; The current deployment state of Analysis Services resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling'
247	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
248	// ServerFullName - READ-ONLY; The full name of the Analysis Services resource.
249	ServerFullName *string `json:"serverFullName,omitempty"`
250	// AsAdministrators - A collection of AS server administrators
251	AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"`
252	// BackupBlobContainerURI - The container URI of backup blob.
253	BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"`
254}
255
256// MarshalJSON is the custom marshaler for ServerProperties.
257func (sp ServerProperties) MarshalJSON() ([]byte, error) {
258	objectMap := make(map[string]interface{})
259	if sp.AsAdministrators != nil {
260		objectMap["asAdministrators"] = sp.AsAdministrators
261	}
262	if sp.BackupBlobContainerURI != nil {
263		objectMap["backupBlobContainerUri"] = sp.BackupBlobContainerURI
264	}
265	return json.Marshal(objectMap)
266}
267
268// Servers an array of Analysis Services resources.
269type Servers struct {
270	autorest.Response `json:"-"`
271	// Value - An array of Analysis Services resources.
272	Value *[]Server `json:"value,omitempty"`
273}
274
275// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running
276// operation.
277type ServersCreateFuture struct {
278	azure.FutureAPI
279	// Result returns the result of the asynchronous operation.
280	// If the operation has not completed it will return an error.
281	Result func(ServersClient) (Server, error)
282}
283
284// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
285// operation.
286type ServersDeleteFuture struct {
287	azure.FutureAPI
288	// Result returns the result of the asynchronous operation.
289	// If the operation has not completed it will return an error.
290	Result func(ServersClient) (autorest.Response, error)
291}
292
293// ServersResumeFuture an abstraction for monitoring and retrieving the results of a long-running
294// operation.
295type ServersResumeFuture struct {
296	azure.FutureAPI
297	// Result returns the result of the asynchronous operation.
298	// If the operation has not completed it will return an error.
299	Result func(ServersClient) (autorest.Response, error)
300}
301
302// ServersSuspendFuture an abstraction for monitoring and retrieving the results of a long-running
303// operation.
304type ServersSuspendFuture struct {
305	azure.FutureAPI
306	// Result returns the result of the asynchronous operation.
307	// If the operation has not completed it will return an error.
308	Result func(ServersClient) (autorest.Response, error)
309}
310
311// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
312// operation.
313type ServersUpdateFuture struct {
314	azure.FutureAPI
315	// Result returns the result of the asynchronous operation.
316	// If the operation has not completed it will return an error.
317	Result func(ServersClient) (Server, error)
318}
319
320// ServerUpdateParameters provision request specification
321type ServerUpdateParameters struct {
322	// Sku - The SKU of the Analysis Services resource.
323	Sku *ResourceSku `json:"sku,omitempty"`
324	// Tags - Key-value pairs of additional provisioning properties.
325	Tags map[string]*string `json:"tags"`
326	// ServerMutableProperties - Properties of the provision operation request.
327	*ServerMutableProperties `json:"properties,omitempty"`
328}
329
330// MarshalJSON is the custom marshaler for ServerUpdateParameters.
331func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) {
332	objectMap := make(map[string]interface{})
333	if sup.Sku != nil {
334		objectMap["sku"] = sup.Sku
335	}
336	if sup.Tags != nil {
337		objectMap["tags"] = sup.Tags
338	}
339	if sup.ServerMutableProperties != nil {
340		objectMap["properties"] = sup.ServerMutableProperties
341	}
342	return json.Marshal(objectMap)
343}
344
345// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct.
346func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error {
347	var m map[string]*json.RawMessage
348	err := json.Unmarshal(body, &m)
349	if err != nil {
350		return err
351	}
352	for k, v := range m {
353		switch k {
354		case "sku":
355			if v != nil {
356				var sku ResourceSku
357				err = json.Unmarshal(*v, &sku)
358				if err != nil {
359					return err
360				}
361				sup.Sku = &sku
362			}
363		case "tags":
364			if v != nil {
365				var tags map[string]*string
366				err = json.Unmarshal(*v, &tags)
367				if err != nil {
368					return err
369				}
370				sup.Tags = tags
371			}
372		case "properties":
373			if v != nil {
374				var serverMutableProperties ServerMutableProperties
375				err = json.Unmarshal(*v, &serverMutableProperties)
376				if err != nil {
377					return err
378				}
379				sup.ServerMutableProperties = &serverMutableProperties
380			}
381		}
382	}
383
384	return nil
385}
386
387// SkuDetailsForExistingResource an object that represents SKU details for existing resources
388type SkuDetailsForExistingResource struct {
389	// Sku - The SKU in SKU details for existing resources.
390	Sku *ResourceSku `json:"sku,omitempty"`
391}
392
393// SkuEnumerationForExistingResourceResult an object that represents enumerating SKUs for existing
394// resources
395type SkuEnumerationForExistingResourceResult struct {
396	autorest.Response `json:"-"`
397	// Value - The collection of available SKUs for existing resources
398	Value *[]SkuDetailsForExistingResource `json:"value,omitempty"`
399}
400
401// SkuEnumerationForNewResourceResult an object that represents enumerating SKUs for new resources
402type SkuEnumerationForNewResourceResult struct {
403	autorest.Response `json:"-"`
404	// Value - The collection of available SKUs for new resources
405	Value *[]ResourceSku `json:"value,omitempty"`
406}
407