From 215fbbd164945cdac4a7eaab6fb9422fe96b42f3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 5 Jul 2021 03:24:18 +0000 Subject: [PATCH] CodeGen from PR 14879 in Azure/azure-rest-api-specs Microsoft.HanaOnAzure swagger: Update spec to add missing fields (#14879) * Microsoft.HanaOnAzure swagger: Update spec with missing fields from RP Add HanaSID array to StorageProfile properties * Update ListOperations API to include isDataAction field * Add examples for HanaSID field * correct bool to boolean * Fix LintDiff error introduced by this PR --- .../hanaonazure/CHANGELOG.md | 87 ++- .../2017-11-03-preview/hanaonazure/_meta.json | 2 +- .../hanaonazure/hanaonazureapi/interfaces.go | 12 - .../2017-11-03-preview/hanaonazure/models.go | 535 ++---------------- .../hanaonazure/sapmonitors.go | 458 --------------- 5 files changed, 134 insertions(+), 960 deletions(-) delete mode 100644 services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/sapmonitors.go diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/CHANGELOG.md b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/CHANGELOG.md index c2e943abe6e7..e20fe479e249 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/CHANGELOG.md +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/CHANGELOG.md @@ -1,8 +1,89 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Funcs + +1. *SapMonitor.UnmarshalJSON([]byte) error +1. *SapMonitorListResultIterator.Next() error +1. *SapMonitorListResultIterator.NextWithContext(context.Context) error +1. *SapMonitorListResultPage.Next() error +1. *SapMonitorListResultPage.NextWithContext(context.Context) error +1. *SapMonitorsCreateFuture.UnmarshalJSON([]byte) error +1. *SapMonitorsDeleteFuture.UnmarshalJSON([]byte) error +1. HanaInstanceProperties.MarshalJSON() ([]byte, error) +1. HardwareProfile.MarshalJSON() ([]byte, error) +1. NetworkProfile.MarshalJSON() ([]byte, error) +1. NewSapMonitorListResultIterator(SapMonitorListResultPage) SapMonitorListResultIterator +1. NewSapMonitorListResultPage(SapMonitorListResult, func(context.Context, SapMonitorListResult) (SapMonitorListResult, error)) SapMonitorListResultPage +1. NewSapMonitorsClient(string) SapMonitorsClient +1. NewSapMonitorsClientWithBaseURI(string, string) SapMonitorsClient +1. OSProfile.MarshalJSON() ([]byte, error) +1. SapMonitor.MarshalJSON() ([]byte, error) +1. SapMonitorListResult.IsEmpty() bool +1. SapMonitorListResultIterator.NotDone() bool +1. SapMonitorListResultIterator.Response() SapMonitorListResult +1. SapMonitorListResultIterator.Value() SapMonitor +1. SapMonitorListResultPage.NotDone() bool +1. SapMonitorListResultPage.Response() SapMonitorListResult +1. SapMonitorListResultPage.Values() []SapMonitor +1. SapMonitorProperties.MarshalJSON() ([]byte, error) +1. SapMonitorsClient.Create(context.Context, string, string, SapMonitor) (SapMonitorsCreateFuture, error) +1. SapMonitorsClient.CreatePreparer(context.Context, string, string, SapMonitor) (*http.Request, error) +1. SapMonitorsClient.CreateResponder(*http.Response) (SapMonitor, error) +1. SapMonitorsClient.CreateSender(*http.Request) (SapMonitorsCreateFuture, error) +1. SapMonitorsClient.Delete(context.Context, string, string) (SapMonitorsDeleteFuture, error) +1. SapMonitorsClient.DeletePreparer(context.Context, string, string) (*http.Request, error) +1. SapMonitorsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. SapMonitorsClient.DeleteSender(*http.Request) (SapMonitorsDeleteFuture, error) +1. SapMonitorsClient.Get(context.Context, string, string) (SapMonitor, error) +1. SapMonitorsClient.GetPreparer(context.Context, string, string) (*http.Request, error) +1. SapMonitorsClient.GetResponder(*http.Response) (SapMonitor, error) +1. SapMonitorsClient.GetSender(*http.Request) (*http.Response, error) +1. SapMonitorsClient.List(context.Context) (SapMonitorListResultPage, error) +1. SapMonitorsClient.ListComplete(context.Context) (SapMonitorListResultIterator, error) +1. SapMonitorsClient.ListPreparer(context.Context) (*http.Request, error) +1. SapMonitorsClient.ListResponder(*http.Response) (SapMonitorListResult, error) +1. SapMonitorsClient.ListSender(*http.Request) (*http.Response, error) +1. SapMonitorsClient.Update(context.Context, string, string, Tags) (SapMonitor, error) +1. SapMonitorsClient.UpdatePreparer(context.Context, string, string, Tags) (*http.Request, error) +1. SapMonitorsClient.UpdateResponder(*http.Response) (SapMonitor, error) +1. SapMonitorsClient.UpdateSender(*http.Request) (*http.Response, error) +1. StorageProfile.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### Removed Structs + +1. SapMonitor +1. SapMonitorListResult +1. SapMonitorListResultIterator +1. SapMonitorListResultPage +1. SapMonitorProperties +1. SapMonitorsClient +1. SapMonitorsCreateFuture +1. SapMonitorsDeleteFuture + +#### Removed Struct Fields + +1. ErrorResponse.Code +1. ErrorResponse.Message ## Additive Changes ### New Funcs -1. Display.MarshalJSON() ([]byte, error) -1. HardwareProfile.MarshalJSON() ([]byte, error) +1. ErrorResponseError.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorResponseError +1. SAPSystemID + +#### New Struct Fields + +1. ErrorResponse.Error +1. Operation.IsDataAction +1. StorageProfile.HanaSids diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/_meta.json b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/_meta.json index e3ee1c46fab4..7c16465a1280 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/_meta.json +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "4503223a905cff50f32d5b26c84867c9aab2f81a", "readme": "/_/azure-rest-api-specs/specification/hanaonazure/resource-manager/readme.md", "tag": "package-2017-11", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go index acaaadf0d29a..c3f07059fd1c 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/hanaonazureapi/interfaces.go @@ -34,15 +34,3 @@ type HanaInstancesClientAPI interface { } var _ HanaInstancesClientAPI = (*hanaonazure.HanaInstancesClient)(nil) - -// SapMonitorsClientAPI contains the set of methods on the SapMonitorsClient type. -type SapMonitorsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, sapMonitorName string, sapMonitorParameter hanaonazure.SapMonitor) (result hanaonazure.SapMonitorsCreateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, sapMonitorName string) (result hanaonazure.SapMonitorsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, sapMonitorName string) (result hanaonazure.SapMonitor, err error) - List(ctx context.Context) (result hanaonazure.SapMonitorListResultPage, err error) - ListComplete(ctx context.Context) (result hanaonazure.SapMonitorListResultIterator, err error) - Update(ctx context.Context, resourceGroupName string, sapMonitorName string, tagsParameter hanaonazure.Tags) (result hanaonazure.SapMonitor, err error) -} - -var _ SapMonitorsClientAPI = (*hanaonazure.SapMonitorsClient)(nil) diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go index 9aecf6574731..74fc4fed1452 100644 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go +++ b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/models.go @@ -19,7 +19,7 @@ import ( // The package's fully qualified name. const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure" -// Disk specifies the disk information fo the HANA instance +// Disk specifies the disk information for the HANA instance type Disk struct { // Name - The disk name. Name *string `json:"name,omitempty"` @@ -63,12 +63,24 @@ func (d Display) MarshalJSON() ([]byte, error) { // ErrorResponse describes the format of Error response. type ErrorResponse struct { - // Code - Error code + // Error - Describes the error object. + Error *ErrorResponseError `json:"error,omitempty"` +} + +// ErrorResponseError describes the error object. +type ErrorResponseError struct { + // Code - READ-ONLY; Error code Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. + // Message - READ-ONLY; Error message indicating why the operation failed. Message *string `json:"message,omitempty"` } +// MarshalJSON is the custom marshaler for ErrorResponseError. +func (er ErrorResponseError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // HanaInstance HANA instance info on Azure (ARM properties and HANA properties) type HanaInstance struct { autorest.Response `json:"-"` @@ -82,7 +94,7 @@ type HanaInstance struct { Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; Resource tags + // Tags - Resource tags Tags map[string]*string `json:"tags"` } @@ -95,6 +107,9 @@ func (hi HanaInstance) MarshalJSON() ([]byte, error) { if hi.Location != nil { objectMap["location"] = hi.Location } + if hi.Tags != nil { + objectMap["tags"] = hi.Tags + } return json.Marshal(objectMap) } @@ -177,41 +192,20 @@ type HanaInstanceProperties struct { OsProfile *OSProfile `json:"osProfile,omitempty"` // NetworkProfile - Specifies the network settings for the HANA instance. NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` - // HanaInstanceID - READ-ONLY; Specifies the HANA instance unique ID. + // HanaInstanceID - Specifies the HANA instance unique ID. HanaInstanceID *string `json:"hanaInstanceId,omitempty"` - // PowerState - READ-ONLY; Resource power state. Possible values include: 'Starting', 'Started', 'Stopping', 'Stopped', 'Restarting', 'Unknown' + // PowerState - Resource power state. Possible values include: 'Starting', 'Started', 'Stopping', 'Stopped', 'Restarting', 'Unknown' PowerState HanaInstancePowerStateEnum `json:"powerState,omitempty"` - // ProximityPlacementGroup - READ-ONLY; Resource proximity placement group + // ProximityPlacementGroup - Resource proximity placement group ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - // HwRevision - READ-ONLY; Hardware revision of a HANA instance + // HwRevision - Hardware revision of a HANA instance HwRevision *string `json:"hwRevision,omitempty"` // PartnerNodeID - ARM ID of another HanaInstance that will share a network with this HanaInstance PartnerNodeID *string `json:"partnerNodeId,omitempty"` - // ProvisioningState - READ-ONLY; State of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' + // ProvisioningState - State of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' ProvisioningState HanaProvisioningStatesEnum `json:"provisioningState,omitempty"` } -// MarshalJSON is the custom marshaler for HanaInstanceProperties. -func (hip HanaInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if hip.HardwareProfile != nil { - objectMap["hardwareProfile"] = hip.HardwareProfile - } - if hip.StorageProfile != nil { - objectMap["storageProfile"] = hip.StorageProfile - } - if hip.OsProfile != nil { - objectMap["osProfile"] = hip.OsProfile - } - if hip.NetworkProfile != nil { - objectMap["networkProfile"] = hip.NetworkProfile - } - if hip.PartnerNodeID != nil { - objectMap["partnerNodeId"] = hip.PartnerNodeID - } - return json.Marshal(objectMap) -} - // HanaInstancesCreateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type HanaInstancesCreateFuture struct { @@ -564,18 +558,12 @@ func (future *HanaInstancesStartFuture) result(client HanaInstancesClient) (ar a // HardwareProfile specifies the hardware settings for the HANA instance. type HardwareProfile struct { - // HardwareType - READ-ONLY; Name of the hardware type (vendor and/or their product name). Possible values include: 'CiscoUCS', 'HPE' + // HardwareType - Name of the hardware type (vendor and/or their product name). Possible values include: 'CiscoUCS', 'HPE' HardwareType HanaHardwareTypeNamesEnum `json:"hardwareType,omitempty"` - // 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' + // HanaInstanceSize - 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' HanaInstanceSize HanaInstanceSizeNamesEnum `json:"hanaInstanceSize,omitempty"` } -// MarshalJSON is the custom marshaler for HardwareProfile. -func (hp HardwareProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - // IPAddress specifies the IP address of the network interface. type IPAddress struct { // IPAddress - Specifies the IP address of the network interface. @@ -602,25 +590,18 @@ type MonitoringDetails struct { type NetworkProfile struct { // NetworkInterfaces - Specifies the network interfaces for the HANA instance. NetworkInterfaces *[]IPAddress `json:"networkInterfaces,omitempty"` - // CircuitID - READ-ONLY; Specifies the circuit id for connecting to express route. + // CircuitID - Specifies the circuit id for connecting to express route. CircuitID *string `json:"circuitId,omitempty"` } -// MarshalJSON is the custom marshaler for NetworkProfile. -func (np NetworkProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if np.NetworkInterfaces != nil { - objectMap["networkInterfaces"] = np.NetworkInterfaces - } - return json.Marshal(objectMap) -} - // Operation HANA operation information type Operation struct { // 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. Name *string `json:"name,omitempty"` // Display - Displayed HANA operation information Display *Display `json:"display,omitempty"` + // IsDataAction - READ-ONLY; Indicates whether the operation applies to data-plane. + IsDataAction *bool `json:"isDataAction,omitempty"` } // MarshalJSON is the custom marshaler for Operation. @@ -643,26 +624,14 @@ type OperationList struct { type OSProfile struct { // ComputerName - Specifies the host OS name of the HANA instance. ComputerName *string `json:"computerName,omitempty"` - // OsType - READ-ONLY; This property allows you to specify the type of the OS. + // OsType - This property allows you to specify the type of the OS. OsType *string `json:"osType,omitempty"` - // Version - READ-ONLY; Specifies version of operating system. + // Version - Specifies version of operating system. Version *string `json:"version,omitempty"` // SSHPublicKey - Specifies the SSH public key used to access the operating system. SSHPublicKey *string `json:"sshPublicKey,omitempty"` } -// MarshalJSON is the custom marshaler for OSProfile. -func (op OSProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if op.ComputerName != nil { - objectMap["computerName"] = op.ComputerName - } - if op.SSHPublicKey != nil { - objectMap["sshPublicKey"] = op.SSHPublicKey - } - return json.Marshal(objectMap) -} - // Resource the resource model definition. type Resource struct { // ID - READ-ONLY; Resource ID @@ -673,7 +642,7 @@ type Resource struct { Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; Resource tags + // Tags - Resource tags Tags map[string]*string `json:"tags"` } @@ -683,440 +652,34 @@ func (r Resource) MarshalJSON() ([]byte, error) { if r.Location != nil { objectMap["location"] = r.Location } - return json.Marshal(objectMap) -} - -// SapMonitor SAP monitor info on Azure (ARM properties and SAP monitor properties) -type SapMonitor struct { - autorest.Response `json:"-"` - // SapMonitorProperties - SAP monitor properties - *SapMonitorProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource ID - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - READ-ONLY; Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for SapMonitor. -func (sm SapMonitor) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.SapMonitorProperties != nil { - objectMap["properties"] = sm.SapMonitorProperties - } - if sm.Location != nil { - objectMap["location"] = sm.Location + if r.Tags != nil { + objectMap["tags"] = r.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for SapMonitor struct. -func (sm *SapMonitor) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var sapMonitorProperties SapMonitorProperties - err = json.Unmarshal(*v, &sapMonitorProperties) - if err != nil { - return err - } - sm.SapMonitorProperties = &sapMonitorProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sm.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sm.Tags = tags - } - } - } - - return nil -} - -// SapMonitorListResult the response from the List SAP monitors operation. -type SapMonitorListResult struct { - autorest.Response `json:"-"` - // Value - The list of SAP monitors. - Value *[]SapMonitor `json:"value,omitempty"` - // NextLink - The URL to get the next set of SAP monitors. - NextLink *string `json:"nextLink,omitempty"` -} - -// SapMonitorListResultIterator provides access to a complete listing of SapMonitor values. -type SapMonitorListResultIterator struct { - i int - page SapMonitorListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SapMonitorListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SapMonitorListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SapMonitorListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SapMonitorListResultIterator) Response() SapMonitorListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SapMonitorListResultIterator) Value() SapMonitor { - if !iter.page.NotDone() { - return SapMonitor{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SapMonitorListResultIterator type. -func NewSapMonitorListResultIterator(page SapMonitorListResultPage) SapMonitorListResultIterator { - return SapMonitorListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (smlr SapMonitorListResult) IsEmpty() bool { - return smlr.Value == nil || len(*smlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (smlr SapMonitorListResult) hasNextLink() bool { - return smlr.NextLink != nil && len(*smlr.NextLink) != 0 -} - -// sapMonitorListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (smlr SapMonitorListResult) sapMonitorListResultPreparer(ctx context.Context) (*http.Request, error) { - if !smlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(smlr.NextLink))) -} - -// SapMonitorListResultPage contains a page of SapMonitor values. -type SapMonitorListResultPage struct { - fn func(context.Context, SapMonitorListResult) (SapMonitorListResult, error) - smlr SapMonitorListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SapMonitorListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.smlr) - if err != nil { - return err - } - page.smlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SapMonitorListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SapMonitorListResultPage) NotDone() bool { - return !page.smlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SapMonitorListResultPage) Response() SapMonitorListResult { - return page.smlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SapMonitorListResultPage) Values() []SapMonitor { - if page.smlr.IsEmpty() { - return nil - } - return *page.smlr.Value -} - -// Creates a new instance of the SapMonitorListResultPage type. -func NewSapMonitorListResultPage(cur SapMonitorListResult, getNextPage func(context.Context, SapMonitorListResult) (SapMonitorListResult, error)) SapMonitorListResultPage { - return SapMonitorListResultPage{ - fn: getNextPage, - smlr: cur, - } -} - -// SapMonitorProperties describes the properties of a SAP monitor. -type SapMonitorProperties struct { - // HanaSubnet - Specifies the SAP monitor unique ID. - HanaSubnet *string `json:"hanaSubnet,omitempty"` - // HanaHostname - Hostname of the HANA instance. - HanaHostname *string `json:"hanaHostname,omitempty"` - // HanaDbName - Database name of the HANA instance. - HanaDbName *string `json:"hanaDbName,omitempty"` - // HanaDbSQLPort - Database port of the HANA instance. - HanaDbSQLPort *int32 `json:"hanaDbSqlPort,omitempty"` - // HanaDbUsername - Database username of the HANA instance. - HanaDbUsername *string `json:"hanaDbUsername,omitempty"` - // HanaDbPassword - Database password of the HANA instance. - HanaDbPassword *string `json:"hanaDbPassword,omitempty"` - // HanaDbPasswordKeyVaultURL - KeyVault URL link to the password for the HANA database. - HanaDbPasswordKeyVaultURL *string `json:"hanaDbPasswordKeyVaultUrl,omitempty"` - // HanaDbCredentialsMsiID - MSI ID passed by customer which has access to customer's KeyVault and to be assigned to the Collector VM. - HanaDbCredentialsMsiID *string `json:"hanaDbCredentialsMsiId,omitempty"` - // KeyVaultID - Key Vault ID containing customer's HANA credentials. - KeyVaultID *string `json:"keyVaultId,omitempty"` - // ProvisioningState - READ-ONLY; State of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating' - ProvisioningState HanaProvisioningStatesEnum `json:"provisioningState,omitempty"` - // ManagedResourceGroupName - READ-ONLY; The name of the resource group the SAP Monitor resources get deployed into. - ManagedResourceGroupName *string `json:"managedResourceGroupName,omitempty"` - // LogAnalyticsWorkspaceArmID - The ARM ID of the Log Analytics Workspace that is used for monitoring - LogAnalyticsWorkspaceArmID *string `json:"logAnalyticsWorkspaceArmId,omitempty"` - // EnableCustomerAnalytics - The value indicating whether to send analytics to Microsoft - EnableCustomerAnalytics *bool `json:"enableCustomerAnalytics,omitempty"` - // LogAnalyticsWorkspaceID - The workspace ID of the log analytics workspace to be used for monitoring - LogAnalyticsWorkspaceID *string `json:"logAnalyticsWorkspaceId,omitempty"` - // LogAnalyticsWorkspaceSharedKey - The shared key of the log analytics workspace that is used for monitoring - LogAnalyticsWorkspaceSharedKey *string `json:"logAnalyticsWorkspaceSharedKey,omitempty"` -} - -// MarshalJSON is the custom marshaler for SapMonitorProperties. -func (smp SapMonitorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if smp.HanaSubnet != nil { - objectMap["hanaSubnet"] = smp.HanaSubnet - } - if smp.HanaHostname != nil { - objectMap["hanaHostname"] = smp.HanaHostname - } - if smp.HanaDbName != nil { - objectMap["hanaDbName"] = smp.HanaDbName - } - if smp.HanaDbSQLPort != nil { - objectMap["hanaDbSqlPort"] = smp.HanaDbSQLPort - } - if smp.HanaDbUsername != nil { - objectMap["hanaDbUsername"] = smp.HanaDbUsername - } - if smp.HanaDbPassword != nil { - objectMap["hanaDbPassword"] = smp.HanaDbPassword - } - if smp.HanaDbPasswordKeyVaultURL != nil { - objectMap["hanaDbPasswordKeyVaultUrl"] = smp.HanaDbPasswordKeyVaultURL - } - if smp.HanaDbCredentialsMsiID != nil { - objectMap["hanaDbCredentialsMsiId"] = smp.HanaDbCredentialsMsiID - } - if smp.KeyVaultID != nil { - objectMap["keyVaultId"] = smp.KeyVaultID - } - if smp.LogAnalyticsWorkspaceArmID != nil { - objectMap["logAnalyticsWorkspaceArmId"] = smp.LogAnalyticsWorkspaceArmID - } - if smp.EnableCustomerAnalytics != nil { - objectMap["enableCustomerAnalytics"] = smp.EnableCustomerAnalytics - } - if smp.LogAnalyticsWorkspaceID != nil { - objectMap["logAnalyticsWorkspaceId"] = smp.LogAnalyticsWorkspaceID - } - if smp.LogAnalyticsWorkspaceSharedKey != nil { - objectMap["logAnalyticsWorkspaceSharedKey"] = smp.LogAnalyticsWorkspaceSharedKey - } - return json.Marshal(objectMap) -} - -// SapMonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SapMonitorsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SapMonitorsClient) (SapMonitor, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SapMonitorsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SapMonitorsCreateFuture.Result. -func (future *SapMonitorsCreateFuture) result(client SapMonitorsClient) (sm SapMonitor, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hanaonazure.SapMonitorsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.CreateResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// SapMonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SapMonitorsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SapMonitorsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SapMonitorsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SapMonitorsDeleteFuture.Result. -func (future *SapMonitorsDeleteFuture) result(client SapMonitorsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("hanaonazure.SapMonitorsDeleteFuture") - return - } - ar.Response = future.Response() - return +// SAPSystemID specifies information related to a SAP system ID +type SAPSystemID struct { + // Gid - Group ID of the HANA database user. + Gid *string `json:"gid,omitempty"` + // MemoryAllocation - Percent of memory to allocate to this SID. + MemoryAllocation *string `json:"memoryAllocation,omitempty"` + // Sid - SAP system ID as database identifier. + Sid *string `json:"sid,omitempty"` + // Username - Name of the HANA database user. + Username *string `json:"username,omitempty"` + // UID - User ID of the HANA database user. + UID *string `json:"uid,omitempty"` } // StorageProfile specifies the storage settings for the HANA instance disks. type StorageProfile struct { - // NfsIPAddress - READ-ONLY; IP Address to connect to storage. + // NfsIPAddress - IP Address to connect to storage. NfsIPAddress *string `json:"nfsIpAddress,omitempty"` // OsDisks - Specifies information about the operating system disk used by the hana instance. OsDisks *[]Disk `json:"osDisks,omitempty"` -} - -// MarshalJSON is the custom marshaler for StorageProfile. -func (sp StorageProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.OsDisks != nil { - objectMap["osDisks"] = sp.OsDisks - } - return json.Marshal(objectMap) + // HanaSids - Specifies information related to SAP system IDs for the hana instance. + HanaSids *[]SAPSystemID `json:"hanaSids,omitempty"` } // Tags tags field of the HANA instance. diff --git a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/sapmonitors.go b/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/sapmonitors.go deleted file mode 100644 index 0da2f9dcedcb..000000000000 --- a/services/preview/hanaonazure/mgmt/2017-11-03-preview/hanaonazure/sapmonitors.go +++ /dev/null @@ -1,458 +0,0 @@ -package hanaonazure - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SapMonitorsClient is the HANA on Azure Client -type SapMonitorsClient struct { - BaseClient -} - -// NewSapMonitorsClient creates an instance of the SapMonitorsClient client. -func NewSapMonitorsClient(subscriptionID string) SapMonitorsClient { - return NewSapMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSapMonitorsClientWithBaseURI creates an instance of the SapMonitorsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewSapMonitorsClientWithBaseURI(baseURI string, subscriptionID string) SapMonitorsClient { - return SapMonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a SAP monitor for the specified subscription, resource group, and resource name. -// Parameters: -// resourceGroupName - name of the resource group. -// sapMonitorName - name of the SAP monitor resource. -// sapMonitorParameter - request body representing a SAP Monitor -func (client SapMonitorsClient) Create(ctx context.Context, resourceGroupName string, sapMonitorName string, sapMonitorParameter SapMonitor) (result SapMonitorsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreatePreparer(ctx, resourceGroupName, sapMonitorName, sapMonitorParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Create", nil, "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SapMonitorsClient) CreatePreparer(ctx context.Context, resourceGroupName string, sapMonitorName string, sapMonitorParameter SapMonitor) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sapMonitorName": autorest.Encode("path", sapMonitorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-11-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/sapMonitors/{sapMonitorName}", pathParameters), - autorest.WithJSON(sapMonitorParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SapMonitorsClient) CreateSender(req *http.Request) (future SapMonitorsCreateFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SapMonitorsClient) CreateResponder(resp *http.Response) (result SapMonitor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a SAP monitor with the specified subscription, resource group, and monitor name. -// Parameters: -// resourceGroupName - name of the resource group. -// sapMonitorName - name of the SAP monitor resource. -func (client SapMonitorsClient) Delete(ctx context.Context, resourceGroupName string, sapMonitorName string) (result SapMonitorsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, sapMonitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Delete", nil, "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SapMonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, sapMonitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sapMonitorName": autorest.Encode("path", sapMonitorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-11-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/sapMonitors/{sapMonitorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SapMonitorsClient) DeleteSender(req *http.Request) (future SapMonitorsDeleteFuture, err error) { - var resp *http.Response - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SapMonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets properties of a SAP monitor for the specified subscription, resource group, and resource name. -// Parameters: -// resourceGroupName - name of the resource group. -// sapMonitorName - name of the SAP monitor resource. -func (client SapMonitorsClient) Get(ctx context.Context, resourceGroupName string, sapMonitorName string) (result SapMonitor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, resourceGroupName, sapMonitorName) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SapMonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, sapMonitorName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sapMonitorName": autorest.Encode("path", sapMonitorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-11-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/sapMonitors/{sapMonitorName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client SapMonitorsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client SapMonitorsClient) GetResponder(resp *http.Response) (result SapMonitor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of SAP monitors in the specified subscription. The operations returns various properties of each -// SAP monitor. -func (client SapMonitorsClient) List(ctx context.Context) (result SapMonitorListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorsClient.List") - defer func() { - sc := -1 - if result.smlr.Response.Response != nil { - sc = result.smlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.smlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "List", resp, "Failure sending request") - return - } - - result.smlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "List", resp, "Failure responding to request") - return - } - if result.smlr.hasNextLink() && result.smlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SapMonitorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-11-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.HanaOnAzure/sapMonitors", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SapMonitorsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SapMonitorsClient) ListResponder(resp *http.Response) (result SapMonitorListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client SapMonitorsClient) listNextResults(ctx context.Context, lastResults SapMonitorListResult) (result SapMonitorListResult, err error) { - req, err := lastResults.sapMonitorListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client SapMonitorsClient) ListComplete(ctx context.Context) (result SapMonitorListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// Update patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. -// Parameters: -// resourceGroupName - name of the resource group. -// sapMonitorName - name of the SAP monitor resource. -// tagsParameter - request body that only contains the new Tags field -func (client SapMonitorsClient) Update(ctx context.Context, resourceGroupName string, sapMonitorName string, tagsParameter Tags) (result SapMonitor, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SapMonitorsClient.Update") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, sapMonitorName, tagsParameter) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "hanaonazure.SapMonitorsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SapMonitorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, sapMonitorName string, tagsParameter Tags) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "sapMonitorName": autorest.Encode("path", sapMonitorName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2017-11-03-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/sapMonitors/{sapMonitorName}", pathParameters), - autorest.WithJSON(tagsParameter), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SapMonitorsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SapMonitorsClient) UpdateResponder(resp *http.Response) (result SapMonitor, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -}