From 469947db10c787edca007185fb66af085ccdd40e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 8 Jun 2022 00:26:06 +0000 Subject: [PATCH] CodeGen from PR 19358 in Azure/azure-rest-api-specs Merge c6b1fdbfe471fb196c0463462f5ab8b119de53c3 into ad5110c7ba2113d5f77946338231f45ac4d09c82 --- .../2021-09-01-preview/dynatrace/CHANGELOG.md | 2 + .../2021-09-01-preview/dynatrace/_meta.json | 11 + .../2021-09-01-preview/dynatrace/client.go | 41 + .../dynatrace/dynatraceapi/interfaces.go | 67 + .../2021-09-01-preview/dynatrace/enums.go | 372 +++ .../2021-09-01-preview/dynatrace/models.go | 2363 +++++++++++++++++ .../2021-09-01-preview/dynatrace/monitors.go | 1407 ++++++++++ .../dynatrace/operations.go | 140 + .../dynatrace/singlesignon.go | 342 +++ .../2021-09-01-preview/dynatrace/tagrules.go | 521 ++++ .../2021-09-01-preview/dynatrace/version.go | 19 + 11 files changed, 5285 insertions(+) create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/CHANGELOG.md create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/_meta.json create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/client.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/dynatraceapi/interfaces.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/enums.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/models.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/monitors.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/operations.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/singlesignon.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/tagrules.go create mode 100644 services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/version.go diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/CHANGELOG.md b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/_meta.json b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/_meta.json new file mode 100644 index 000000000000..d54a1befee9b --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "05a0544f03a42dcecfd4785982a57094fd40ee9c", + "readme": "/_/azure-rest-api-specs/specification/dynatrace/resource-manager/readme.md", + "tag": "package-2021-09-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-09-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/dynatrace/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/client.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/client.go new file mode 100644 index 000000000000..ee901bda02f4 --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/client.go @@ -0,0 +1,41 @@ +// Package dynatrace implements the Azure ARM Dynatrace service API version 2021-09-01-preview. +// +// +package dynatrace + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Dynatrace + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Dynatrace. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/dynatraceapi/interfaces.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/dynatraceapi/interfaces.go new file mode 100644 index 000000000000..fb9b919fec91 --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/dynatraceapi/interfaces.go @@ -0,0 +1,67 @@ +package dynatraceapi + +// 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/azure-sdk-for-go/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace" +) + +// MonitorsClientAPI contains the set of methods on the MonitorsClient type. +type MonitorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, resource dynatrace.MonitorResource) (result dynatrace.MonitorsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.MonitorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.MonitorResource, err error) + GetAccountCredentials(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.AccountInfoSecure, err error) + GetSSODetails(ctx context.Context, resourceGroupName string, monitorName string, request *dynatrace.SSODetailsRequest) (result dynatrace.SSODetailsResponse, err error) + GetVMHostPayload(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.VMExtensionPayload, err error) + ListAppServices(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.AppServiceListResponsePage, err error) + ListAppServicesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.AppServiceListResponseIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result dynatrace.MonitorResourceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result dynatrace.MonitorResourceListResultIterator, err error) + ListBySubscriptionID(ctx context.Context) (result dynatrace.MonitorResourceListResultPage, err error) + ListBySubscriptionIDComplete(ctx context.Context) (result dynatrace.MonitorResourceListResultIterator, err error) + ListHosts(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.VMHostsListResponsePage, err error) + ListHostsComplete(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.VMHostsListResponseIterator, err error) + ListLinkableEnvironments(ctx context.Context, resourceGroupName string, monitorName string, request dynatrace.LinkableEnvironmentRequest) (result dynatrace.LinkableEnvironmentListResponsePage, err error) + ListLinkableEnvironmentsComplete(ctx context.Context, resourceGroupName string, monitorName string, request dynatrace.LinkableEnvironmentRequest) (result dynatrace.LinkableEnvironmentListResponseIterator, err error) + ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.MonitoredResourceListResponsePage, err error) + ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.MonitoredResourceListResponseIterator, err error) + Update(ctx context.Context, resourceGroupName string, monitorName string, resource dynatrace.MonitorResourceUpdate) (result dynatrace.MonitorResource, err error) +} + +var _ MonitorsClientAPI = (*dynatrace.MonitorsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result dynatrace.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result dynatrace.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*dynatrace.OperationsClient)(nil) + +// TagRulesClientAPI contains the set of methods on the TagRulesClient type. +type TagRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource dynatrace.TagRule) (result dynatrace.TagRulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result dynatrace.TagRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result dynatrace.TagRule, err error) + List(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.TagRuleListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.TagRuleListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource dynatrace.TagRuleUpdate) (result dynatrace.TagRule, err error) +} + +var _ TagRulesClientAPI = (*dynatrace.TagRulesClient)(nil) + +// SingleSignOnClientAPI contains the set of methods on the SingleSignOnClient type. +type SingleSignOnClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, resource dynatrace.SingleSignOnResource) (result dynatrace.SingleSignOnCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (result dynatrace.SingleSignOnResource, err error) + List(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.SingleSignOnResourceListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result dynatrace.SingleSignOnResourceListResultIterator, err error) +} + +var _ SingleSignOnClientAPI = (*dynatrace.SingleSignOnClient)(nil) diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/enums.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/enums.go new file mode 100644 index 000000000000..ed54c08361c5 --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/enums.go @@ -0,0 +1,372 @@ +package dynatrace + +// 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. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // Internal ... + Internal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{Internal} +} + +// AutoUpdateSetting enumerates the values for auto update setting. +type AutoUpdateSetting string + +const ( + // DISABLED ... + DISABLED AutoUpdateSetting = "DISABLED" + // ENABLED ... + ENABLED AutoUpdateSetting = "ENABLED" +) + +// PossibleAutoUpdateSettingValues returns an array of possible values for the AutoUpdateSetting const type. +func PossibleAutoUpdateSettingValues() []AutoUpdateSetting { + return []AutoUpdateSetting{DISABLED, ENABLED} +} + +// AvailabilityState enumerates the values for availability state. +type AvailabilityState string + +const ( + // CRASHED ... + CRASHED AvailabilityState = "CRASHED" + // LOST ... + LOST AvailabilityState = "LOST" + // MONITORED ... + MONITORED AvailabilityState = "MONITORED" + // PREMONITORED ... + PREMONITORED AvailabilityState = "PRE_MONITORED" + // SHUTDOWN ... + SHUTDOWN AvailabilityState = "SHUTDOWN" + // UNEXPECTEDSHUTDOWN ... + UNEXPECTEDSHUTDOWN AvailabilityState = "UNEXPECTED_SHUTDOWN" + // UNKNOWN ... + UNKNOWN AvailabilityState = "UNKNOWN" + // UNMONITORED ... + UNMONITORED AvailabilityState = "UNMONITORED" +) + +// PossibleAvailabilityStateValues returns an array of possible values for the AvailabilityState const type. +func PossibleAvailabilityStateValues() []AvailabilityState { + return []AvailabilityState{CRASHED, LOST, MONITORED, PREMONITORED, SHUTDOWN, UNEXPECTEDSHUTDOWN, UNKNOWN, UNMONITORED} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// LiftrResourceCategories enumerates the values for liftr resource categories. +type LiftrResourceCategories string + +const ( + // MonitorLogs ... + MonitorLogs LiftrResourceCategories = "MonitorLogs" + // Unknown ... + Unknown LiftrResourceCategories = "Unknown" +) + +// PossibleLiftrResourceCategoriesValues returns an array of possible values for the LiftrResourceCategories const type. +func PossibleLiftrResourceCategoriesValues() []LiftrResourceCategories { + return []LiftrResourceCategories{MonitorLogs, Unknown} +} + +// LogModule enumerates the values for log module. +type LogModule string + +const ( + // LogModuleDISABLED ... + LogModuleDISABLED LogModule = "DISABLED" + // LogModuleENABLED ... + LogModuleENABLED LogModule = "ENABLED" +) + +// PossibleLogModuleValues returns an array of possible values for the LogModule const type. +func PossibleLogModuleValues() []LogModule { + return []LogModule{LogModuleDISABLED, LogModuleENABLED} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // SystemAndUserAssigned ... + SystemAndUserAssigned ManagedIdentityType = "SystemAndUserAssigned" + // SystemAssigned ... + SystemAssigned ManagedIdentityType = "SystemAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{SystemAndUserAssigned, SystemAssigned, UserAssigned} +} + +// MarketplaceSubscriptionStatus enumerates the values for marketplace subscription status. +type MarketplaceSubscriptionStatus string + +const ( + // Active ... + Active MarketplaceSubscriptionStatus = "Active" + // Suspended ... + Suspended MarketplaceSubscriptionStatus = "Suspended" +) + +// PossibleMarketplaceSubscriptionStatusValues returns an array of possible values for the MarketplaceSubscriptionStatus const type. +func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStatus { + return []MarketplaceSubscriptionStatus{Active, Suspended} +} + +// MonitoringStatus enumerates the values for monitoring status. +type MonitoringStatus string + +const ( + // Disabled ... + Disabled MonitoringStatus = "Disabled" + // Enabled ... + Enabled MonitoringStatus = "Enabled" +) + +// PossibleMonitoringStatusValues returns an array of possible values for the MonitoringStatus const type. +func PossibleMonitoringStatusValues() []MonitoringStatus { + return []MonitoringStatus{Disabled, Enabled} +} + +// MonitoringType enumerates the values for monitoring type. +type MonitoringType string + +const ( + // CLOUDINFRASTRUCTURE ... + CLOUDINFRASTRUCTURE MonitoringType = "CLOUD_INFRASTRUCTURE" + // FULLSTACK ... + FULLSTACK MonitoringType = "FULL_STACK" +) + +// PossibleMonitoringTypeValues returns an array of possible values for the MonitoringType const type. +func PossibleMonitoringTypeValues() []MonitoringType { + return []MonitoringType{CLOUDINFRASTRUCTURE, FULLSTACK} +} + +// Origin enumerates the values for origin. +type Origin string + +const ( + // OriginSystem ... + OriginSystem Origin = "system" + // OriginUser ... + OriginUser Origin = "user" + // OriginUsersystem ... + OriginUsersystem Origin = "user,system" +) + +// PossibleOriginValues returns an array of possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{OriginSystem, OriginUser, OriginUsersystem} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Accepted ... + Accepted ProvisioningState = "Accepted" + // Canceled ... + Canceled ProvisioningState = "Canceled" + // Creating ... + Creating ProvisioningState = "Creating" + // Deleted ... + Deleted ProvisioningState = "Deleted" + // Deleting ... + Deleting ProvisioningState = "Deleting" + // Failed ... + Failed ProvisioningState = "Failed" + // NotSpecified ... + NotSpecified ProvisioningState = "NotSpecified" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" + // Updating ... + Updating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{Accepted, Canceled, Creating, Deleted, Deleting, Failed, NotSpecified, Succeeded, Updating} +} + +// SendAadLogsStatus enumerates the values for send aad logs status. +type SendAadLogsStatus string + +const ( + // SendAadLogsStatusDisabled ... + SendAadLogsStatusDisabled SendAadLogsStatus = "Disabled" + // SendAadLogsStatusEnabled ... + SendAadLogsStatusEnabled SendAadLogsStatus = "Enabled" +) + +// PossibleSendAadLogsStatusValues returns an array of possible values for the SendAadLogsStatus const type. +func PossibleSendAadLogsStatusValues() []SendAadLogsStatus { + return []SendAadLogsStatus{SendAadLogsStatusDisabled, SendAadLogsStatusEnabled} +} + +// SendActivityLogsStatus enumerates the values for send activity logs status. +type SendActivityLogsStatus string + +const ( + // SendActivityLogsStatusDisabled ... + SendActivityLogsStatusDisabled SendActivityLogsStatus = "Disabled" + // SendActivityLogsStatusEnabled ... + SendActivityLogsStatusEnabled SendActivityLogsStatus = "Enabled" +) + +// PossibleSendActivityLogsStatusValues returns an array of possible values for the SendActivityLogsStatus const type. +func PossibleSendActivityLogsStatusValues() []SendActivityLogsStatus { + return []SendActivityLogsStatus{SendActivityLogsStatusDisabled, SendActivityLogsStatusEnabled} +} + +// SendingLogsStatus enumerates the values for sending logs status. +type SendingLogsStatus string + +const ( + // SendingLogsStatusDisabled ... + SendingLogsStatusDisabled SendingLogsStatus = "Disabled" + // SendingLogsStatusEnabled ... + SendingLogsStatusEnabled SendingLogsStatus = "Enabled" +) + +// PossibleSendingLogsStatusValues returns an array of possible values for the SendingLogsStatus const type. +func PossibleSendingLogsStatusValues() []SendingLogsStatus { + return []SendingLogsStatus{SendingLogsStatusDisabled, SendingLogsStatusEnabled} +} + +// SendingMetricsStatus enumerates the values for sending metrics status. +type SendingMetricsStatus string + +const ( + // SendingMetricsStatusDisabled ... + SendingMetricsStatusDisabled SendingMetricsStatus = "Disabled" + // SendingMetricsStatusEnabled ... + SendingMetricsStatusEnabled SendingMetricsStatus = "Enabled" +) + +// PossibleSendingMetricsStatusValues returns an array of possible values for the SendingMetricsStatus const type. +func PossibleSendingMetricsStatusValues() []SendingMetricsStatus { + return []SendingMetricsStatus{SendingMetricsStatusDisabled, SendingMetricsStatusEnabled} +} + +// SendSubscriptionLogsStatus enumerates the values for send subscription logs status. +type SendSubscriptionLogsStatus string + +const ( + // SendSubscriptionLogsStatusDisabled ... + SendSubscriptionLogsStatusDisabled SendSubscriptionLogsStatus = "Disabled" + // SendSubscriptionLogsStatusEnabled ... + SendSubscriptionLogsStatusEnabled SendSubscriptionLogsStatus = "Enabled" +) + +// PossibleSendSubscriptionLogsStatusValues returns an array of possible values for the SendSubscriptionLogsStatus const type. +func PossibleSendSubscriptionLogsStatusValues() []SendSubscriptionLogsStatus { + return []SendSubscriptionLogsStatus{SendSubscriptionLogsStatusDisabled, SendSubscriptionLogsStatusEnabled} +} + +// SingleSignOnStates enumerates the values for single sign on states. +type SingleSignOnStates string + +const ( + // Disable ... + Disable SingleSignOnStates = "Disable" + // Enable ... + Enable SingleSignOnStates = "Enable" + // Existing ... + Existing SingleSignOnStates = "Existing" + // Initial ... + Initial SingleSignOnStates = "Initial" +) + +// PossibleSingleSignOnStatesValues returns an array of possible values for the SingleSignOnStates const type. +func PossibleSingleSignOnStatesValues() []SingleSignOnStates { + return []SingleSignOnStates{Disable, Enable, Existing, Initial} +} + +// SSOStatus enumerates the values for sso status. +type SSOStatus string + +const ( + // SSOStatusDisabled ... + SSOStatusDisabled SSOStatus = "Disabled" + // SSOStatusEnabled ... + SSOStatusEnabled SSOStatus = "Enabled" +) + +// PossibleSSOStatusValues returns an array of possible values for the SSOStatus const type. +func PossibleSSOStatusValues() []SSOStatus { + return []SSOStatus{SSOStatusDisabled, SSOStatusEnabled} +} + +// TagAction enumerates the values for tag action. +type TagAction string + +const ( + // Exclude ... + Exclude TagAction = "Exclude" + // Include ... + Include TagAction = "Include" +) + +// PossibleTagActionValues returns an array of possible values for the TagAction const type. +func PossibleTagActionValues() []TagAction { + return []TagAction{Exclude, Include} +} + +// UpdateStatus enumerates the values for update status. +type UpdateStatus string + +const ( + // UpdateStatusINCOMPATIBLE ... + UpdateStatusINCOMPATIBLE UpdateStatus = "INCOMPATIBLE" + // UpdateStatusOUTDATED ... + UpdateStatusOUTDATED UpdateStatus = "OUTDATED" + // UpdateStatusSCHEDULED ... + UpdateStatusSCHEDULED UpdateStatus = "SCHEDULED" + // UpdateStatusSUPPRESSED ... + UpdateStatusSUPPRESSED UpdateStatus = "SUPPRESSED" + // UpdateStatusUNKNOWN ... + UpdateStatusUNKNOWN UpdateStatus = "UNKNOWN" + // UpdateStatusUP2DATE ... + UpdateStatusUP2DATE UpdateStatus = "UP2DATE" + // UpdateStatusUPDATEINPROGRESS ... + UpdateStatusUPDATEINPROGRESS UpdateStatus = "UPDATE_IN_PROGRESS" + // UpdateStatusUPDATEPENDING ... + UpdateStatusUPDATEPENDING UpdateStatus = "UPDATE_PENDING" + // UpdateStatusUPDATEPROBLEM ... + UpdateStatusUPDATEPROBLEM UpdateStatus = "UPDATE_PROBLEM" +) + +// PossibleUpdateStatusValues returns an array of possible values for the UpdateStatus const type. +func PossibleUpdateStatusValues() []UpdateStatus { + return []UpdateStatus{UpdateStatusINCOMPATIBLE, UpdateStatusOUTDATED, UpdateStatusSCHEDULED, UpdateStatusSUPPRESSED, UpdateStatusUNKNOWN, UpdateStatusUP2DATE, UpdateStatusUPDATEINPROGRESS, UpdateStatusUPDATEPENDING, UpdateStatusUPDATEPROBLEM} +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/models.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/models.go new file mode 100644 index 000000000000..594291f010e2 --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/models.go @@ -0,0 +1,2363 @@ +package dynatrace + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace" + +// AccountInfo dynatrace Account Information +type AccountInfo struct { + // AccountID - Account Id of the account this environment is linked to + AccountID *string `json:"accountId,omitempty"` + // RegionID - Region in which the account is created + RegionID *string `json:"regionId,omitempty"` +} + +// AccountInfoSecure dynatrace account API Key +type AccountInfoSecure struct { + autorest.Response `json:"-"` + // AccountID - READ-ONLY; Account Id of the account this environment is linked to + AccountID *string `json:"accountId,omitempty"` + // APIKey - READ-ONLY; API Key of the user account + APIKey *string `json:"apiKey,omitempty"` + // RegionID - READ-ONLY; Region in which the account is created + RegionID *string `json:"regionId,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccountInfoSecure. +func (ais AccountInfoSecure) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppServiceInfo details of App Services having Dynatrace OneAgent installed +type AppServiceInfo struct { + // ResourceID - App service resource ID + ResourceID *string `json:"resourceId,omitempty"` + // Version - Version of the Dynatrace agent installed on the App Service. + Version *string `json:"version,omitempty"` + // MonitoringType - The monitoring mode of OneAgent. Possible values include: 'CLOUDINFRASTRUCTURE', 'FULLSTACK' + MonitoringType MonitoringType `json:"monitoringType,omitempty"` + // AutoUpdateSetting - Update settings of OneAgent. Possible values include: 'ENABLED', 'DISABLED' + AutoUpdateSetting AutoUpdateSetting `json:"autoUpdateSetting,omitempty"` + // UpdateStatus - The current update status of OneAgent. Possible values include: 'UpdateStatusINCOMPATIBLE', 'UpdateStatusOUTDATED', 'UpdateStatusSCHEDULED', 'UpdateStatusSUPPRESSED', 'UpdateStatusUNKNOWN', 'UpdateStatusUP2DATE', 'UpdateStatusUPDATEINPROGRESS', 'UpdateStatusUPDATEPENDING', 'UpdateStatusUPDATEPROBLEM' + UpdateStatus UpdateStatus `json:"updateStatus,omitempty"` + // AvailabilityState - The availability state of OneAgent. Possible values include: 'CRASHED', 'LOST', 'MONITORED', 'PREMONITORED', 'SHUTDOWN', 'UNEXPECTEDSHUTDOWN', 'UNKNOWN', 'UNMONITORED' + AvailabilityState AvailabilityState `json:"availabilityState,omitempty"` + // LogModule - Tells whether log modules are enabled or not. Possible values include: 'LogModuleENABLED', 'LogModuleDISABLED' + LogModule LogModule `json:"logModule,omitempty"` + // HostGroup - The name of the host group + HostGroup *string `json:"hostGroup,omitempty"` + // HostName - The name of the host + HostName *string `json:"hostName,omitempty"` +} + +// AppServiceListResponse response of a list App Services Operation. +type AppServiceListResponse struct { + autorest.Response `json:"-"` + // Value - The items on this page + Value *[]AppServiceInfo `json:"value,omitempty"` + // NextLink - The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` +} + +// AppServiceListResponseIterator provides access to a complete listing of AppServiceInfo values. +type AppServiceListResponseIterator struct { + i int + page AppServiceListResponsePage +} + +// 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 *AppServiceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceListResponseIterator.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 *AppServiceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppServiceListResponseIterator) 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 AppServiceListResponseIterator) Response() AppServiceListResponse { + 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 AppServiceListResponseIterator) Value() AppServiceInfo { + if !iter.page.NotDone() { + return AppServiceInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppServiceListResponseIterator type. +func NewAppServiceListResponseIterator(page AppServiceListResponsePage) AppServiceListResponseIterator { + return AppServiceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aslr AppServiceListResponse) IsEmpty() bool { + return aslr.Value == nil || len(*aslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aslr AppServiceListResponse) hasNextLink() bool { + return aslr.NextLink != nil && len(*aslr.NextLink) != 0 +} + +// appServiceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aslr AppServiceListResponse) appServiceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !aslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aslr.NextLink))) +} + +// AppServiceListResponsePage contains a page of AppServiceInfo values. +type AppServiceListResponsePage struct { + fn func(context.Context, AppServiceListResponse) (AppServiceListResponse, error) + aslr AppServiceListResponse +} + +// 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 *AppServiceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppServiceListResponsePage.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.aslr) + if err != nil { + return err + } + page.aslr = 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 *AppServiceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppServiceListResponsePage) NotDone() bool { + return !page.aslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppServiceListResponsePage) Response() AppServiceListResponse { + return page.aslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppServiceListResponsePage) Values() []AppServiceInfo { + if page.aslr.IsEmpty() { + return nil + } + return *page.aslr.Value +} + +// Creates a new instance of the AppServiceListResponsePage type. +func NewAppServiceListResponsePage(cur AppServiceListResponse, getNextPage func(context.Context, AppServiceListResponse) (AppServiceListResponse, error)) AppServiceListResponsePage { + return AppServiceListResponsePage{ + fn: getNextPage, + aslr: cur, + } +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EnvironmentInfo dynatrace Environment Information +type EnvironmentInfo struct { + // EnvironmentID - Id of the environment created + EnvironmentID *string `json:"environmentId,omitempty"` + // IngestionKey - Ingestion key of the environment + IngestionKey *string `json:"ingestionKey,omitempty"` + // LogsIngestionEndpoint - Ingestion endpoint used for sending logs + LogsIngestionEndpoint *string `json:"logsIngestionEndpoint,omitempty"` + // LandingURL - Landing URL for Dynatrace environment + LandingURL *string `json:"landingURL,omitempty"` +} + +// EnvironmentProperties properties of the Dynatrace environment. +type EnvironmentProperties struct { + // UserID - User id + UserID *string `json:"userId,omitempty"` + // AccountInfo - Dynatrace Account Information + AccountInfo *AccountInfo `json:"accountInfo,omitempty"` + // EnvironmentInfo - Dynatrace Environment Information + EnvironmentInfo *EnvironmentInfo `json:"environmentInfo,omitempty"` + // SingleSignOnProperties - The details of a Dynatrace single sign-on. + SingleSignOnProperties *SingleSignOnProperties `json:"singleSignOnProperties,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// FilteringTag the definition of a filtering tag. Filtering tags are used for capturing resources and +// include/exclude them from being monitored. +type FilteringTag struct { + // Name - The name (also known as the key) of the tag. + Name *string `json:"name,omitempty"` + // Value - The value of the tag. + Value *string `json:"value,omitempty"` + // Action - Valid actions for a filtering tag. Exclusion takes priority over inclusion. Possible values include: 'Include', 'Exclude' + Action TagAction `json:"action,omitempty"` +} + +// IdentityProperties the properties of the managed service identities assigned to this resource. +type IdentityProperties struct { + // TenantID - READ-ONLY; The Active Directory tenant id of the principal. + TenantID *string `json:"tenantId,omitempty"` + // PrincipalID - READ-ONLY; The active directory identifier of this principal. + PrincipalID *string `json:"principalId,omitempty"` + // Type - The type of managed identity assigned to this resource. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAndUserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for IdentityProperties. +func (IP IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.Type != "" { + objectMap["type"] = IP.Type + } + if IP.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// LinkableEnvironmentListResponse response for getting all the linkable environments +type LinkableEnvironmentListResponse struct { + autorest.Response `json:"-"` + // Value - List of environments for which user is an admin + Value *[]LinkableEnvironmentResponse `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// LinkableEnvironmentListResponseIterator provides access to a complete listing of +// LinkableEnvironmentResponse values. +type LinkableEnvironmentListResponseIterator struct { + i int + page LinkableEnvironmentListResponsePage +} + +// 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 *LinkableEnvironmentListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkableEnvironmentListResponseIterator.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 *LinkableEnvironmentListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LinkableEnvironmentListResponseIterator) 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 LinkableEnvironmentListResponseIterator) Response() LinkableEnvironmentListResponse { + 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 LinkableEnvironmentListResponseIterator) Value() LinkableEnvironmentResponse { + if !iter.page.NotDone() { + return LinkableEnvironmentResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LinkableEnvironmentListResponseIterator type. +func NewLinkableEnvironmentListResponseIterator(page LinkableEnvironmentListResponsePage) LinkableEnvironmentListResponseIterator { + return LinkableEnvironmentListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lelr LinkableEnvironmentListResponse) IsEmpty() bool { + return lelr.Value == nil || len(*lelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lelr LinkableEnvironmentListResponse) hasNextLink() bool { + return lelr.NextLink != nil && len(*lelr.NextLink) != 0 +} + +// linkableEnvironmentListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lelr LinkableEnvironmentListResponse) linkableEnvironmentListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !lelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lelr.NextLink))) +} + +// LinkableEnvironmentListResponsePage contains a page of LinkableEnvironmentResponse values. +type LinkableEnvironmentListResponsePage struct { + fn func(context.Context, LinkableEnvironmentListResponse) (LinkableEnvironmentListResponse, error) + lelr LinkableEnvironmentListResponse +} + +// 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 *LinkableEnvironmentListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkableEnvironmentListResponsePage.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.lelr) + if err != nil { + return err + } + page.lelr = 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 *LinkableEnvironmentListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LinkableEnvironmentListResponsePage) NotDone() bool { + return !page.lelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LinkableEnvironmentListResponsePage) Response() LinkableEnvironmentListResponse { + return page.lelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LinkableEnvironmentListResponsePage) Values() []LinkableEnvironmentResponse { + if page.lelr.IsEmpty() { + return nil + } + return *page.lelr.Value +} + +// Creates a new instance of the LinkableEnvironmentListResponsePage type. +func NewLinkableEnvironmentListResponsePage(cur LinkableEnvironmentListResponse, getNextPage func(context.Context, LinkableEnvironmentListResponse) (LinkableEnvironmentListResponse, error)) LinkableEnvironmentListResponsePage { + return LinkableEnvironmentListResponsePage{ + fn: getNextPage, + lelr: cur, + } +} + +// LinkableEnvironmentRequest request for getting all the linkable environments for a user +type LinkableEnvironmentRequest struct { + // TenantID - Tenant Id of the user in which they want to link the environment + TenantID *string `json:"tenantId,omitempty"` + // UserPrincipal - user principal id of the user + UserPrincipal *string `json:"userPrincipal,omitempty"` + // Region - Azure region in which we want to link the environment + Region *string `json:"region,omitempty"` +} + +// LinkableEnvironmentResponse response for getting all the linkable environments +type LinkableEnvironmentResponse struct { + // EnvironmentID - environment id for which user is an admin + EnvironmentID *string `json:"environmentId,omitempty"` + // EnvironmentName - Name of the environment + EnvironmentName *string `json:"environmentName,omitempty"` + // PlanData - Billing plan information. + PlanData *PlanData `json:"planData,omitempty"` +} + +// LogRules set of rules for sending logs for the Monitor resource. +type LogRules struct { + // SendAadLogs - Flag specifying if AAD logs should be sent for the Monitor resource. Possible values include: 'SendAadLogsStatusEnabled', 'SendAadLogsStatusDisabled' + SendAadLogs SendAadLogsStatus `json:"sendAadLogs,omitempty"` + // SendSubscriptionLogs - Flag specifying if subscription logs should be sent for the Monitor resource. Possible values include: 'SendSubscriptionLogsStatusEnabled', 'SendSubscriptionLogsStatusDisabled' + SendSubscriptionLogs SendSubscriptionLogsStatus `json:"sendSubscriptionLogs,omitempty"` + // SendActivityLogs - Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. Possible values include: 'SendActivityLogsStatusEnabled', 'SendActivityLogsStatusDisabled' + SendActivityLogs SendActivityLogsStatus `json:"sendActivityLogs,omitempty"` + // FilteringTags - List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. + // If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` +} + +// MetricRules set of rules for sending metrics for the Monitor resource. +type MetricRules struct { + // FilteringTags - List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` +} + +// MonitoredResource details of resource being monitored by Dynatrace monitor resource +type MonitoredResource struct { + // ID - The ARM id of the resource. + ID *string `json:"id,omitempty"` + // SendingMetrics - Flag indicating if resource is sending metrics to Dynatrace. Possible values include: 'SendingMetricsStatusEnabled', 'SendingMetricsStatusDisabled' + SendingMetrics SendingMetricsStatus `json:"sendingMetrics,omitempty"` + // ReasonForMetricsStatus - Reason for why the resource is sending metrics (or why it is not sending). + ReasonForMetricsStatus *string `json:"reasonForMetricsStatus,omitempty"` + // SendingLogs - Flag indicating if resource is sending logs to Dynatrace. Possible values include: 'SendingLogsStatusEnabled', 'SendingLogsStatusDisabled' + SendingLogs SendingLogsStatus `json:"sendingLogs,omitempty"` + // ReasonForLogsStatus - Reason for why the resource is sending logs (or why it is not sending). + ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` +} + +// MonitoredResourceListResponse list of all the resources being monitored by Dynatrace monitor resource +type MonitoredResourceListResponse struct { + autorest.Response `json:"-"` + // Value - The items on this page + Value *[]MonitoredResource `json:"value,omitempty"` + // NextLink - The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoredResourceListResponseIterator provides access to a complete listing of MonitoredResource values. +type MonitoredResourceListResponseIterator struct { + i int + page MonitoredResourceListResponsePage +} + +// 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 *MonitoredResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponseIterator.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 *MonitoredResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoredResourceListResponseIterator) 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 MonitoredResourceListResponseIterator) Response() MonitoredResourceListResponse { + 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 MonitoredResourceListResponseIterator) Value() MonitoredResource { + if !iter.page.NotDone() { + return MonitoredResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoredResourceListResponseIterator type. +func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { + return MonitoredResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitoredResourceListResponse) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitoredResourceListResponse) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitoredResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitoredResourceListResponse) monitoredResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MonitoredResourceListResponsePage contains a page of MonitoredResource values. +type MonitoredResourceListResponsePage struct { + fn func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error) + mrlr MonitoredResourceListResponse +} + +// 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 *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponsePage.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.mrlr) + if err != nil { + return err + } + page.mrlr = 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 *MonitoredResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoredResourceListResponsePage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoredResourceListResponsePage) Response() MonitoredResourceListResponse { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoredResourceListResponsePage) Values() []MonitoredResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitoredResourceListResponsePage type. +func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { + return MonitoredResourceListResponsePage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitoringTagRulesProperties properties for the Tag rules resource of a Monitor account. +type MonitoringTagRulesProperties struct { + // LogRules - Set of rules for sending logs for the Monitor resource. + LogRules *LogRules `json:"logRules,omitempty"` + // MetricRules - Set of rules for sending metrics for the Monitor resource. + MetricRules *MetricRules `json:"metricRules,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringTagRulesProperties. +func (mtrp MonitoringTagRulesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mtrp.LogRules != nil { + objectMap["logRules"] = mtrp.LogRules + } + if mtrp.MetricRules != nil { + objectMap["metricRules"] = mtrp.MetricRules + } + return json.Marshal(objectMap) +} + +// MonitorProperties properties specific to the monitor resource. +type MonitorProperties struct { + // MonitoringStatus - Status of the monitor. Possible values include: 'Enabled', 'Disabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + // MarketplaceSubscriptionStatus - Marketplace subscription status. Possible values include: 'Active', 'Suspended' + MarketplaceSubscriptionStatus MarketplaceSubscriptionStatus `json:"marketplaceSubscriptionStatus,omitempty"` + // DynatraceEnvironmentProperties - Properties of the Dynatrace environment. + DynatraceEnvironmentProperties *EnvironmentProperties `json:"dynatraceEnvironmentProperties,omitempty"` + // UserInfo - User info. + UserInfo *UserInfo `json:"userInfo,omitempty"` + // PlanData - Billing plan information. + PlanData *PlanData `json:"planData,omitempty"` + // LiftrResourceCategory - READ-ONLY; Liftr Resource category. Possible values include: 'Unknown', 'MonitorLogs' + LiftrResourceCategory LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` + // LiftrResourcePreference - READ-ONLY; The priority of the resource. + LiftrResourcePreference *int32 `json:"liftrResourcePreference,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorProperties. +func (mp MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.MonitoringStatus != "" { + objectMap["monitoringStatus"] = mp.MonitoringStatus + } + if mp.MarketplaceSubscriptionStatus != "" { + objectMap["marketplaceSubscriptionStatus"] = mp.MarketplaceSubscriptionStatus + } + if mp.DynatraceEnvironmentProperties != nil { + objectMap["dynatraceEnvironmentProperties"] = mp.DynatraceEnvironmentProperties + } + if mp.UserInfo != nil { + objectMap["userInfo"] = mp.UserInfo + } + if mp.PlanData != nil { + objectMap["planData"] = mp.PlanData + } + return json.Marshal(objectMap) +} + +// MonitorResource dynatrace Monitor Resource +type MonitorResource struct { + autorest.Response `json:"-"` + // MonitorProperties - The resource-specific properties for this resource. + *MonitorProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; System metadata for this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Identity - The managed service identities assigned to this resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorResource. +func (mr MonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mr.MonitorProperties != nil { + objectMap["properties"] = mr.MonitorProperties + } + if mr.Identity != nil { + objectMap["identity"] = mr.Identity + } + if mr.Tags != nil { + objectMap["tags"] = mr.Tags + } + if mr.Location != nil { + objectMap["location"] = mr.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MonitorResource struct. +func (mr *MonitorResource) 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 monitorProperties MonitorProperties + err = json.Unmarshal(*v, &monitorProperties) + if err != nil { + return err + } + mr.MonitorProperties = &monitorProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mr.SystemData = &systemData + } + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mr.Identity = &identity + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mr.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mr.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mr.Type = &typeVar + } + } + } + + return nil +} + +// MonitorResourceListResult the response of a MonitorResource list operation. +type MonitorResourceListResult struct { + autorest.Response `json:"-"` + // Value - The items on this page + Value *[]MonitorResource `json:"value,omitempty"` + // NextLink - The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitorResourceListResultIterator provides access to a complete listing of MonitorResource values. +type MonitorResourceListResultIterator struct { + i int + page MonitorResourceListResultPage +} + +// 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 *MonitorResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResultIterator.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 *MonitorResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitorResourceListResultIterator) 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 MonitorResourceListResultIterator) Response() MonitorResourceListResult { + 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 MonitorResourceListResultIterator) Value() MonitorResource { + if !iter.page.NotDone() { + return MonitorResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitorResourceListResultIterator type. +func NewMonitorResourceListResultIterator(page MonitorResourceListResultPage) MonitorResourceListResultIterator { + return MonitorResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitorResourceListResult) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitorResourceListResult) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitorResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitorResourceListResult) monitorResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MonitorResourceListResultPage contains a page of MonitorResource values. +type MonitorResourceListResultPage struct { + fn func(context.Context, MonitorResourceListResult) (MonitorResourceListResult, error) + mrlr MonitorResourceListResult +} + +// 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 *MonitorResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResultPage.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.mrlr) + if err != nil { + return err + } + page.mrlr = 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 *MonitorResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitorResourceListResultPage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitorResourceListResultPage) Response() MonitorResourceListResult { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitorResourceListResultPage) Values() []MonitorResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitorResourceListResultPage type. +func NewMonitorResourceListResultPage(cur MonitorResourceListResult, getNextPage func(context.Context, MonitorResourceListResult) (MonitorResourceListResult, error)) MonitorResourceListResultPage { + return MonitorResourceListResultPage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitorResourceUpdate the updatable properties of the MonitorResource. +type MonitorResourceUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // MonitoringStatus - Status of the monitor. Possible values include: 'Enabled', 'Disabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + // MarketplaceSubscriptionStatus - Marketplace subscription status. Possible values include: 'Active', 'Suspended' + MarketplaceSubscriptionStatus MarketplaceSubscriptionStatus `json:"marketplaceSubscriptionStatus,omitempty"` + // DynatraceEnvironmentProperties - Properties of the Dynatrace environment. + DynatraceEnvironmentProperties *EnvironmentProperties `json:"dynatraceEnvironmentProperties,omitempty"` + // UserInfo - User info. + UserInfo *UserInfo `json:"userInfo,omitempty"` + // PlanData - Billing plan information. + PlanData *PlanData `json:"planData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorResourceUpdate. +func (mru MonitorResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mru.Tags != nil { + objectMap["tags"] = mru.Tags + } + if mru.MonitoringStatus != "" { + objectMap["monitoringStatus"] = mru.MonitoringStatus + } + if mru.MarketplaceSubscriptionStatus != "" { + objectMap["marketplaceSubscriptionStatus"] = mru.MarketplaceSubscriptionStatus + } + if mru.DynatraceEnvironmentProperties != nil { + objectMap["dynatraceEnvironmentProperties"] = mru.DynatraceEnvironmentProperties + } + if mru.UserInfo != nil { + objectMap["userInfo"] = mru.UserInfo + } + if mru.PlanData != nil { + objectMap["planData"] = mru.PlanData + } + return json.Marshal(objectMap) +} + +// MonitorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (MonitorResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsCreateOrUpdateFuture) 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 MonitorsCreateOrUpdateFuture.Result. +func (future *MonitorsCreateOrUpdateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("dynatrace.MonitorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { + mr, err = client.CreateOrUpdateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsCreateOrUpdateFuture", "Result", mr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsDeleteFuture) 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 MonitorsDeleteFuture.Result. +func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("dynatrace.MonitorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Operation details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Name - READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + Name *string `json:"name,omitempty"` + // IsDataAction - READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Localized display information for this particular operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: 'OriginUser', 'OriginSystem', 'OriginUsersystem' + Origin Origin `json:"origin,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + +// OperationDisplay localized display information for this particular operation. +type OperationDisplay struct { + // Provider - READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult a list of REST API operations supported by an Azure Resource Provider. It contains +// an URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of operations supported by the resource provider + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// 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 *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.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 *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) 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 OperationListResultIterator) Response() OperationListResult { + 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 OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// 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 *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.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.olr) + if err != nil { + return err + } + page.olr = 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 *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PlanData billing plan information. +type PlanData struct { + // UsageType - different usage type like PAYG/COMMITTED. this could be enum + UsageType *string `json:"usageType,omitempty"` + // BillingCycle - different billing cycles like MONTHLY/WEEKLY. this could be enum + BillingCycle *string `json:"billingCycle,omitempty"` + // PlanDetails - plan id as published by Dynatrace + PlanDetails *string `json:"planDetails,omitempty"` + // EffectiveDate - date when plan was applied + EffectiveDate *date.Time `json:"effectiveDate,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SingleSignOnCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SingleSignOnCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SingleSignOnClient) (SingleSignOnResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SingleSignOnCreateOrUpdateFuture) 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 SingleSignOnCreateOrUpdateFuture.Result. +func (future *SingleSignOnCreateOrUpdateFuture) result(client SingleSignOnClient) (ssor SingleSignOnResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("dynatrace.SingleSignOnCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ssor.Response.Response, err = future.GetResult(sender); err == nil && ssor.Response.Response.StatusCode != http.StatusNoContent { + ssor, err = client.CreateOrUpdateResponder(ssor.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnCreateOrUpdateFuture", "Result", ssor.Response.Response, "Failure responding to request") + } + } + return +} + +// SingleSignOnProperties the details of a Dynatrace single sign-on. +type SingleSignOnProperties struct { + // SingleSignOnState - State of Single Sign On. Possible values include: 'Initial', 'Enable', 'Disable', 'Existing' + SingleSignOnState SingleSignOnStates `json:"singleSignOnState,omitempty"` + // EnterpriseAppID - Version of the Dynatrace agent installed on the VM. + EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` + // SingleSignOnURL - The login URL specific to this Dynatrace Environment + SingleSignOnURL *string `json:"singleSignOnUrl,omitempty"` + // AadDomains - array of Aad(azure active directory) domains + AadDomains *[]string `json:"aadDomains,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleSignOnProperties. +func (ssop SingleSignOnProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssop.SingleSignOnState != "" { + objectMap["singleSignOnState"] = ssop.SingleSignOnState + } + if ssop.EnterpriseAppID != nil { + objectMap["enterpriseAppId"] = ssop.EnterpriseAppID + } + if ssop.SingleSignOnURL != nil { + objectMap["singleSignOnUrl"] = ssop.SingleSignOnURL + } + if ssop.AadDomains != nil { + objectMap["aadDomains"] = ssop.AadDomains + } + return json.Marshal(objectMap) +} + +// SingleSignOnResource single sign-on configurations for a given monitor resource. +type SingleSignOnResource struct { + autorest.Response `json:"-"` + // SingleSignOnProperties - The resource-specific properties for this resource. + *SingleSignOnProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; System metadata for this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleSignOnResource. +func (ssor SingleSignOnResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssor.SingleSignOnProperties != nil { + objectMap["properties"] = ssor.SingleSignOnProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SingleSignOnResource struct. +func (ssor *SingleSignOnResource) 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 singleSignOnProperties SingleSignOnProperties + err = json.Unmarshal(*v, &singleSignOnProperties) + if err != nil { + return err + } + ssor.SingleSignOnProperties = &singleSignOnProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ssor.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssor.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssor.Type = &typeVar + } + } + } + + return nil +} + +// SingleSignOnResourceListResult the response of a DynatraceSingleSignOnResource list operation. +type SingleSignOnResourceListResult struct { + autorest.Response `json:"-"` + // Value - The items on this page + Value *[]SingleSignOnResource `json:"value,omitempty"` + // NextLink - The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` +} + +// SingleSignOnResourceListResultIterator provides access to a complete listing of SingleSignOnResource +// values. +type SingleSignOnResourceListResultIterator struct { + i int + page SingleSignOnResourceListResultPage +} + +// 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 *SingleSignOnResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResultIterator.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 *SingleSignOnResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SingleSignOnResourceListResultIterator) 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 SingleSignOnResourceListResultIterator) Response() SingleSignOnResourceListResult { + 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 SingleSignOnResourceListResultIterator) Value() SingleSignOnResource { + if !iter.page.NotDone() { + return SingleSignOnResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SingleSignOnResourceListResultIterator type. +func NewSingleSignOnResourceListResultIterator(page SingleSignOnResourceListResultPage) SingleSignOnResourceListResultIterator { + return SingleSignOnResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssorlr SingleSignOnResourceListResult) IsEmpty() bool { + return ssorlr.Value == nil || len(*ssorlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssorlr SingleSignOnResourceListResult) hasNextLink() bool { + return ssorlr.NextLink != nil && len(*ssorlr.NextLink) != 0 +} + +// singleSignOnResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssorlr SingleSignOnResourceListResult) singleSignOnResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ssorlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssorlr.NextLink))) +} + +// SingleSignOnResourceListResultPage contains a page of SingleSignOnResource values. +type SingleSignOnResourceListResultPage struct { + fn func(context.Context, SingleSignOnResourceListResult) (SingleSignOnResourceListResult, error) + ssorlr SingleSignOnResourceListResult +} + +// 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 *SingleSignOnResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResultPage.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.ssorlr) + if err != nil { + return err + } + page.ssorlr = 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 *SingleSignOnResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SingleSignOnResourceListResultPage) NotDone() bool { + return !page.ssorlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SingleSignOnResourceListResultPage) Response() SingleSignOnResourceListResult { + return page.ssorlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SingleSignOnResourceListResultPage) Values() []SingleSignOnResource { + if page.ssorlr.IsEmpty() { + return nil + } + return *page.ssorlr.Value +} + +// Creates a new instance of the SingleSignOnResourceListResultPage type. +func NewSingleSignOnResourceListResultPage(cur SingleSignOnResourceListResult, getNextPage func(context.Context, SingleSignOnResourceListResult) (SingleSignOnResourceListResult, error)) SingleSignOnResourceListResultPage { + return SingleSignOnResourceListResultPage{ + fn: getNextPage, + ssorlr: cur, + } +} + +// SSODetailsRequest request for getting sso details for a user +type SSODetailsRequest struct { + // UserPrincipal - user principal id of the user + UserPrincipal *string `json:"userPrincipal,omitempty"` +} + +// SSODetailsResponse SSO details from the Dynatrace partner +type SSODetailsResponse struct { + autorest.Response `json:"-"` + // IsSsoEnabled - Whether the SSO is enabled for this resource or not. Possible values include: 'SSOStatusEnabled', 'SSOStatusDisabled' + IsSsoEnabled SSOStatus `json:"isSsoEnabled,omitempty"` + // MetadataURL - URL for Azure AD metadata + MetadataURL *string `json:"metadataUrl,omitempty"` + // SingleSignOnURL - The login URL specific to this Dynatrace Environment + SingleSignOnURL *string `json:"singleSignOnUrl,omitempty"` + // AadDomains - array of Aad(azure active directory) domains + AadDomains *[]string `json:"aadDomains,omitempty"` + // AdminUsers - Array of admin user emails. + AdminUsers *[]string `json:"adminUsers,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagRule tag rules for a monitor resource +type TagRule struct { + autorest.Response `json:"-"` + // MonitoringTagRulesProperties - The resource-specific properties for this resource. + *MonitoringTagRulesProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; System metadata for this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TagRule. +func (tr TagRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.MonitoringTagRulesProperties != nil { + objectMap["properties"] = tr.MonitoringTagRulesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TagRule struct. +func (tr *TagRule) 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 monitoringTagRulesProperties MonitoringTagRulesProperties + err = json.Unmarshal(*v, &monitoringTagRulesProperties) + if err != nil { + return err + } + tr.MonitoringTagRulesProperties = &monitoringTagRulesProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tr.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tr.Type = &typeVar + } + } + } + + return nil +} + +// TagRuleListResult the response of a TagRule list operation. +type TagRuleListResult struct { + autorest.Response `json:"-"` + // Value - The items on this page + Value *[]TagRule `json:"value,omitempty"` + // NextLink - The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` +} + +// TagRuleListResultIterator provides access to a complete listing of TagRule values. +type TagRuleListResultIterator struct { + i int + page TagRuleListResultPage +} + +// 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 *TagRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRuleListResultIterator.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 *TagRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TagRuleListResultIterator) 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 TagRuleListResultIterator) Response() TagRuleListResult { + 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 TagRuleListResultIterator) Value() TagRule { + if !iter.page.NotDone() { + return TagRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TagRuleListResultIterator type. +func NewTagRuleListResultIterator(page TagRuleListResultPage) TagRuleListResultIterator { + return TagRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (trlr TagRuleListResult) IsEmpty() bool { + return trlr.Value == nil || len(*trlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (trlr TagRuleListResult) hasNextLink() bool { + return trlr.NextLink != nil && len(*trlr.NextLink) != 0 +} + +// tagRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (trlr TagRuleListResult) tagRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !trlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(trlr.NextLink))) +} + +// TagRuleListResultPage contains a page of TagRule values. +type TagRuleListResultPage struct { + fn func(context.Context, TagRuleListResult) (TagRuleListResult, error) + trlr TagRuleListResult +} + +// 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 *TagRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRuleListResultPage.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.trlr) + if err != nil { + return err + } + page.trlr = 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 *TagRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TagRuleListResultPage) NotDone() bool { + return !page.trlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TagRuleListResultPage) Response() TagRuleListResult { + return page.trlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TagRuleListResultPage) Values() []TagRule { + if page.trlr.IsEmpty() { + return nil + } + return *page.trlr.Value +} + +// Creates a new instance of the TagRuleListResultPage type. +func NewTagRuleListResultPage(cur TagRuleListResult, getNextPage func(context.Context, TagRuleListResult) (TagRuleListResult, error)) TagRuleListResultPage { + return TagRuleListResultPage{ + fn: getNextPage, + trlr: cur, + } +} + +// TagRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TagRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TagRulesClient) (TagRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TagRulesCreateOrUpdateFuture) 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 TagRulesCreateOrUpdateFuture.Result. +func (future *TagRulesCreateOrUpdateFuture) result(client TagRulesClient) (tr TagRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("dynatrace.TagRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.CreateOrUpdateResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesCreateOrUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// TagRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TagRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TagRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TagRulesDeleteFuture) 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 TagRulesDeleteFuture.Result. +func (future *TagRulesDeleteFuture) result(client TagRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("dynatrace.TagRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TagRuleUpdate the updatable properties of the TagRule. +type TagRuleUpdate struct { + // LogRules - Set of rules for sending logs for the Monitor resource. + LogRules *LogRules `json:"logRules,omitempty"` + // MetricRules - Set of rules for sending metrics for the Monitor resource. + MetricRules *MetricRules `json:"metricRules,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UserAssignedIdentity a managed identity assigned by the user. +type UserAssignedIdentity struct { + // ClientID - The active directory client identifier for this principal. + ClientID *string `json:"clientId,omitempty"` + // PrincipalID - The active directory identifier for this principal. + PrincipalID *string `json:"principalId,omitempty"` +} + +// UserInfo user info. +type UserInfo struct { + // FirstName - First Name of the user + FirstName *string `json:"firstName,omitempty"` + // LastName - Last Name of the user + LastName *string `json:"lastName,omitempty"` + // EmailAddress - Email of the user used by Dynatrace for contacting them if needed + EmailAddress *string `json:"emailAddress,omitempty"` + // PhoneNumber - Phone number of the user used by Dynatrace for contacting them if needed + PhoneNumber *string `json:"phoneNumber,omitempty"` + // Country - Country of the user + Country *string `json:"country,omitempty"` +} + +// VMExtensionPayload response of payload to be passed while installing VM agent. +type VMExtensionPayload struct { + autorest.Response `json:"-"` + // IngestionKey - Ingestion key of the environment + IngestionKey *string `json:"ingestionKey,omitempty"` + // EnvironmentID - Id of the environment created + EnvironmentID *string `json:"environmentId,omitempty"` +} + +// VMHostsListResponse response of a list VM Host Operation. +type VMHostsListResponse struct { + autorest.Response `json:"-"` + // Value - The items on this page + Value *[]VMInfo `json:"value,omitempty"` + // NextLink - The link to the next page of items + NextLink *string `json:"nextLink,omitempty"` +} + +// VMHostsListResponseIterator provides access to a complete listing of VMInfo values. +type VMHostsListResponseIterator struct { + i int + page VMHostsListResponsePage +} + +// 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 *VMHostsListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMHostsListResponseIterator.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 *VMHostsListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VMHostsListResponseIterator) 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 VMHostsListResponseIterator) Response() VMHostsListResponse { + 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 VMHostsListResponseIterator) Value() VMInfo { + if !iter.page.NotDone() { + return VMInfo{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VMHostsListResponseIterator type. +func NewVMHostsListResponseIterator(page VMHostsListResponsePage) VMHostsListResponseIterator { + return VMHostsListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vhlr VMHostsListResponse) IsEmpty() bool { + return vhlr.Value == nil || len(*vhlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vhlr VMHostsListResponse) hasNextLink() bool { + return vhlr.NextLink != nil && len(*vhlr.NextLink) != 0 +} + +// vMHostsListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vhlr VMHostsListResponse) vMHostsListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !vhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vhlr.NextLink))) +} + +// VMHostsListResponsePage contains a page of VMInfo values. +type VMHostsListResponsePage struct { + fn func(context.Context, VMHostsListResponse) (VMHostsListResponse, error) + vhlr VMHostsListResponse +} + +// 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 *VMHostsListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMHostsListResponsePage.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.vhlr) + if err != nil { + return err + } + page.vhlr = 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 *VMHostsListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VMHostsListResponsePage) NotDone() bool { + return !page.vhlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VMHostsListResponsePage) Response() VMHostsListResponse { + return page.vhlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VMHostsListResponsePage) Values() []VMInfo { + if page.vhlr.IsEmpty() { + return nil + } + return *page.vhlr.Value +} + +// Creates a new instance of the VMHostsListResponsePage type. +func NewVMHostsListResponsePage(cur VMHostsListResponse, getNextPage func(context.Context, VMHostsListResponse) (VMHostsListResponse, error)) VMHostsListResponsePage { + return VMHostsListResponsePage{ + fn: getNextPage, + vhlr: cur, + } +} + +// VMInfo details of VM Resource having Dynatrace OneAgent installed +type VMInfo struct { + // ResourceID - Azure VM resource ID + ResourceID *string `json:"resourceId,omitempty"` + // Version - Version of the Dynatrace agent installed on the VM. + Version *string `json:"version,omitempty"` + // MonitoringType - The monitoring mode of OneAgent. Possible values include: 'CLOUDINFRASTRUCTURE', 'FULLSTACK' + MonitoringType MonitoringType `json:"monitoringType,omitempty"` + // AutoUpdateSetting - Update settings of OneAgent. Possible values include: 'ENABLED', 'DISABLED' + AutoUpdateSetting AutoUpdateSetting `json:"autoUpdateSetting,omitempty"` + // UpdateStatus - The current update status of OneAgent. Possible values include: 'UpdateStatusINCOMPATIBLE', 'UpdateStatusOUTDATED', 'UpdateStatusSCHEDULED', 'UpdateStatusSUPPRESSED', 'UpdateStatusUNKNOWN', 'UpdateStatusUP2DATE', 'UpdateStatusUPDATEINPROGRESS', 'UpdateStatusUPDATEPENDING', 'UpdateStatusUPDATEPROBLEM' + UpdateStatus UpdateStatus `json:"updateStatus,omitempty"` + // AvailabilityState - The availability state of OneAgent. Possible values include: 'CRASHED', 'LOST', 'MONITORED', 'PREMONITORED', 'SHUTDOWN', 'UNEXPECTEDSHUTDOWN', 'UNKNOWN', 'UNMONITORED' + AvailabilityState AvailabilityState `json:"availabilityState,omitempty"` + // LogModule - Tells whether log modules are enabled or not. Possible values include: 'LogModuleENABLED', 'LogModuleDISABLED' + LogModule LogModule `json:"logModule,omitempty"` + // HostGroup - The name of the host group + HostGroup *string `json:"hostGroup,omitempty"` + // HostName - The name of the host + HostName *string `json:"hostName,omitempty"` +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/monitors.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/monitors.go new file mode 100644 index 000000000000..02ac8b14c54d --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/monitors.go @@ -0,0 +1,1407 @@ +package dynatrace + +// 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/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MonitorsClient is the client for the Monitors methods of the Dynatrace service. +type MonitorsClient struct { + BaseClient +} + +// NewMonitorsClient creates an instance of the MonitorsClient client. +func NewMonitorsClient(subscriptionID string) MonitorsClient { + return NewMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitorsClientWithBaseURI creates an instance of the MonitorsClient 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 NewMonitorsClientWithBaseURI(baseURI string, subscriptionID string) MonitorsClient { + return MonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// resource - resource create parameters. +func (client MonitorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, resource MonitorResource) (result MonitorsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resource, + Constraints: []validation.Constraint{{Target: "resource.MonitorProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "resource.MonitorProperties.UserInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "resource.MonitorProperties.UserInfo.PhoneNumber", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "resource.MonitorProperties.UserInfo.PhoneNumber", Name: validation.MaxLength, Rule: 40, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MonitorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, resource MonitorResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + resource.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", pathParameters), + autorest.WithJSON(resource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) CreateOrUpdateSender(req *http.Request) (future MonitorsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MonitorsClient) CreateOrUpdateResponder(resp *http.Response) (result MonitorResource, 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 sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Delete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", 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 MonitorsClient) DeleteSender(req *http.Request) (future MonitorsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 MonitorsClient) 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 sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", 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 MonitorsClient) 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 MonitorsClient) GetResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAccountCredentials sends the get account credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) GetAccountCredentials(ctx context.Context, resourceGroupName string, monitorName string) (result AccountInfoSecure, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.GetAccountCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "GetAccountCredentials", err.Error()) + } + + req, err := client.GetAccountCredentialsPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetAccountCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.GetAccountCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetAccountCredentials", resp, "Failure sending request") + return + } + + result, err = client.GetAccountCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetAccountCredentials", resp, "Failure responding to request") + return + } + + return +} + +// GetAccountCredentialsPreparer prepares the GetAccountCredentials request. +func (client MonitorsClient) GetAccountCredentialsPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getAccountCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAccountCredentialsSender sends the GetAccountCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) GetAccountCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAccountCredentialsResponder handles the response to the GetAccountCredentials request. The method always +// closes the http.Response Body. +func (client MonitorsClient) GetAccountCredentialsResponder(resp *http.Response) (result AccountInfoSecure, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSSODetails sends the get sso details request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// request - the details of the get sso details request. +func (client MonitorsClient) GetSSODetails(ctx context.Context, resourceGroupName string, monitorName string, request *SSODetailsRequest) (result SSODetailsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.GetSSODetails") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "GetSSODetails", err.Error()) + } + + req, err := client.GetSSODetailsPreparer(ctx, resourceGroupName, monitorName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetSSODetails", nil, "Failure preparing request") + return + } + + resp, err := client.GetSSODetailsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetSSODetails", resp, "Failure sending request") + return + } + + result, err = client.GetSSODetailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetSSODetails", resp, "Failure responding to request") + return + } + + return +} + +// GetSSODetailsPreparer prepares the GetSSODetails request. +func (client MonitorsClient) GetSSODetailsPreparer(ctx context.Context, resourceGroupName string, monitorName string, request *SSODetailsRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if request != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(request)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSSODetailsSender sends the GetSSODetails request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) GetSSODetailsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSSODetailsResponder handles the response to the GetSSODetails request. The method always +// closes the http.Response Body. +func (client MonitorsClient) GetSSODetailsResponder(resp *http.Response) (result SSODetailsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVMHostPayload sends the get vm host payload request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) GetVMHostPayload(ctx context.Context, resourceGroupName string, monitorName string) (result VMExtensionPayload, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.GetVMHostPayload") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "GetVMHostPayload", err.Error()) + } + + req, err := client.GetVMHostPayloadPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetVMHostPayload", nil, "Failure preparing request") + return + } + + resp, err := client.GetVMHostPayloadSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetVMHostPayload", resp, "Failure sending request") + return + } + + result, err = client.GetVMHostPayloadResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "GetVMHostPayload", resp, "Failure responding to request") + return + } + + return +} + +// GetVMHostPayloadPreparer prepares the GetVMHostPayload request. +func (client MonitorsClient) GetVMHostPayloadPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVMHostPayloadSender sends the GetVMHostPayload request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) GetVMHostPayloadSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVMHostPayloadResponder handles the response to the GetVMHostPayload request. The method always +// closes the http.Response Body. +func (client MonitorsClient) GetVMHostPayloadResponder(resp *http.Response) (result VMExtensionPayload, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAppServices sends the list app services request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListAppServices(ctx context.Context, resourceGroupName string, monitorName string) (result AppServiceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListAppServices") + defer func() { + sc := -1 + if result.aslr.Response.Response != nil { + sc = result.aslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "ListAppServices", err.Error()) + } + + result.fn = client.listAppServicesNextResults + req, err := client.ListAppServicesPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListAppServices", nil, "Failure preparing request") + return + } + + resp, err := client.ListAppServicesSender(req) + if err != nil { + result.aslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListAppServices", resp, "Failure sending request") + return + } + + result.aslr, err = client.ListAppServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListAppServices", resp, "Failure responding to request") + return + } + if result.aslr.hasNextLink() && result.aslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAppServicesPreparer prepares the ListAppServices request. +func (client MonitorsClient) ListAppServicesPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAppServicesSender sends the ListAppServices request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListAppServicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAppServicesResponder handles the response to the ListAppServices request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListAppServicesResponder(resp *http.Response) (result AppServiceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAppServicesNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listAppServicesNextResults(ctx context.Context, lastResults AppServiceListResponse) (result AppServiceListResponse, err error) { + req, err := lastResults.appServiceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listAppServicesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAppServicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listAppServicesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAppServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listAppServicesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAppServicesComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListAppServicesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result AppServiceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListAppServices") + 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.ListAppServices(ctx, resourceGroupName, monitorName) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MonitorResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client MonitorsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListByResourceGroupResponder(resp *http.Response) (result MonitorResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listByResourceGroupNextResults(ctx context.Context, lastResults MonitorResourceListResult) (result MonitorResourceListResult, err error) { + req, err := lastResults.monitorResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result MonitorResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") + 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.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscriptionID sends the list by subscription id request. +func (client MonitorsClient) ListBySubscriptionID(ctx context.Context) (result MonitorResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListBySubscriptionID") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "ListBySubscriptionID", err.Error()) + } + + result.fn = client.listBySubscriptionIDNextResults + req, err := client.ListBySubscriptionIDPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListBySubscriptionID", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client MonitorsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListBySubscriptionIDResponder(resp *http.Response) (result MonitorResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionIDNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listBySubscriptionIDNextResults(ctx context.Context, lastResults MonitorResourceListResult) (result MonitorResourceListResult, err error) { + req, err := lastResults.monitorResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listBySubscriptionIDNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listBySubscriptionIDNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listBySubscriptionIDNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionIDComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListBySubscriptionIDComplete(ctx context.Context) (result MonitorResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListBySubscriptionID") + 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.ListBySubscriptionID(ctx) + return +} + +// ListHosts sends the list hosts request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListHosts(ctx context.Context, resourceGroupName string, monitorName string) (result VMHostsListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListHosts") + defer func() { + sc := -1 + if result.vhlr.Response.Response != nil { + sc = result.vhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "ListHosts", err.Error()) + } + + result.fn = client.listHostsNextResults + req, err := client.ListHostsPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListHosts", nil, "Failure preparing request") + return + } + + resp, err := client.ListHostsSender(req) + if err != nil { + result.vhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListHosts", resp, "Failure sending request") + return + } + + result.vhlr, err = client.ListHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListHosts", resp, "Failure responding to request") + return + } + if result.vhlr.hasNextLink() && result.vhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListHostsPreparer prepares the ListHosts request. +func (client MonitorsClient) ListHostsPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListHostsSender sends the ListHosts request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListHostsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListHostsResponder handles the response to the ListHosts request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListHostsResponder(resp *http.Response) (result VMHostsListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listHostsNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listHostsNextResults(ctx context.Context, lastResults VMHostsListResponse) (result VMHostsListResponse, err error) { + req, err := lastResults.vMHostsListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listHostsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListHostsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listHostsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listHostsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListHostsComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListHostsComplete(ctx context.Context, resourceGroupName string, monitorName string) (result VMHostsListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListHosts") + 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.ListHosts(ctx, resourceGroupName, monitorName) + return +} + +// ListLinkableEnvironments sends the list linkable environments request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// request - the details of the linkable environment request. +func (client MonitorsClient) ListLinkableEnvironments(ctx context.Context, resourceGroupName string, monitorName string, request LinkableEnvironmentRequest) (result LinkableEnvironmentListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListLinkableEnvironments") + defer func() { + sc := -1 + if result.lelr.Response.Response != nil { + sc = result.lelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "ListLinkableEnvironments", err.Error()) + } + + result.fn = client.listLinkableEnvironmentsNextResults + req, err := client.ListLinkableEnvironmentsPreparer(ctx, resourceGroupName, monitorName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListLinkableEnvironments", nil, "Failure preparing request") + return + } + + resp, err := client.ListLinkableEnvironmentsSender(req) + if err != nil { + result.lelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListLinkableEnvironments", resp, "Failure sending request") + return + } + + result.lelr, err = client.ListLinkableEnvironmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListLinkableEnvironments", resp, "Failure responding to request") + return + } + if result.lelr.hasNextLink() && result.lelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListLinkableEnvironmentsPreparer prepares the ListLinkableEnvironments request. +func (client MonitorsClient) ListLinkableEnvironmentsPreparer(ctx context.Context, resourceGroupName string, monitorName string, request LinkableEnvironmentRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLinkableEnvironmentsSender sends the ListLinkableEnvironments request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListLinkableEnvironmentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListLinkableEnvironmentsResponder handles the response to the ListLinkableEnvironments request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListLinkableEnvironmentsResponder(resp *http.Response) (result LinkableEnvironmentListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listLinkableEnvironmentsNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listLinkableEnvironmentsNextResults(ctx context.Context, lastResults LinkableEnvironmentListResponse) (result LinkableEnvironmentListResponse, err error) { + req, err := lastResults.linkableEnvironmentListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listLinkableEnvironmentsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListLinkableEnvironmentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listLinkableEnvironmentsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListLinkableEnvironmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listLinkableEnvironmentsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListLinkableEnvironmentsComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListLinkableEnvironmentsComplete(ctx context.Context, resourceGroupName string, monitorName string, request LinkableEnvironmentRequest) (result LinkableEnvironmentListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListLinkableEnvironments") + 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.ListLinkableEnvironments(ctx, resourceGroupName, monitorName, request) + return +} + +// ListMonitoredResources sends the list monitored resources request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListMonitoredResources") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "ListMonitoredResources", err.Error()) + } + + result.fn = client.listMonitoredResourcesNextResults + req, err := client.ListMonitoredResourcesPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListMonitoredResources", nil, "Failure preparing request") + return + } + + resp, err := client.ListMonitoredResourcesSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListMonitoredResources", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "ListMonitoredResources", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListMonitoredResourcesPreparer prepares the ListMonitoredResources request. +func (client MonitorsClient) ListMonitoredResourcesPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListMonitoredResourcesSender sends the ListMonitoredResources request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListMonitoredResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListMonitoredResourcesResponder handles the response to the ListMonitoredResources request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListMonitoredResourcesResponder(resp *http.Response) (result MonitoredResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listMonitoredResourcesNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listMonitoredResourcesNextResults(ctx context.Context, lastResults MonitoredResourceListResponse) (result MonitoredResourceListResponse, err error) { + req, err := lastResults.monitoredResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listMonitoredResourcesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListMonitoredResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMonitoredResourcesComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListMonitoredResources") + 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.ListMonitoredResources(ctx, resourceGroupName, monitorName) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// resource - the resource properties to be updated. +func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, resource MonitorResourceUpdate) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.MonitorsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.MonitorsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MonitorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, resource MonitorResourceUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-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/Dynatrace.Observability/monitors/{monitorName}", pathParameters), + autorest.WithJSON(resource), + 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 MonitorsClient) 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 MonitorsClient) UpdateResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/operations.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/operations.go new file mode 100644 index 000000000000..f24c3612f5dc --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/operations.go @@ -0,0 +1,140 @@ +package dynatrace + +// 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" +) + +// OperationsClient is the client for the Operations methods of the Dynatrace service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Dynatrace.Observability/operations"), + 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 OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, 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 OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.OperationsClient", "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, "dynatrace.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.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 +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/singlesignon.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/singlesignon.go new file mode 100644 index 000000000000..e25a1df0fb1d --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/singlesignon.go @@ -0,0 +1,342 @@ +package dynatrace + +// 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/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SingleSignOnClient is the client for the SingleSignOn methods of the Dynatrace service. +type SingleSignOnClient struct { + BaseClient +} + +// NewSingleSignOnClient creates an instance of the SingleSignOnClient client. +func NewSingleSignOnClient(subscriptionID string) SingleSignOnClient { + return NewSingleSignOnClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSingleSignOnClientWithBaseURI creates an instance of the SingleSignOnClient 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 NewSingleSignOnClientWithBaseURI(baseURI string, subscriptionID string) SingleSignOnClient { + return SingleSignOnClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// configurationName - single Sign On Configuration Name +// resource - resource create parameters. +func (client SingleSignOnClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, resource SingleSignOnResource) (result SingleSignOnCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resource, + Constraints: []validation.Constraint{{Target: "resource.SingleSignOnProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.SingleSignOnClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, configurationName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SingleSignOnClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, resource SingleSignOnResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + resource.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", pathParameters), + autorest.WithJSON(resource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SingleSignOnClient) CreateOrUpdateSender(req *http.Request) (future SingleSignOnCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SingleSignOnClient) CreateOrUpdateResponder(resp *http.Response) (result SingleSignOnResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// configurationName - single Sign On Configuration Name +func (client SingleSignOnClient) Get(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (result SingleSignOnResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.SingleSignOnClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SingleSignOnClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationName": autorest.Encode("path", configurationName), + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", 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 SingleSignOnClient) 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 SingleSignOnClient) GetResponder(resp *http.Response) (result SingleSignOnResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client SingleSignOnClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result SingleSignOnResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnClient.List") + defer func() { + sc := -1 + if result.ssorlr.Response.Response != nil { + sc = result.ssorlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.SingleSignOnClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ssorlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "List", resp, "Failure sending request") + return + } + + result.ssorlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "List", resp, "Failure responding to request") + return + } + if result.ssorlr.hasNextLink() && result.ssorlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SingleSignOnClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/singleSignOnConfigurations", 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 SingleSignOnClient) 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 SingleSignOnClient) ListResponder(resp *http.Response) (result SingleSignOnResourceListResult, 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 SingleSignOnClient) listNextResults(ctx context.Context, lastResults SingleSignOnResourceListResult) (result SingleSignOnResourceListResult, err error) { + req, err := lastResults.singleSignOnResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "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, "dynatrace.SingleSignOnClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.SingleSignOnClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SingleSignOnClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result SingleSignOnResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnClient.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, resourceGroupName, monitorName) + return +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/tagrules.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/tagrules.go new file mode 100644 index 000000000000..74cdda1703ad --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/tagrules.go @@ -0,0 +1,521 @@ +package dynatrace + +// 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/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// TagRulesClient is the client for the TagRules methods of the Dynatrace service. +type TagRulesClient struct { + BaseClient +} + +// NewTagRulesClient creates an instance of the TagRulesClient client. +func NewTagRulesClient(subscriptionID string) TagRulesClient { + return NewTagRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTagRulesClientWithBaseURI creates an instance of the TagRulesClient 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 NewTagRulesClientWithBaseURI(baseURI string, subscriptionID string) TagRulesClient { + return TagRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// ruleSetName - monitor resource name +// resource - resource create parameters. +func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource TagRule) (result TagRulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resource, + Constraints: []validation.Constraint{{Target: "resource.MonitoringTagRulesProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.TagRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, ruleSetName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TagRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource TagRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + resource.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithJSON(resource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) CreateOrUpdateSender(req *http.Request) (future TagRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TagRulesClient) CreateOrUpdateResponder(resp *http.Response) (result TagRule, 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 sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// ruleSetName - monitor resource name +func (client TagRulesClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result TagRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.TagRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TagRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", 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 TagRulesClient) DeleteSender(req *http.Request) (future TagRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + 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 TagRulesClient) 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 sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// ruleSetName - monitor resource name +func (client TagRulesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result TagRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.TagRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TagRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", 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 TagRulesClient) 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 TagRulesClient) GetResponder(resp *http.Response) (result TagRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client TagRulesClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result TagRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") + defer func() { + sc := -1 + if result.trlr.Response.Response != nil { + sc = result.trlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.TagRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.trlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "List", resp, "Failure sending request") + return + } + + result.trlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "List", resp, "Failure responding to request") + return + } + if result.trlr.hasNextLink() && result.trlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TagRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/tagRules", 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 TagRulesClient) 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 TagRulesClient) ListResponder(resp *http.Response) (result TagRuleListResult, 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 TagRulesClient) listNextResults(ctx context.Context, lastResults TagRuleListResult) (result TagRuleListResult, err error) { + req, err := lastResults.tagRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "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, "dynatrace.TagRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TagRulesClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result TagRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.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, resourceGroupName, monitorName) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// ruleSetName - monitor resource name +// resource - the resource properties to be updated. +func (client TagRulesClient) Update(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource TagRuleUpdate) (result TagRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dynatrace.TagRulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, ruleSetName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "dynatrace.TagRulesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TagRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, resource TagRuleUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01-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/Dynatrace.Observability/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithJSON(resource), + 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 TagRulesClient) 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 TagRulesClient) UpdateResponder(resp *http.Response) (result TagRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/version.go b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/version.go new file mode 100644 index 000000000000..a38ec2917208 --- /dev/null +++ b/services/preview/dynatrace/mgmt/2021-09-01-preview/dynatrace/version.go @@ -0,0 +1,19 @@ +package dynatrace + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " dynatrace/2021-09-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}