1package analysisservices 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 "net/http" 15) 16 17// The package's fully qualified name. 18const fqdn = "github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2016-05-16/analysisservices" 19 20// CheckServerNameAvailabilityParameters details of server name request body. 21type CheckServerNameAvailabilityParameters struct { 22 // Name - Name for checking availability. 23 Name *string `json:"name,omitempty"` 24 // Type - The resource type of azure analysis services. 25 Type *string `json:"type,omitempty"` 26} 27 28// CheckServerNameAvailabilityResult the checking result of server name availability. 29type CheckServerNameAvailabilityResult struct { 30 autorest.Response `json:"-"` 31 // NameAvailable - Indicator of available of the server name. 32 NameAvailable *bool `json:"nameAvailable,omitempty"` 33 // Reason - The reason of unavailability. 34 Reason *string `json:"reason,omitempty"` 35 // Message - The detailed message of the request unavailability. 36 Message *string `json:"message,omitempty"` 37} 38 39// ErrorResponse describes the format of Error response. 40type ErrorResponse struct { 41 // Code - Error code 42 Code *string `json:"code,omitempty"` 43 // Message - Error message indicating why the operation failed. 44 Message *string `json:"message,omitempty"` 45} 46 47// OperationStatus the status of operation. 48type OperationStatus struct { 49 autorest.Response `json:"-"` 50 // ID - The operation Id. 51 ID *string `json:"id,omitempty"` 52 // Name - The operation name. 53 Name *string `json:"name,omitempty"` 54 // StartTime - The start time of the operation. 55 StartTime *string `json:"startTime,omitempty"` 56 // EndTime - The end time of the operation. 57 EndTime *string `json:"endTime,omitempty"` 58 // Status - The status of the operation. 59 Status *string `json:"status,omitempty"` 60 // Error - The error detail of the operation if any. 61 Error *ErrorResponse `json:"error,omitempty"` 62} 63 64// Resource represents an instance of an Analysis Services resource. 65type Resource struct { 66 // ID - READ-ONLY; An identifier that represents the Analysis Services resource. 67 ID *string `json:"id,omitempty"` 68 // Name - READ-ONLY; The name of the Analysis Services resource. 69 Name *string `json:"name,omitempty"` 70 // Type - READ-ONLY; The type of the Analysis Services resource. 71 Type *string `json:"type,omitempty"` 72 // Location - Location of the Analysis Services resource. 73 Location *string `json:"location,omitempty"` 74 // Sku - The SKU of the Analysis Services resource. 75 Sku *ResourceSku `json:"sku,omitempty"` 76 // Tags - Key-value pairs of additional resource provisioning properties. 77 Tags map[string]*string `json:"tags"` 78} 79 80// MarshalJSON is the custom marshaler for Resource. 81func (r Resource) MarshalJSON() ([]byte, error) { 82 objectMap := make(map[string]interface{}) 83 if r.Location != nil { 84 objectMap["location"] = r.Location 85 } 86 if r.Sku != nil { 87 objectMap["sku"] = r.Sku 88 } 89 if r.Tags != nil { 90 objectMap["tags"] = r.Tags 91 } 92 return json.Marshal(objectMap) 93} 94 95// ResourceSku represents the SKU name and Azure pricing tier for Analysis Services resource. 96type ResourceSku struct { 97 // Name - Name of the SKU level. 98 Name *string `json:"name,omitempty"` 99 // Tier - The name of the Azure pricing tier to which the SKU applies. Possible values include: 'Development', 'Basic', 'Standard' 100 Tier SkuTier `json:"tier,omitempty"` 101} 102 103// Server represents an instance of an Analysis Services resource. 104type Server struct { 105 autorest.Response `json:"-"` 106 // ServerProperties - Properties of the provision operation request. 107 *ServerProperties `json:"properties,omitempty"` 108 // ID - READ-ONLY; An identifier that represents the Analysis Services resource. 109 ID *string `json:"id,omitempty"` 110 // Name - READ-ONLY; The name of the Analysis Services resource. 111 Name *string `json:"name,omitempty"` 112 // Type - READ-ONLY; The type of the Analysis Services resource. 113 Type *string `json:"type,omitempty"` 114 // Location - Location of the Analysis Services resource. 115 Location *string `json:"location,omitempty"` 116 // Sku - The SKU of the Analysis Services resource. 117 Sku *ResourceSku `json:"sku,omitempty"` 118 // Tags - Key-value pairs of additional resource provisioning properties. 119 Tags map[string]*string `json:"tags"` 120} 121 122// MarshalJSON is the custom marshaler for Server. 123func (s Server) MarshalJSON() ([]byte, error) { 124 objectMap := make(map[string]interface{}) 125 if s.ServerProperties != nil { 126 objectMap["properties"] = s.ServerProperties 127 } 128 if s.Location != nil { 129 objectMap["location"] = s.Location 130 } 131 if s.Sku != nil { 132 objectMap["sku"] = s.Sku 133 } 134 if s.Tags != nil { 135 objectMap["tags"] = s.Tags 136 } 137 return json.Marshal(objectMap) 138} 139 140// UnmarshalJSON is the custom unmarshaler for Server struct. 141func (s *Server) UnmarshalJSON(body []byte) error { 142 var m map[string]*json.RawMessage 143 err := json.Unmarshal(body, &m) 144 if err != nil { 145 return err 146 } 147 for k, v := range m { 148 switch k { 149 case "properties": 150 if v != nil { 151 var serverProperties ServerProperties 152 err = json.Unmarshal(*v, &serverProperties) 153 if err != nil { 154 return err 155 } 156 s.ServerProperties = &serverProperties 157 } 158 case "id": 159 if v != nil { 160 var ID string 161 err = json.Unmarshal(*v, &ID) 162 if err != nil { 163 return err 164 } 165 s.ID = &ID 166 } 167 case "name": 168 if v != nil { 169 var name string 170 err = json.Unmarshal(*v, &name) 171 if err != nil { 172 return err 173 } 174 s.Name = &name 175 } 176 case "type": 177 if v != nil { 178 var typeVar string 179 err = json.Unmarshal(*v, &typeVar) 180 if err != nil { 181 return err 182 } 183 s.Type = &typeVar 184 } 185 case "location": 186 if v != nil { 187 var location string 188 err = json.Unmarshal(*v, &location) 189 if err != nil { 190 return err 191 } 192 s.Location = &location 193 } 194 case "sku": 195 if v != nil { 196 var sku ResourceSku 197 err = json.Unmarshal(*v, &sku) 198 if err != nil { 199 return err 200 } 201 s.Sku = &sku 202 } 203 case "tags": 204 if v != nil { 205 var tags map[string]*string 206 err = json.Unmarshal(*v, &tags) 207 if err != nil { 208 return err 209 } 210 s.Tags = tags 211 } 212 } 213 } 214 215 return nil 216} 217 218// ServerAdministrators an array of administrator user identities 219type ServerAdministrators struct { 220 // Members - An array of administrator user identities. 221 Members *[]string `json:"members,omitempty"` 222} 223 224// ServerMutableProperties an object that represents a set of mutable Analysis Services resource 225// properties. 226type ServerMutableProperties struct { 227 // AsAdministrators - A collection of AS server administrators 228 AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` 229 // BackupBlobContainerURI - The container URI of backup blob. 230 BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"` 231} 232 233// ServerProperties properties of Analysis Services resource. 234type ServerProperties struct { 235 // 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' 236 State State `json:"state,omitempty"` 237 // 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' 238 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 239 // ServerFullName - READ-ONLY; The full name of the Analysis Services resource. 240 ServerFullName *string `json:"serverFullName,omitempty"` 241 // AsAdministrators - A collection of AS server administrators 242 AsAdministrators *ServerAdministrators `json:"asAdministrators,omitempty"` 243 // BackupBlobContainerURI - The container URI of backup blob. 244 BackupBlobContainerURI *string `json:"backupBlobContainerUri,omitempty"` 245} 246 247// MarshalJSON is the custom marshaler for ServerProperties. 248func (sp ServerProperties) MarshalJSON() ([]byte, error) { 249 objectMap := make(map[string]interface{}) 250 if sp.AsAdministrators != nil { 251 objectMap["asAdministrators"] = sp.AsAdministrators 252 } 253 if sp.BackupBlobContainerURI != nil { 254 objectMap["backupBlobContainerUri"] = sp.BackupBlobContainerURI 255 } 256 return json.Marshal(objectMap) 257} 258 259// Servers an array of Analysis Services resources. 260type Servers struct { 261 autorest.Response `json:"-"` 262 // Value - An array of Analysis Services resources. 263 Value *[]Server `json:"value,omitempty"` 264} 265 266// ServersCreateFuture an abstraction for monitoring and retrieving the results of a long-running 267// operation. 268type ServersCreateFuture struct { 269 azure.FutureAPI 270 // Result returns the result of the asynchronous operation. 271 // If the operation has not completed it will return an error. 272 Result func(ServersClient) (Server, error) 273} 274 275// UnmarshalJSON is the custom unmarshaller for CreateFuture. 276func (future *ServersCreateFuture) UnmarshalJSON(body []byte) error { 277 var azFuture azure.Future 278 if err := json.Unmarshal(body, &azFuture); err != nil { 279 return err 280 } 281 future.FutureAPI = &azFuture 282 future.Result = future.result 283 return nil 284} 285 286// result is the default implementation for ServersCreateFuture.Result. 287func (future *ServersCreateFuture) result(client ServersClient) (s Server, err error) { 288 var done bool 289 done, err = future.DoneWithContext(context.Background(), client) 290 if err != nil { 291 err = autorest.NewErrorWithError(err, "analysisservices.ServersCreateFuture", "Result", future.Response(), "Polling failure") 292 return 293 } 294 if !done { 295 s.Response.Response = future.Response() 296 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersCreateFuture") 297 return 298 } 299 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 300 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 301 s, err = client.CreateResponder(s.Response.Response) 302 if err != nil { 303 err = autorest.NewErrorWithError(err, "analysisservices.ServersCreateFuture", "Result", s.Response.Response, "Failure responding to request") 304 } 305 } 306 return 307} 308 309// ServersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 310// operation. 311type ServersDeleteFuture struct { 312 azure.FutureAPI 313 // Result returns the result of the asynchronous operation. 314 // If the operation has not completed it will return an error. 315 Result func(ServersClient) (autorest.Response, error) 316} 317 318// UnmarshalJSON is the custom unmarshaller for CreateFuture. 319func (future *ServersDeleteFuture) UnmarshalJSON(body []byte) error { 320 var azFuture azure.Future 321 if err := json.Unmarshal(body, &azFuture); err != nil { 322 return err 323 } 324 future.FutureAPI = &azFuture 325 future.Result = future.result 326 return nil 327} 328 329// result is the default implementation for ServersDeleteFuture.Result. 330func (future *ServersDeleteFuture) result(client ServersClient) (ar autorest.Response, err error) { 331 var done bool 332 done, err = future.DoneWithContext(context.Background(), client) 333 if err != nil { 334 err = autorest.NewErrorWithError(err, "analysisservices.ServersDeleteFuture", "Result", future.Response(), "Polling failure") 335 return 336 } 337 if !done { 338 ar.Response = future.Response() 339 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersDeleteFuture") 340 return 341 } 342 ar.Response = future.Response() 343 return 344} 345 346// ServersResumeFuture an abstraction for monitoring and retrieving the results of a long-running 347// operation. 348type ServersResumeFuture struct { 349 azure.FutureAPI 350 // Result returns the result of the asynchronous operation. 351 // If the operation has not completed it will return an error. 352 Result func(ServersClient) (autorest.Response, error) 353} 354 355// UnmarshalJSON is the custom unmarshaller for CreateFuture. 356func (future *ServersResumeFuture) UnmarshalJSON(body []byte) error { 357 var azFuture azure.Future 358 if err := json.Unmarshal(body, &azFuture); err != nil { 359 return err 360 } 361 future.FutureAPI = &azFuture 362 future.Result = future.result 363 return nil 364} 365 366// result is the default implementation for ServersResumeFuture.Result. 367func (future *ServersResumeFuture) result(client ServersClient) (ar autorest.Response, err error) { 368 var done bool 369 done, err = future.DoneWithContext(context.Background(), client) 370 if err != nil { 371 err = autorest.NewErrorWithError(err, "analysisservices.ServersResumeFuture", "Result", future.Response(), "Polling failure") 372 return 373 } 374 if !done { 375 ar.Response = future.Response() 376 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersResumeFuture") 377 return 378 } 379 ar.Response = future.Response() 380 return 381} 382 383// ServersSuspendFuture an abstraction for monitoring and retrieving the results of a long-running 384// operation. 385type ServersSuspendFuture struct { 386 azure.FutureAPI 387 // Result returns the result of the asynchronous operation. 388 // If the operation has not completed it will return an error. 389 Result func(ServersClient) (autorest.Response, error) 390} 391 392// UnmarshalJSON is the custom unmarshaller for CreateFuture. 393func (future *ServersSuspendFuture) UnmarshalJSON(body []byte) error { 394 var azFuture azure.Future 395 if err := json.Unmarshal(body, &azFuture); err != nil { 396 return err 397 } 398 future.FutureAPI = &azFuture 399 future.Result = future.result 400 return nil 401} 402 403// result is the default implementation for ServersSuspendFuture.Result. 404func (future *ServersSuspendFuture) result(client ServersClient) (ar autorest.Response, err error) { 405 var done bool 406 done, err = future.DoneWithContext(context.Background(), client) 407 if err != nil { 408 err = autorest.NewErrorWithError(err, "analysisservices.ServersSuspendFuture", "Result", future.Response(), "Polling failure") 409 return 410 } 411 if !done { 412 ar.Response = future.Response() 413 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersSuspendFuture") 414 return 415 } 416 ar.Response = future.Response() 417 return 418} 419 420// ServersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 421// operation. 422type ServersUpdateFuture struct { 423 azure.FutureAPI 424 // Result returns the result of the asynchronous operation. 425 // If the operation has not completed it will return an error. 426 Result func(ServersClient) (Server, error) 427} 428 429// UnmarshalJSON is the custom unmarshaller for CreateFuture. 430func (future *ServersUpdateFuture) UnmarshalJSON(body []byte) error { 431 var azFuture azure.Future 432 if err := json.Unmarshal(body, &azFuture); err != nil { 433 return err 434 } 435 future.FutureAPI = &azFuture 436 future.Result = future.result 437 return nil 438} 439 440// result is the default implementation for ServersUpdateFuture.Result. 441func (future *ServersUpdateFuture) result(client ServersClient) (s Server, err error) { 442 var done bool 443 done, err = future.DoneWithContext(context.Background(), client) 444 if err != nil { 445 err = autorest.NewErrorWithError(err, "analysisservices.ServersUpdateFuture", "Result", future.Response(), "Polling failure") 446 return 447 } 448 if !done { 449 s.Response.Response = future.Response() 450 err = azure.NewAsyncOpIncompleteError("analysisservices.ServersUpdateFuture") 451 return 452 } 453 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 454 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 455 s, err = client.UpdateResponder(s.Response.Response) 456 if err != nil { 457 err = autorest.NewErrorWithError(err, "analysisservices.ServersUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 458 } 459 } 460 return 461} 462 463// ServerUpdateParameters provision request specification 464type ServerUpdateParameters struct { 465 // Sku - The SKU of the Analysis Services resource. 466 Sku *ResourceSku `json:"sku,omitempty"` 467 // Tags - Key-value pairs of additional provisioning properties. 468 Tags map[string]*string `json:"tags"` 469 // ServerMutableProperties - Properties of the provision operation request. 470 *ServerMutableProperties `json:"properties,omitempty"` 471} 472 473// MarshalJSON is the custom marshaler for ServerUpdateParameters. 474func (sup ServerUpdateParameters) MarshalJSON() ([]byte, error) { 475 objectMap := make(map[string]interface{}) 476 if sup.Sku != nil { 477 objectMap["sku"] = sup.Sku 478 } 479 if sup.Tags != nil { 480 objectMap["tags"] = sup.Tags 481 } 482 if sup.ServerMutableProperties != nil { 483 objectMap["properties"] = sup.ServerMutableProperties 484 } 485 return json.Marshal(objectMap) 486} 487 488// UnmarshalJSON is the custom unmarshaler for ServerUpdateParameters struct. 489func (sup *ServerUpdateParameters) UnmarshalJSON(body []byte) error { 490 var m map[string]*json.RawMessage 491 err := json.Unmarshal(body, &m) 492 if err != nil { 493 return err 494 } 495 for k, v := range m { 496 switch k { 497 case "sku": 498 if v != nil { 499 var sku ResourceSku 500 err = json.Unmarshal(*v, &sku) 501 if err != nil { 502 return err 503 } 504 sup.Sku = &sku 505 } 506 case "tags": 507 if v != nil { 508 var tags map[string]*string 509 err = json.Unmarshal(*v, &tags) 510 if err != nil { 511 return err 512 } 513 sup.Tags = tags 514 } 515 case "properties": 516 if v != nil { 517 var serverMutableProperties ServerMutableProperties 518 err = json.Unmarshal(*v, &serverMutableProperties) 519 if err != nil { 520 return err 521 } 522 sup.ServerMutableProperties = &serverMutableProperties 523 } 524 } 525 } 526 527 return nil 528} 529 530// SkuDetailsForExistingResource an object that represents SKU details for existing resources 531type SkuDetailsForExistingResource struct { 532 // Sku - The SKU in SKU details for existing resources. 533 Sku *ResourceSku `json:"sku,omitempty"` 534} 535 536// SkuEnumerationForExistingResourceResult an object that represents enumerating SKUs for existing 537// resources 538type SkuEnumerationForExistingResourceResult struct { 539 autorest.Response `json:"-"` 540 // Value - The collection of available SKUs for existing resources 541 Value *[]SkuDetailsForExistingResource `json:"value,omitempty"` 542} 543 544// SkuEnumerationForNewResourceResult an object that represents enumerating SKUs for new resources 545type SkuEnumerationForNewResourceResult struct { 546 autorest.Response `json:"-"` 547 // Value - The collection of available SKUs for new resources 548 Value *[]ResourceSku `json:"value,omitempty"` 549} 550