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