1package hanaonazure 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/to" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// The package's fully qualified name. 31const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure" 32 33// HanaHardwareTypeNamesEnum enumerates the values for hana hardware type names enum. 34type HanaHardwareTypeNamesEnum string 35 36const ( 37 // CiscoUCS ... 38 CiscoUCS HanaHardwareTypeNamesEnum = "Cisco_UCS" 39 // HPE ... 40 HPE HanaHardwareTypeNamesEnum = "HPE" 41) 42 43// PossibleHanaHardwareTypeNamesEnumValues returns an array of possible values for the HanaHardwareTypeNamesEnum const type. 44func PossibleHanaHardwareTypeNamesEnumValues() []HanaHardwareTypeNamesEnum { 45 return []HanaHardwareTypeNamesEnum{CiscoUCS, HPE} 46} 47 48// HanaInstancePowerStateEnum enumerates the values for hana instance power state enum. 49type HanaInstancePowerStateEnum string 50 51const ( 52 // Restarting ... 53 Restarting HanaInstancePowerStateEnum = "restarting" 54 // Started ... 55 Started HanaInstancePowerStateEnum = "started" 56 // Starting ... 57 Starting HanaInstancePowerStateEnum = "starting" 58 // Stopped ... 59 Stopped HanaInstancePowerStateEnum = "stopped" 60 // Stopping ... 61 Stopping HanaInstancePowerStateEnum = "stopping" 62 // Unknown ... 63 Unknown HanaInstancePowerStateEnum = "unknown" 64) 65 66// PossibleHanaInstancePowerStateEnumValues returns an array of possible values for the HanaInstancePowerStateEnum const type. 67func PossibleHanaInstancePowerStateEnumValues() []HanaInstancePowerStateEnum { 68 return []HanaInstancePowerStateEnum{Restarting, Started, Starting, Stopped, Stopping, Unknown} 69} 70 71// HanaInstanceSizeNamesEnum enumerates the values for hana instance size names enum. 72type HanaInstanceSizeNamesEnum string 73 74const ( 75 // S144 ... 76 S144 HanaInstanceSizeNamesEnum = "S144" 77 // S144m ... 78 S144m HanaInstanceSizeNamesEnum = "S144m" 79 // S192 ... 80 S192 HanaInstanceSizeNamesEnum = "S192" 81 // S192m ... 82 S192m HanaInstanceSizeNamesEnum = "S192m" 83 // S192xm ... 84 S192xm HanaInstanceSizeNamesEnum = "S192xm" 85 // S224m ... 86 S224m HanaInstanceSizeNamesEnum = "S224m" 87 // S224o ... 88 S224o HanaInstanceSizeNamesEnum = "S224o" 89 // S224om ... 90 S224om HanaInstanceSizeNamesEnum = "S224om" 91 // S224oxm ... 92 S224oxm HanaInstanceSizeNamesEnum = "S224oxm" 93 // S224oxxm ... 94 S224oxxm HanaInstanceSizeNamesEnum = "S224oxxm" 95 // S384 ... 96 S384 HanaInstanceSizeNamesEnum = "S384" 97 // S384m ... 98 S384m HanaInstanceSizeNamesEnum = "S384m" 99 // S384xm ... 100 S384xm HanaInstanceSizeNamesEnum = "S384xm" 101 // S384xxm ... 102 S384xxm HanaInstanceSizeNamesEnum = "S384xxm" 103 // S576m ... 104 S576m HanaInstanceSizeNamesEnum = "S576m" 105 // S576xm ... 106 S576xm HanaInstanceSizeNamesEnum = "S576xm" 107 // S72 ... 108 S72 HanaInstanceSizeNamesEnum = "S72" 109 // S72m ... 110 S72m HanaInstanceSizeNamesEnum = "S72m" 111 // S768 ... 112 S768 HanaInstanceSizeNamesEnum = "S768" 113 // S768m ... 114 S768m HanaInstanceSizeNamesEnum = "S768m" 115 // S768xm ... 116 S768xm HanaInstanceSizeNamesEnum = "S768xm" 117 // S96 ... 118 S96 HanaInstanceSizeNamesEnum = "S96" 119 // S960m ... 120 S960m HanaInstanceSizeNamesEnum = "S960m" 121) 122 123// PossibleHanaInstanceSizeNamesEnumValues returns an array of possible values for the HanaInstanceSizeNamesEnum const type. 124func PossibleHanaInstanceSizeNamesEnumValues() []HanaInstanceSizeNamesEnum { 125 return []HanaInstanceSizeNamesEnum{S144, S144m, S192, S192m, S192xm, S224m, S224o, S224om, S224oxm, S224oxxm, S384, S384m, S384xm, S384xxm, S576m, S576xm, S72, S72m, S768, S768m, S768xm, S96, S960m} 126} 127 128// HanaProvisioningStatesEnum enumerates the values for hana provisioning states enum. 129type HanaProvisioningStatesEnum string 130 131const ( 132 // Accepted ... 133 Accepted HanaProvisioningStatesEnum = "Accepted" 134 // Creating ... 135 Creating HanaProvisioningStatesEnum = "Creating" 136 // Deleting ... 137 Deleting HanaProvisioningStatesEnum = "Deleting" 138 // Failed ... 139 Failed HanaProvisioningStatesEnum = "Failed" 140 // Migrating ... 141 Migrating HanaProvisioningStatesEnum = "Migrating" 142 // Succeeded ... 143 Succeeded HanaProvisioningStatesEnum = "Succeeded" 144 // Updating ... 145 Updating HanaProvisioningStatesEnum = "Updating" 146) 147 148// PossibleHanaProvisioningStatesEnumValues returns an array of possible values for the HanaProvisioningStatesEnum const type. 149func PossibleHanaProvisioningStatesEnumValues() []HanaProvisioningStatesEnum { 150 return []HanaProvisioningStatesEnum{Accepted, Creating, Deleting, Failed, Migrating, Succeeded, Updating} 151} 152 153// Disk specifies the disk information fo the HANA instance 154type Disk struct { 155 // Name - The disk name. 156 Name *string `json:"name,omitempty"` 157 // DiskSizeGB - Specifies the size of an empty data disk in gigabytes. 158 DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` 159 // Lun - READ-ONLY; Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. 160 Lun *int32 `json:"lun,omitempty"` 161} 162 163// Display detailed HANA operation information 164type Display struct { 165 // Provider - READ-ONLY; The localized friendly form of the resource provider name. This form is also expected to include the publisher/company responsible. Use Title Casing. Begin with "Microsoft" for 1st party services. 166 Provider *string `json:"provider,omitempty"` 167 // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. This form should match the public documentation for the resource provider. Use Title Casing. For examples, refer to the “name” section. 168 Resource *string `json:"resource,omitempty"` 169 // Operation - READ-ONLY; The localized friendly name for the operation as shown to the user. This name should be concise (to fit in drop downs), but clear (self-documenting). Use Title Casing and include the entity/resource to which it applies. 170 Operation *string `json:"operation,omitempty"` 171 // Description - READ-ONLY; The localized friendly description for the operation as shown to the user. This description should be thorough, yet concise. It will be used in tool-tips and detailed views. 172 Description *string `json:"description,omitempty"` 173 // Origin - READ-ONLY; The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. Default value is 'user,system' 174 Origin *string `json:"origin,omitempty"` 175} 176 177// ErrorResponse describes the format of Error response. 178type ErrorResponse struct { 179 // Code - Error code 180 Code *string `json:"code,omitempty"` 181 // Message - Error message indicating why the operation failed. 182 Message *string `json:"message,omitempty"` 183} 184 185// HanaInstance HANA instance info on Azure (ARM properties and HANA properties) 186type HanaInstance struct { 187 autorest.Response `json:"-"` 188 // HanaInstanceProperties - HANA instance properties 189 *HanaInstanceProperties `json:"properties,omitempty"` 190 // ID - READ-ONLY; Resource ID 191 ID *string `json:"id,omitempty"` 192 // Name - READ-ONLY; Resource name 193 Name *string `json:"name,omitempty"` 194 // Type - READ-ONLY; Resource type 195 Type *string `json:"type,omitempty"` 196 // Location - Resource location 197 Location *string `json:"location,omitempty"` 198 // Tags - READ-ONLY; Resource tags 199 Tags map[string]*string `json:"tags"` 200} 201 202// MarshalJSON is the custom marshaler for HanaInstance. 203func (hi HanaInstance) MarshalJSON() ([]byte, error) { 204 objectMap := make(map[string]interface{}) 205 if hi.HanaInstanceProperties != nil { 206 objectMap["properties"] = hi.HanaInstanceProperties 207 } 208 if hi.Location != nil { 209 objectMap["location"] = hi.Location 210 } 211 return json.Marshal(objectMap) 212} 213 214// UnmarshalJSON is the custom unmarshaler for HanaInstance struct. 215func (hi *HanaInstance) UnmarshalJSON(body []byte) error { 216 var m map[string]*json.RawMessage 217 err := json.Unmarshal(body, &m) 218 if err != nil { 219 return err 220 } 221 for k, v := range m { 222 switch k { 223 case "properties": 224 if v != nil { 225 var hanaInstanceProperties HanaInstanceProperties 226 err = json.Unmarshal(*v, &hanaInstanceProperties) 227 if err != nil { 228 return err 229 } 230 hi.HanaInstanceProperties = &hanaInstanceProperties 231 } 232 case "id": 233 if v != nil { 234 var ID string 235 err = json.Unmarshal(*v, &ID) 236 if err != nil { 237 return err 238 } 239 hi.ID = &ID 240 } 241 case "name": 242 if v != nil { 243 var name string 244 err = json.Unmarshal(*v, &name) 245 if err != nil { 246 return err 247 } 248 hi.Name = &name 249 } 250 case "type": 251 if v != nil { 252 var typeVar string 253 err = json.Unmarshal(*v, &typeVar) 254 if err != nil { 255 return err 256 } 257 hi.Type = &typeVar 258 } 259 case "location": 260 if v != nil { 261 var location string 262 err = json.Unmarshal(*v, &location) 263 if err != nil { 264 return err 265 } 266 hi.Location = &location 267 } 268 case "tags": 269 if v != nil { 270 var tags map[string]*string 271 err = json.Unmarshal(*v, &tags) 272 if err != nil { 273 return err 274 } 275 hi.Tags = tags 276 } 277 } 278 } 279 280 return nil 281} 282 283// HanaInstanceProperties describes the properties of a HANA instance. 284type HanaInstanceProperties struct { 285 // HardwareProfile - Specifies the hardware settings for the HANA instance. 286 HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` 287 // StorageProfile - Specifies the storage settings for the HANA instance disks. 288 StorageProfile *StorageProfile `json:"storageProfile,omitempty"` 289 // OsProfile - Specifies the operating system settings for the HANA instance. 290 OsProfile *OSProfile `json:"osProfile,omitempty"` 291 // NetworkProfile - Specifies the network settings for the HANA instance. 292 NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` 293 // HanaInstanceID - READ-ONLY; Specifies the HANA instance unique ID. 294 HanaInstanceID *string `json:"hanaInstanceId,omitempty"` 295 // PowerState - READ-ONLY; Resource power state. Possible values include: 'Starting', 'Started', 'Stopping', 'Stopped', 'Restarting', 'Unknown' 296 PowerState HanaInstancePowerStateEnum `json:"powerState,omitempty"` 297 // ProximityPlacementGroup - READ-ONLY; Resource proximity placement group 298 ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` 299 // HwRevision - READ-ONLY; Hardware revision of a HANA instance 300 HwRevision *string `json:"hwRevision,omitempty"` 301 // PartnerNodeID - ARM ID of another HanaInstance that will share a network with this HanaInstance 302 PartnerNodeID *string `json:"partnerNodeId,omitempty"` 303 // ProvisioningState - READ-ONLY; State of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' 304 ProvisioningState HanaProvisioningStatesEnum `json:"provisioningState,omitempty"` 305} 306 307// HanaInstancesCreateFuture an abstraction for monitoring and retrieving the results of a long-running 308// operation. 309type HanaInstancesCreateFuture struct { 310 azure.Future 311} 312 313// Result returns the result of the asynchronous operation. 314// If the operation has not completed it will return an error. 315func (future *HanaInstancesCreateFuture) Result(client HanaInstancesClient) (hi HanaInstance, err error) { 316 var done bool 317 done, err = future.DoneWithContext(context.Background(), client) 318 if err != nil { 319 err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesCreateFuture", "Result", future.Response(), "Polling failure") 320 return 321 } 322 if !done { 323 err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesCreateFuture") 324 return 325 } 326 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 327 if hi.Response.Response, err = future.GetResult(sender); err == nil && hi.Response.Response.StatusCode != http.StatusNoContent { 328 hi, err = client.CreateResponder(hi.Response.Response) 329 if err != nil { 330 err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesCreateFuture", "Result", hi.Response.Response, "Failure responding to request") 331 } 332 } 333 return 334} 335 336// HanaInstancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 337// operation. 338type HanaInstancesDeleteFuture struct { 339 azure.Future 340} 341 342// Result returns the result of the asynchronous operation. 343// If the operation has not completed it will return an error. 344func (future *HanaInstancesDeleteFuture) Result(client HanaInstancesClient) (ar autorest.Response, err error) { 345 var done bool 346 done, err = future.DoneWithContext(context.Background(), client) 347 if err != nil { 348 err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesDeleteFuture", "Result", future.Response(), "Polling failure") 349 return 350 } 351 if !done { 352 err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesDeleteFuture") 353 return 354 } 355 ar.Response = future.Response() 356 return 357} 358 359// HanaInstancesEnableMonitoringFuture an abstraction for monitoring and retrieving the results of a 360// long-running operation. 361type HanaInstancesEnableMonitoringFuture struct { 362 azure.Future 363} 364 365// Result returns the result of the asynchronous operation. 366// If the operation has not completed it will return an error. 367func (future *HanaInstancesEnableMonitoringFuture) Result(client HanaInstancesClient) (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, "hanaonazure.HanaInstancesEnableMonitoringFuture", "Result", future.Response(), "Polling failure") 372 return 373 } 374 if !done { 375 err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesEnableMonitoringFuture") 376 return 377 } 378 ar.Response = future.Response() 379 return 380} 381 382// HanaInstancesListResult the response from the List HANA Instances operation. 383type HanaInstancesListResult struct { 384 autorest.Response `json:"-"` 385 // Value - The list of SAP HANA on Azure instances. 386 Value *[]HanaInstance `json:"value,omitempty"` 387 // NextLink - The URL to get the next set of HANA instances. 388 NextLink *string `json:"nextLink,omitempty"` 389} 390 391// HanaInstancesListResultIterator provides access to a complete listing of HanaInstance values. 392type HanaInstancesListResultIterator struct { 393 i int 394 page HanaInstancesListResultPage 395} 396 397// NextWithContext advances to the next value. If there was an error making 398// the request the iterator does not advance and the error is returned. 399func (iter *HanaInstancesListResultIterator) NextWithContext(ctx context.Context) (err error) { 400 if tracing.IsEnabled() { 401 ctx = tracing.StartSpan(ctx, fqdn+"/HanaInstancesListResultIterator.NextWithContext") 402 defer func() { 403 sc := -1 404 if iter.Response().Response.Response != nil { 405 sc = iter.Response().Response.Response.StatusCode 406 } 407 tracing.EndSpan(ctx, sc, err) 408 }() 409 } 410 iter.i++ 411 if iter.i < len(iter.page.Values()) { 412 return nil 413 } 414 err = iter.page.NextWithContext(ctx) 415 if err != nil { 416 iter.i-- 417 return err 418 } 419 iter.i = 0 420 return nil 421} 422 423// Next advances to the next value. If there was an error making 424// the request the iterator does not advance and the error is returned. 425// Deprecated: Use NextWithContext() instead. 426func (iter *HanaInstancesListResultIterator) Next() error { 427 return iter.NextWithContext(context.Background()) 428} 429 430// NotDone returns true if the enumeration should be started or is not yet complete. 431func (iter HanaInstancesListResultIterator) NotDone() bool { 432 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 433} 434 435// Response returns the raw server response from the last page request. 436func (iter HanaInstancesListResultIterator) Response() HanaInstancesListResult { 437 return iter.page.Response() 438} 439 440// Value returns the current value or a zero-initialized value if the 441// iterator has advanced beyond the end of the collection. 442func (iter HanaInstancesListResultIterator) Value() HanaInstance { 443 if !iter.page.NotDone() { 444 return HanaInstance{} 445 } 446 return iter.page.Values()[iter.i] 447} 448 449// Creates a new instance of the HanaInstancesListResultIterator type. 450func NewHanaInstancesListResultIterator(page HanaInstancesListResultPage) HanaInstancesListResultIterator { 451 return HanaInstancesListResultIterator{page: page} 452} 453 454// IsEmpty returns true if the ListResult contains no values. 455func (hilr HanaInstancesListResult) IsEmpty() bool { 456 return hilr.Value == nil || len(*hilr.Value) == 0 457} 458 459// hanaInstancesListResultPreparer prepares a request to retrieve the next set of results. 460// It returns nil if no more results exist. 461func (hilr HanaInstancesListResult) hanaInstancesListResultPreparer(ctx context.Context) (*http.Request, error) { 462 if hilr.NextLink == nil || len(to.String(hilr.NextLink)) < 1 { 463 return nil, nil 464 } 465 return autorest.Prepare((&http.Request{}).WithContext(ctx), 466 autorest.AsJSON(), 467 autorest.AsGet(), 468 autorest.WithBaseURL(to.String(hilr.NextLink))) 469} 470 471// HanaInstancesListResultPage contains a page of HanaInstance values. 472type HanaInstancesListResultPage struct { 473 fn func(context.Context, HanaInstancesListResult) (HanaInstancesListResult, error) 474 hilr HanaInstancesListResult 475} 476 477// NextWithContext advances to the next page of values. If there was an error making 478// the request the page does not advance and the error is returned. 479func (page *HanaInstancesListResultPage) NextWithContext(ctx context.Context) (err error) { 480 if tracing.IsEnabled() { 481 ctx = tracing.StartSpan(ctx, fqdn+"/HanaInstancesListResultPage.NextWithContext") 482 defer func() { 483 sc := -1 484 if page.Response().Response.Response != nil { 485 sc = page.Response().Response.Response.StatusCode 486 } 487 tracing.EndSpan(ctx, sc, err) 488 }() 489 } 490 next, err := page.fn(ctx, page.hilr) 491 if err != nil { 492 return err 493 } 494 page.hilr = next 495 return nil 496} 497 498// Next advances to the next page of values. If there was an error making 499// the request the page does not advance and the error is returned. 500// Deprecated: Use NextWithContext() instead. 501func (page *HanaInstancesListResultPage) Next() error { 502 return page.NextWithContext(context.Background()) 503} 504 505// NotDone returns true if the page enumeration should be started or is not yet complete. 506func (page HanaInstancesListResultPage) NotDone() bool { 507 return !page.hilr.IsEmpty() 508} 509 510// Response returns the raw server response from the last page request. 511func (page HanaInstancesListResultPage) Response() HanaInstancesListResult { 512 return page.hilr 513} 514 515// Values returns the slice of values for the current page or nil if there are no values. 516func (page HanaInstancesListResultPage) Values() []HanaInstance { 517 if page.hilr.IsEmpty() { 518 return nil 519 } 520 return *page.hilr.Value 521} 522 523// Creates a new instance of the HanaInstancesListResultPage type. 524func NewHanaInstancesListResultPage(getNextPage func(context.Context, HanaInstancesListResult) (HanaInstancesListResult, error)) HanaInstancesListResultPage { 525 return HanaInstancesListResultPage{fn: getNextPage} 526} 527 528// HanaInstancesRestartFuture an abstraction for monitoring and retrieving the results of a long-running 529// operation. 530type HanaInstancesRestartFuture struct { 531 azure.Future 532} 533 534// Result returns the result of the asynchronous operation. 535// If the operation has not completed it will return an error. 536func (future *HanaInstancesRestartFuture) Result(client HanaInstancesClient) (ar autorest.Response, err error) { 537 var done bool 538 done, err = future.DoneWithContext(context.Background(), client) 539 if err != nil { 540 err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesRestartFuture", "Result", future.Response(), "Polling failure") 541 return 542 } 543 if !done { 544 err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesRestartFuture") 545 return 546 } 547 ar.Response = future.Response() 548 return 549} 550 551// HanaInstancesShutdownFuture an abstraction for monitoring and retrieving the results of a long-running 552// operation. 553type HanaInstancesShutdownFuture struct { 554 azure.Future 555} 556 557// Result returns the result of the asynchronous operation. 558// If the operation has not completed it will return an error. 559func (future *HanaInstancesShutdownFuture) Result(client HanaInstancesClient) (ar autorest.Response, err error) { 560 var done bool 561 done, err = future.DoneWithContext(context.Background(), client) 562 if err != nil { 563 err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesShutdownFuture", "Result", future.Response(), "Polling failure") 564 return 565 } 566 if !done { 567 err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesShutdownFuture") 568 return 569 } 570 ar.Response = future.Response() 571 return 572} 573 574// HanaInstancesStartFuture an abstraction for monitoring and retrieving the results of a long-running 575// operation. 576type HanaInstancesStartFuture struct { 577 azure.Future 578} 579 580// Result returns the result of the asynchronous operation. 581// If the operation has not completed it will return an error. 582func (future *HanaInstancesStartFuture) Result(client HanaInstancesClient) (ar autorest.Response, err error) { 583 var done bool 584 done, err = future.DoneWithContext(context.Background(), client) 585 if err != nil { 586 err = autorest.NewErrorWithError(err, "hanaonazure.HanaInstancesStartFuture", "Result", future.Response(), "Polling failure") 587 return 588 } 589 if !done { 590 err = azure.NewAsyncOpIncompleteError("hanaonazure.HanaInstancesStartFuture") 591 return 592 } 593 ar.Response = future.Response() 594 return 595} 596 597// HardwareProfile specifies the hardware settings for the HANA instance. 598type HardwareProfile struct { 599 // HardwareType - READ-ONLY; Name of the hardware type (vendor and/or their product name). Possible values include: 'CiscoUCS', 'HPE' 600 HardwareType HanaHardwareTypeNamesEnum `json:"hardwareType,omitempty"` 601 // HanaInstanceSize - READ-ONLY; Specifies the HANA instance SKU. Possible values include: 'S72m', 'S144m', 'S72', 'S144', 'S192', 'S192m', 'S192xm', 'S96', 'S384', 'S384m', 'S384xm', 'S384xxm', 'S576m', 'S576xm', 'S768', 'S768m', 'S768xm', 'S960m', 'S224o', 'S224m', 'S224om', 'S224oxm', 'S224oxxm' 602 HanaInstanceSize HanaInstanceSizeNamesEnum `json:"hanaInstanceSize,omitempty"` 603} 604 605// IPAddress specifies the IP address of the network interface. 606type IPAddress struct { 607 // IPAddress - Specifies the IP address of the network interface. 608 IPAddress *string `json:"ipAddress,omitempty"` 609} 610 611// MonitoringDetails details needed to monitor a Hana Instance 612type MonitoringDetails struct { 613 // HanaSubnet - ARM ID of an Azure Subnet with access to the HANA instance. 614 HanaSubnet *string `json:"hanaSubnet,omitempty"` 615 // HanaHostname - Hostname of the HANA Instance blade. 616 HanaHostname *string `json:"hanaHostname,omitempty"` 617 // HanaDbName - Name of the database itself. 618 HanaDbName *string `json:"hanaDbName,omitempty"` 619 // HanaDbSQLPort - The port number of the tenant DB. Used to connect to the DB. 620 HanaDbSQLPort *int32 `json:"hanaDbSqlPort,omitempty"` 621 // HanaDbUsername - Username for the HANA database to login to for monitoring 622 HanaDbUsername *string `json:"hanaDbUsername,omitempty"` 623 // HanaDbPassword - Password for the HANA database to login for monitoring 624 HanaDbPassword *string `json:"hanaDbPassword,omitempty"` 625} 626 627// NetworkProfile specifies the network settings for the HANA instance disks. 628type NetworkProfile struct { 629 // NetworkInterfaces - Specifies the network interfaces for the HANA instance. 630 NetworkInterfaces *[]IPAddress `json:"networkInterfaces,omitempty"` 631 // CircuitID - READ-ONLY; Specifies the circuit id for connecting to express route. 632 CircuitID *string `json:"circuitId,omitempty"` 633} 634 635// Operation HANA operation information 636type Operation struct { 637 // Name - READ-ONLY; The name of the operation being performed on this particular object. This name should match the action name that appears in RBAC / the event service. 638 Name *string `json:"name,omitempty"` 639 // Display - Displayed HANA operation information 640 Display *Display `json:"display,omitempty"` 641} 642 643// OperationList list of HANA operations 644type OperationList struct { 645 autorest.Response `json:"-"` 646 // Value - List of HANA operations 647 Value *[]Operation `json:"value,omitempty"` 648} 649 650// OSProfile specifies the operating system settings for the HANA instance. 651type OSProfile struct { 652 // ComputerName - Specifies the host OS name of the HANA instance. 653 ComputerName *string `json:"computerName,omitempty"` 654 // OsType - READ-ONLY; This property allows you to specify the type of the OS. 655 OsType *string `json:"osType,omitempty"` 656 // Version - READ-ONLY; Specifies version of operating system. 657 Version *string `json:"version,omitempty"` 658 // SSHPublicKey - Specifies the SSH public key used to access the operating system. 659 SSHPublicKey *string `json:"sshPublicKey,omitempty"` 660} 661 662// Resource the resource model definition. 663type Resource struct { 664 // ID - READ-ONLY; Resource ID 665 ID *string `json:"id,omitempty"` 666 // Name - READ-ONLY; Resource name 667 Name *string `json:"name,omitempty"` 668 // Type - READ-ONLY; Resource type 669 Type *string `json:"type,omitempty"` 670 // Location - Resource location 671 Location *string `json:"location,omitempty"` 672 // Tags - READ-ONLY; Resource tags 673 Tags map[string]*string `json:"tags"` 674} 675 676// MarshalJSON is the custom marshaler for Resource. 677func (r Resource) MarshalJSON() ([]byte, error) { 678 objectMap := make(map[string]interface{}) 679 if r.Location != nil { 680 objectMap["location"] = r.Location 681 } 682 return json.Marshal(objectMap) 683} 684 685// SapMonitor SAP monitor info on Azure (ARM properties and SAP monitor properties) 686type SapMonitor struct { 687 autorest.Response `json:"-"` 688 // SapMonitorProperties - SAP monitor properties 689 *SapMonitorProperties `json:"properties,omitempty"` 690 // ID - READ-ONLY; Resource ID 691 ID *string `json:"id,omitempty"` 692 // Name - READ-ONLY; Resource name 693 Name *string `json:"name,omitempty"` 694 // Type - READ-ONLY; Resource type 695 Type *string `json:"type,omitempty"` 696 // Location - Resource location 697 Location *string `json:"location,omitempty"` 698 // Tags - READ-ONLY; Resource tags 699 Tags map[string]*string `json:"tags"` 700} 701 702// MarshalJSON is the custom marshaler for SapMonitor. 703func (sm SapMonitor) MarshalJSON() ([]byte, error) { 704 objectMap := make(map[string]interface{}) 705 if sm.SapMonitorProperties != nil { 706 objectMap["properties"] = sm.SapMonitorProperties 707 } 708 if sm.Location != nil { 709 objectMap["location"] = sm.Location 710 } 711 return json.Marshal(objectMap) 712} 713 714// UnmarshalJSON is the custom unmarshaler for SapMonitor struct. 715func (sm *SapMonitor) UnmarshalJSON(body []byte) error { 716 var m map[string]*json.RawMessage 717 err := json.Unmarshal(body, &m) 718 if err != nil { 719 return err 720 } 721 for k, v := range m { 722 switch k { 723 case "properties": 724 if v != nil { 725 var sapMonitorProperties SapMonitorProperties 726 err = json.Unmarshal(*v, &sapMonitorProperties) 727 if err != nil { 728 return err 729 } 730 sm.SapMonitorProperties = &sapMonitorProperties 731 } 732 case "id": 733 if v != nil { 734 var ID string 735 err = json.Unmarshal(*v, &ID) 736 if err != nil { 737 return err 738 } 739 sm.ID = &ID 740 } 741 case "name": 742 if v != nil { 743 var name string 744 err = json.Unmarshal(*v, &name) 745 if err != nil { 746 return err 747 } 748 sm.Name = &name 749 } 750 case "type": 751 if v != nil { 752 var typeVar string 753 err = json.Unmarshal(*v, &typeVar) 754 if err != nil { 755 return err 756 } 757 sm.Type = &typeVar 758 } 759 case "location": 760 if v != nil { 761 var location string 762 err = json.Unmarshal(*v, &location) 763 if err != nil { 764 return err 765 } 766 sm.Location = &location 767 } 768 case "tags": 769 if v != nil { 770 var tags map[string]*string 771 err = json.Unmarshal(*v, &tags) 772 if err != nil { 773 return err 774 } 775 sm.Tags = tags 776 } 777 } 778 } 779 780 return nil 781} 782 783// SapMonitorListResult the response from the List SAP monitors operation. 784type SapMonitorListResult struct { 785 autorest.Response `json:"-"` 786 // Value - The list of SAP monitors. 787 Value *[]SapMonitor `json:"value,omitempty"` 788 // NextLink - The URL to get the next set of SAP monitors. 789 NextLink *string `json:"nextLink,omitempty"` 790} 791 792// SapMonitorListResultIterator provides access to a complete listing of SapMonitor values. 793type SapMonitorListResultIterator struct { 794 i int 795 page SapMonitorListResultPage 796} 797 798// NextWithContext advances to the next value. If there was an error making 799// the request the iterator does not advance and the error is returned. 800func (iter *SapMonitorListResultIterator) NextWithContext(ctx context.Context) (err error) { 801 if tracing.IsEnabled() { 802 ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorListResultIterator.NextWithContext") 803 defer func() { 804 sc := -1 805 if iter.Response().Response.Response != nil { 806 sc = iter.Response().Response.Response.StatusCode 807 } 808 tracing.EndSpan(ctx, sc, err) 809 }() 810 } 811 iter.i++ 812 if iter.i < len(iter.page.Values()) { 813 return nil 814 } 815 err = iter.page.NextWithContext(ctx) 816 if err != nil { 817 iter.i-- 818 return err 819 } 820 iter.i = 0 821 return nil 822} 823 824// Next advances to the next value. If there was an error making 825// the request the iterator does not advance and the error is returned. 826// Deprecated: Use NextWithContext() instead. 827func (iter *SapMonitorListResultIterator) Next() error { 828 return iter.NextWithContext(context.Background()) 829} 830 831// NotDone returns true if the enumeration should be started or is not yet complete. 832func (iter SapMonitorListResultIterator) NotDone() bool { 833 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 834} 835 836// Response returns the raw server response from the last page request. 837func (iter SapMonitorListResultIterator) Response() SapMonitorListResult { 838 return iter.page.Response() 839} 840 841// Value returns the current value or a zero-initialized value if the 842// iterator has advanced beyond the end of the collection. 843func (iter SapMonitorListResultIterator) Value() SapMonitor { 844 if !iter.page.NotDone() { 845 return SapMonitor{} 846 } 847 return iter.page.Values()[iter.i] 848} 849 850// Creates a new instance of the SapMonitorListResultIterator type. 851func NewSapMonitorListResultIterator(page SapMonitorListResultPage) SapMonitorListResultIterator { 852 return SapMonitorListResultIterator{page: page} 853} 854 855// IsEmpty returns true if the ListResult contains no values. 856func (smlr SapMonitorListResult) IsEmpty() bool { 857 return smlr.Value == nil || len(*smlr.Value) == 0 858} 859 860// sapMonitorListResultPreparer prepares a request to retrieve the next set of results. 861// It returns nil if no more results exist. 862func (smlr SapMonitorListResult) sapMonitorListResultPreparer(ctx context.Context) (*http.Request, error) { 863 if smlr.NextLink == nil || len(to.String(smlr.NextLink)) < 1 { 864 return nil, nil 865 } 866 return autorest.Prepare((&http.Request{}).WithContext(ctx), 867 autorest.AsJSON(), 868 autorest.AsGet(), 869 autorest.WithBaseURL(to.String(smlr.NextLink))) 870} 871 872// SapMonitorListResultPage contains a page of SapMonitor values. 873type SapMonitorListResultPage struct { 874 fn func(context.Context, SapMonitorListResult) (SapMonitorListResult, error) 875 smlr SapMonitorListResult 876} 877 878// NextWithContext advances to the next page of values. If there was an error making 879// the request the page does not advance and the error is returned. 880func (page *SapMonitorListResultPage) NextWithContext(ctx context.Context) (err error) { 881 if tracing.IsEnabled() { 882 ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorListResultPage.NextWithContext") 883 defer func() { 884 sc := -1 885 if page.Response().Response.Response != nil { 886 sc = page.Response().Response.Response.StatusCode 887 } 888 tracing.EndSpan(ctx, sc, err) 889 }() 890 } 891 next, err := page.fn(ctx, page.smlr) 892 if err != nil { 893 return err 894 } 895 page.smlr = next 896 return nil 897} 898 899// Next advances to the next page of values. If there was an error making 900// the request the page does not advance and the error is returned. 901// Deprecated: Use NextWithContext() instead. 902func (page *SapMonitorListResultPage) Next() error { 903 return page.NextWithContext(context.Background()) 904} 905 906// NotDone returns true if the page enumeration should be started or is not yet complete. 907func (page SapMonitorListResultPage) NotDone() bool { 908 return !page.smlr.IsEmpty() 909} 910 911// Response returns the raw server response from the last page request. 912func (page SapMonitorListResultPage) Response() SapMonitorListResult { 913 return page.smlr 914} 915 916// Values returns the slice of values for the current page or nil if there are no values. 917func (page SapMonitorListResultPage) Values() []SapMonitor { 918 if page.smlr.IsEmpty() { 919 return nil 920 } 921 return *page.smlr.Value 922} 923 924// Creates a new instance of the SapMonitorListResultPage type. 925func NewSapMonitorListResultPage(getNextPage func(context.Context, SapMonitorListResult) (SapMonitorListResult, error)) SapMonitorListResultPage { 926 return SapMonitorListResultPage{fn: getNextPage} 927} 928 929// SapMonitorProperties describes the properties of a SAP monitor. 930type SapMonitorProperties struct { 931 // HanaSubnet - Specifies the SAP monitor unique ID. 932 HanaSubnet *string `json:"hanaSubnet,omitempty"` 933 // HanaHostname - Hostname of the HANA instance. 934 HanaHostname *string `json:"hanaHostname,omitempty"` 935 // HanaDbName - Database name of the HANA instance. 936 HanaDbName *string `json:"hanaDbName,omitempty"` 937 // HanaDbSQLPort - Database port of the HANA instance. 938 HanaDbSQLPort *int32 `json:"hanaDbSqlPort,omitempty"` 939 // HanaDbUsername - Database username of the HANA instance. 940 HanaDbUsername *string `json:"hanaDbUsername,omitempty"` 941 // HanaDbPassword - Database password of the HANA instance. 942 HanaDbPassword *string `json:"hanaDbPassword,omitempty"` 943 // HanaDbPasswordKeyVaultURL - KeyVault URL link to the password for the HANA database. 944 HanaDbPasswordKeyVaultURL *string `json:"hanaDbPasswordKeyVaultUrl,omitempty"` 945 // HanaDbCredentialsMsiID - MSI ID passed by customer which has access to customer's KeyVault and to be assigned to the Collector VM. 946 HanaDbCredentialsMsiID *string `json:"hanaDbCredentialsMsiId,omitempty"` 947 // ProvisioningState - READ-ONLY; State of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' 948 ProvisioningState HanaProvisioningStatesEnum `json:"provisioningState,omitempty"` 949} 950 951// SapMonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running 952// operation. 953type SapMonitorsCreateFuture struct { 954 azure.Future 955} 956 957// Result returns the result of the asynchronous operation. 958// If the operation has not completed it will return an error. 959func (future *SapMonitorsCreateFuture) Result(client SapMonitorsClient) (sm SapMonitor, err error) { 960 var done bool 961 done, err = future.DoneWithContext(context.Background(), client) 962 if err != nil { 963 err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsCreateFuture", "Result", future.Response(), "Polling failure") 964 return 965 } 966 if !done { 967 err = azure.NewAsyncOpIncompleteError("hanaonazure.SapMonitorsCreateFuture") 968 return 969 } 970 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 971 if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { 972 sm, err = client.CreateResponder(sm.Response.Response) 973 if err != nil { 974 err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") 975 } 976 } 977 return 978} 979 980// SapMonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 981// operation. 982type SapMonitorsDeleteFuture struct { 983 azure.Future 984} 985 986// Result returns the result of the asynchronous operation. 987// If the operation has not completed it will return an error. 988func (future *SapMonitorsDeleteFuture) Result(client SapMonitorsClient) (ar autorest.Response, err error) { 989 var done bool 990 done, err = future.DoneWithContext(context.Background(), client) 991 if err != nil { 992 err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsDeleteFuture", "Result", future.Response(), "Polling failure") 993 return 994 } 995 if !done { 996 err = azure.NewAsyncOpIncompleteError("hanaonazure.SapMonitorsDeleteFuture") 997 return 998 } 999 ar.Response = future.Response() 1000 return 1001} 1002 1003// StorageProfile specifies the storage settings for the HANA instance disks. 1004type StorageProfile struct { 1005 // NfsIPAddress - READ-ONLY; IP Address to connect to storage. 1006 NfsIPAddress *string `json:"nfsIpAddress,omitempty"` 1007 // OsDisks - Specifies information about the operating system disk used by the hana instance. 1008 OsDisks *[]Disk `json:"osDisks,omitempty"` 1009} 1010 1011// Tags tags field of the HANA instance. 1012type Tags struct { 1013 // Tags - Tags field of the HANA instance. 1014 Tags map[string]*string `json:"tags"` 1015} 1016 1017// MarshalJSON is the custom marshaler for Tags. 1018func (t Tags) MarshalJSON() ([]byte, error) { 1019 objectMap := make(map[string]interface{}) 1020 if t.Tags != nil { 1021 objectMap["tags"] = t.Tags 1022 } 1023 return json.Marshal(objectMap) 1024} 1025