From b4061e283b0ddbe412c948924d8d24392e15b2ac Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 12 Aug 2021 04:35:16 +0000 Subject: [PATCH] CodeGen from PR 15598 in Azure/azure-rest-api-specs moving logz to stable (#15598) * creating directory structure for stable version * version update chnages * reolving avacado error Co-authored-by: Gaurav Bang --- .../logz/mgmt/2020-10-01/logz/CHANGELOG.md | 2 + services/logz/mgmt/2020-10-01/logz/_meta.json | 11 + services/logz/mgmt/2020-10-01/logz/client.go | 41 + services/logz/mgmt/2020-10-01/logz/enums.go | 181 ++ .../2020-10-01/logz/logzapi/interfaces.go | 101 + services/logz/mgmt/2020-10-01/logz/models.go | 1737 +++++++++++++++++ services/logz/mgmt/2020-10-01/logz/monitor.go | 377 ++++ .../logz/mgmt/2020-10-01/logz/monitors.go | 921 +++++++++ .../logz/mgmt/2020-10-01/logz/operations.go | 134 ++ .../logz/mgmt/2020-10-01/logz/singlesignon.go | 341 ++++ .../logz/mgmt/2020-10-01/logz/subaccount.go | 1028 ++++++++++ .../2020-10-01/logz/subaccounttagrules.go | 434 ++++ .../logz/mgmt/2020-10-01/logz/tagrules.go | 425 ++++ services/logz/mgmt/2020-10-01/logz/version.go | 19 + .../mgmt/2020-10-01-preview/logz/CHANGELOG.md | 2 +- .../mgmt/2020-10-01-preview/logz/_meta.json | 2 +- .../mgmt/2020-10-01-preview/logz/monitor.go | 9 +- .../mgmt/2020-10-01-preview/logz/monitors.go | 21 +- .../2020-10-01-preview/logz/singlesignon.go | 9 +- .../2020-10-01-preview/logz/subaccount.go | 27 +- .../logz/subaccounttagrules.go | 12 +- .../mgmt/2020-10-01-preview/logz/tagrules.go | 12 +- 22 files changed, 5784 insertions(+), 62 deletions(-) create mode 100644 services/logz/mgmt/2020-10-01/logz/CHANGELOG.md create mode 100644 services/logz/mgmt/2020-10-01/logz/_meta.json create mode 100644 services/logz/mgmt/2020-10-01/logz/client.go create mode 100644 services/logz/mgmt/2020-10-01/logz/enums.go create mode 100644 services/logz/mgmt/2020-10-01/logz/logzapi/interfaces.go create mode 100644 services/logz/mgmt/2020-10-01/logz/models.go create mode 100644 services/logz/mgmt/2020-10-01/logz/monitor.go create mode 100644 services/logz/mgmt/2020-10-01/logz/monitors.go create mode 100644 services/logz/mgmt/2020-10-01/logz/operations.go create mode 100644 services/logz/mgmt/2020-10-01/logz/singlesignon.go create mode 100644 services/logz/mgmt/2020-10-01/logz/subaccount.go create mode 100644 services/logz/mgmt/2020-10-01/logz/subaccounttagrules.go create mode 100644 services/logz/mgmt/2020-10-01/logz/tagrules.go create mode 100644 services/logz/mgmt/2020-10-01/logz/version.go diff --git a/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md b/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/logz/mgmt/2020-10-01/logz/_meta.json b/services/logz/mgmt/2020-10-01/logz/_meta.json new file mode 100644 index 000000000000..72e6e4597d40 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "c073d623e6dcc01bbd50a36a078c08e7de030f09", + "readme": "/_/azure-rest-api-specs/specification/logz/resource-manager/readme.md", + "tag": "package-2020-10-01", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2020-10-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/logz/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/logz/mgmt/2020-10-01/logz/client.go b/services/logz/mgmt/2020-10-01/logz/client.go new file mode 100644 index 000000000000..f2f05259af75 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/client.go @@ -0,0 +1,41 @@ +// Package logz implements the Azure ARM Logz service API version 2020-10-01. +// +// +package logz + +// 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 Logz + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Logz. +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/logz/mgmt/2020-10-01/logz/enums.go b/services/logz/mgmt/2020-10-01/logz/enums.go new file mode 100644 index 000000000000..494cfe1b2be2 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/enums.go @@ -0,0 +1,181 @@ +package logz + +// 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. + +// 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} +} + +// ManagedIdentityTypes enumerates the values for managed identity types. +type ManagedIdentityTypes string + +const ( + // SystemAssigned ... + SystemAssigned ManagedIdentityTypes = "SystemAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityTypes = "UserAssigned" +) + +// PossibleManagedIdentityTypesValues returns an array of possible values for the ManagedIdentityTypes const type. +func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes { + return []ManagedIdentityTypes{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} +} + +// 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} +} + +// 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} +} + +// 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} +} + +// UserRole enumerates the values for user role. +type UserRole string + +const ( + // UserRoleAdmin ... + UserRoleAdmin UserRole = "Admin" + // UserRoleNone ... + UserRoleNone UserRole = "None" + // UserRoleUser ... + UserRoleUser UserRole = "User" +) + +// PossibleUserRoleValues returns an array of possible values for the UserRole const type. +func PossibleUserRoleValues() []UserRole { + return []UserRole{UserRoleAdmin, UserRoleNone, UserRoleUser} +} + +// VMHostUpdateStates enumerates the values for vm host update states. +type VMHostUpdateStates string + +const ( + // Delete ... + Delete VMHostUpdateStates = "Delete" + // Install ... + Install VMHostUpdateStates = "Install" +) + +// PossibleVMHostUpdateStatesValues returns an array of possible values for the VMHostUpdateStates const type. +func PossibleVMHostUpdateStatesValues() []VMHostUpdateStates { + return []VMHostUpdateStates{Delete, Install} +} diff --git a/services/logz/mgmt/2020-10-01/logz/logzapi/interfaces.go b/services/logz/mgmt/2020-10-01/logz/logzapi/interfaces.go new file mode 100644 index 000000000000..9c07db649e74 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/logzapi/interfaces.go @@ -0,0 +1,101 @@ +package logzapi + +// 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/logz/mgmt/2020-10-01/logz" + "github.com/Azure/go-autorest/autorest" +) + +// MonitorsClientAPI contains the set of methods on the MonitorsClient type. +type MonitorsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, monitorName string, body *logz.MonitorResource) (result logz.MonitorsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitorResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result logz.MonitorResourceListResponsePage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result logz.MonitorResourceListResponseIterator, err error) + ListBySubscription(ctx context.Context) (result logz.MonitorResourceListResponsePage, err error) + ListBySubscriptionComplete(ctx context.Context) (result logz.MonitorResourceListResponseIterator, err error) + ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitoredResourceListResponsePage, err error) + ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitoredResourceListResponseIterator, err error) + ListUserRoles(ctx context.Context, resourceGroupName string, monitorName string, body *logz.UserRoleRequest) (result logz.UserRoleListResponsePage, err error) + ListUserRolesComplete(ctx context.Context, resourceGroupName string, monitorName string, body *logz.UserRoleRequest) (result logz.UserRoleListResponseIterator, err error) + Update(ctx context.Context, resourceGroupName string, monitorName string, body *logz.MonitorResourceUpdateParameters) (result logz.MonitorResource, err error) +} + +var _ MonitorsClientAPI = (*logz.MonitorsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result logz.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result logz.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*logz.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, body *logz.MonitoringTagRules) (result logz.MonitoringTagRules, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result logz.MonitoringTagRules, err error) + List(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitoringTagRulesListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitoringTagRulesListResponseIterator, err error) +} + +var _ TagRulesClientAPI = (*logz.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, body *logz.SingleSignOnResource) (result logz.SingleSignOnCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, configurationName string) (result logz.SingleSignOnResource, err error) + List(ctx context.Context, resourceGroupName string, monitorName string) (result logz.SingleSignOnResourceListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result logz.SingleSignOnResourceListResponseIterator, err error) +} + +var _ SingleSignOnClientAPI = (*logz.SingleSignOnClient)(nil) + +// SubAccountClientAPI contains the set of methods on the SubAccountClient type. +type SubAccountClientAPI interface { + Create(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *logz.MonitorResource) (result logz.SubAccountCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.SubAccountDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.MonitorResource, err error) + List(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitorResourceListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result logz.MonitorResourceListResponseIterator, err error) + ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.MonitoredResourceListResponsePage, err error) + ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.MonitoredResourceListResponseIterator, err error) + ListVMHosts(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.VMResourcesListResponsePage, err error) + ListVMHostsComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.VMResourcesListResponseIterator, err error) + ListVMHostUpdate(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *logz.VMHostUpdateRequest) (result logz.VMResourcesListResponsePage, err error) + ListVMHostUpdateComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *logz.VMHostUpdateRequest) (result logz.VMResourcesListResponseIterator, err error) + Update(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *logz.MonitorResourceUpdateParameters) (result logz.MonitorResource, err error) + VMHostPayload(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.VMExtensionPayload, err error) +} + +var _ SubAccountClientAPI = (*logz.SubAccountClient)(nil) + +// SubAccountTagRulesClientAPI contains the set of methods on the SubAccountTagRulesClient type. +type SubAccountTagRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string, body *logz.MonitoringTagRules) (result logz.MonitoringTagRules, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string) (result logz.MonitoringTagRules, err error) + List(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.MonitoringTagRulesListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result logz.MonitoringTagRulesListResponseIterator, err error) +} + +var _ SubAccountTagRulesClientAPI = (*logz.SubAccountTagRulesClient)(nil) + +// MonitorClientAPI contains the set of methods on the MonitorClient type. +type MonitorClientAPI interface { + ListVMHosts(ctx context.Context, resourceGroupName string, monitorName string) (result logz.VMResourcesListResponsePage, err error) + ListVMHostsComplete(ctx context.Context, resourceGroupName string, monitorName string) (result logz.VMResourcesListResponseIterator, err error) + ListVMHostUpdate(ctx context.Context, resourceGroupName string, monitorName string, body *logz.VMHostUpdateRequest) (result logz.VMResourcesListResponsePage, err error) + ListVMHostUpdateComplete(ctx context.Context, resourceGroupName string, monitorName string, body *logz.VMHostUpdateRequest) (result logz.VMResourcesListResponseIterator, err error) + VMHostPayload(ctx context.Context, resourceGroupName string, monitorName string) (result logz.VMExtensionPayload, err error) +} + +var _ MonitorClientAPI = (*logz.MonitorClient)(nil) diff --git a/services/logz/mgmt/2020-10-01/logz/models.go b/services/logz/mgmt/2020-10-01/logz/models.go new file mode 100644 index 000000000000..08744a3f0625 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/models.go @@ -0,0 +1,1737 @@ +package logz + +// 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/logz/mgmt/2020-10-01/logz" + +// 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 - Possible values include: 'Include', 'Exclude' + Action TagAction `json:"action,omitempty"` +} + +// IdentityProperties ... +type IdentityProperties struct { + // PrincipalID - READ-ONLY; The identity ID. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - Possible values include: 'SystemAssigned', 'UserAssigned' + Type ManagedIdentityTypes `json:"type,omitempty"` +} + +// 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 + } + return json.Marshal(objectMap) +} + +// 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. + SendAadLogs *bool `json:"sendAadLogs,omitempty"` + // SendSubscriptionLogs - Flag specifying if subscription logs should be sent for the Monitor resource. + SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` + // SendActivityLogs - Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. + SendActivityLogs *bool `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"` +} + +// MonitoredResource the properties of a resource currently being monitored by the Logz 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 Logz. + SendingMetrics *bool `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 Logz. + SendingLogs *bool `json:"sendingLogs,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + // ReasonForLogsStatus - Reason for why the resource is sending logs (or why it is not sending). + ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` +} + +// MonitoredResourceListResponse response of a list operation. +type MonitoredResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitoredResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + 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, + } +} + +// MonitoringTagRules capture logs and metrics of Azure resources based on ARM tags. +type MonitoringTagRules struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the rule set. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The id of the rule set. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; The type of the rule set. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource + SystemData *SystemData `json:"systemData,omitempty"` + Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringTagRules. +func (mtr MonitoringTagRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mtr.Properties != nil { + objectMap["properties"] = mtr.Properties + } + return json.Marshal(objectMap) +} + +// MonitoringTagRulesListResponse response of a list operation. +type MonitoringTagRulesListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitoringTagRules `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoringTagRulesListResponseIterator provides access to a complete listing of MonitoringTagRules +// values. +type MonitoringTagRulesListResponseIterator struct { + i int + page MonitoringTagRulesListResponsePage +} + +// 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 *MonitoringTagRulesListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponseIterator.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 *MonitoringTagRulesListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoringTagRulesListResponseIterator) 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 MonitoringTagRulesListResponseIterator) Response() MonitoringTagRulesListResponse { + 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 MonitoringTagRulesListResponseIterator) Value() MonitoringTagRules { + if !iter.page.NotDone() { + return MonitoringTagRules{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoringTagRulesListResponseIterator type. +func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { + return MonitoringTagRulesListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mtrlr MonitoringTagRulesListResponse) IsEmpty() bool { + return mtrlr.Value == nil || len(*mtrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mtrlr MonitoringTagRulesListResponse) hasNextLink() bool { + return mtrlr.NextLink != nil && len(*mtrlr.NextLink) != 0 +} + +// monitoringTagRulesListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mtrlr MonitoringTagRulesListResponse) monitoringTagRulesListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mtrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mtrlr.NextLink))) +} + +// MonitoringTagRulesListResponsePage contains a page of MonitoringTagRules values. +type MonitoringTagRulesListResponsePage struct { + fn func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error) + mtrlr MonitoringTagRulesListResponse +} + +// 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 *MonitoringTagRulesListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponsePage.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.mtrlr) + if err != nil { + return err + } + page.mtrlr = 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 *MonitoringTagRulesListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoringTagRulesListResponsePage) NotDone() bool { + return !page.mtrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoringTagRulesListResponsePage) Response() MonitoringTagRulesListResponse { + return page.mtrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoringTagRulesListResponsePage) Values() []MonitoringTagRules { + if page.mtrlr.IsEmpty() { + return nil + } + return *page.mtrlr.Value +} + +// Creates a new instance of the MonitoringTagRulesListResponsePage type. +func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { + return MonitoringTagRulesListResponsePage{ + fn: getNextPage, + mtrlr: cur, + } +} + +// MonitoringTagRulesProperties definition of the properties for a TagRules resource. +type MonitoringTagRulesProperties struct { + // ProvisioningState - Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + LogRules *LogRules `json:"logRules,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MonitorProperties properties specific to the monitor resource. +type MonitorProperties struct { + // ProvisioningState - Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // MonitoringStatus - Possible values include: 'Enabled', 'Disabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + // MarketplaceSubscriptionStatus - Possible values include: 'Active', 'Suspended' + MarketplaceSubscriptionStatus MarketplaceSubscriptionStatus `json:"marketplaceSubscriptionStatus,omitempty"` + LogzOrganizationProperties *OrganizationProperties `json:"logzOrganizationProperties,omitempty"` + UserInfo *UserInfo `json:"userInfo,omitempty"` + PlanData *PlanData `json:"planData,omitempty"` + // LiftrResourceCategory - Possible values include: 'Unknown', 'MonitorLogs' + LiftrResourceCategory LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` + // LiftrResourcePreference - READ-ONLY; The priority of the resource. + LiftrResourcePreference *int32 `json:"liftrResourcePreference,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorProperties. +func (mp MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.ProvisioningState != "" { + objectMap["provisioningState"] = mp.ProvisioningState + } + if mp.MonitoringStatus != "" { + objectMap["monitoringStatus"] = mp.MonitoringStatus + } + if mp.MarketplaceSubscriptionStatus != "" { + objectMap["marketplaceSubscriptionStatus"] = mp.MarketplaceSubscriptionStatus + } + if mp.LogzOrganizationProperties != nil { + objectMap["logzOrganizationProperties"] = mp.LogzOrganizationProperties + } + if mp.UserInfo != nil { + objectMap["userInfo"] = mp.UserInfo + } + if mp.PlanData != nil { + objectMap["planData"] = mp.PlanData + } + if mp.LiftrResourceCategory != "" { + objectMap["liftrResourceCategory"] = mp.LiftrResourceCategory + } + return json.Marshal(objectMap) +} + +// MonitorResource ... +type MonitorResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ARM id of the monitor resource. + ID *string `json:"id,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource + SystemData *SystemData `json:"systemData,omitempty"` + // Name - READ-ONLY; Name of the monitor resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the monitor resource. + Type *string `json:"type,omitempty"` + Properties *MonitorProperties `json:"properties,omitempty"` + Identity *IdentityProperties `json:"identity,omitempty"` + Tags map[string]*string `json:"tags"` + Location *string `json:"location,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorResource. +func (mr MonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mr.Properties != nil { + objectMap["properties"] = mr.Properties + } + 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) +} + +// MonitorResourceListResponse response of a list operation. +type MonitorResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitorResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitorResourceListResponseIterator provides access to a complete listing of MonitorResource values. +type MonitorResourceListResponseIterator struct { + i int + page MonitorResourceListResponsePage +} + +// 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 *MonitorResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponseIterator.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 *MonitorResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitorResourceListResponseIterator) 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 MonitorResourceListResponseIterator) Response() MonitorResourceListResponse { + 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 MonitorResourceListResponseIterator) Value() MonitorResource { + if !iter.page.NotDone() { + return MonitorResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitorResourceListResponseIterator type. +func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { + return MonitorResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitorResourceListResponse) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitorResourceListResponse) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitorResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitorResourceListResponse) monitorResourceListResponsePreparer(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))) +} + +// MonitorResourceListResponsePage contains a page of MonitorResource values. +type MonitorResourceListResponsePage struct { + fn func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error) + mrlr MonitorResourceListResponse +} + +// 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 *MonitorResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponsePage.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 *MonitorResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitorResourceListResponsePage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitorResourceListResponsePage) Response() MonitorResourceListResponse { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitorResourceListResponsePage) Values() []MonitorResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitorResourceListResponsePage type. +func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { + return MonitorResourceListResponsePage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitorResourceUpdateParameters the parameters for a PATCH request to a monitor resource. +type MonitorResourceUpdateParameters struct { + Properties *MonitorUpdateProperties `json:"properties,omitempty"` + // Tags - The new tags of the monitor resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for MonitorResourceUpdateParameters. +func (mrup MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrup.Properties != nil { + objectMap["properties"] = mrup.Properties + } + if mrup.Tags != nil { + objectMap["tags"] = mrup.Tags + } + return json.Marshal(objectMap) +} + +// MonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsCreateFuture 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 *MonitorsCreateFuture) 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 MonitorsCreateFuture.Result. +func (future *MonitorsCreateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("logz.MonitorsCreateFuture") + 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.CreateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsCreateFuture", "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, "logz.MonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("logz.MonitorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// MonitorUpdateProperties the set of properties that can be update in a PATCH request to a monitor +// resource. +type MonitorUpdateProperties struct { + // MonitoringStatus - Possible values include: 'Enabled', 'Disabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider, i.e., Microsoft.Logz. + Provider *string `json:"provider,omitempty"` + // Resource - Type on which the operation is performed, e.g., 'monitors'. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type, e.g., read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation, e.g., 'Write monitors'. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of GET request to list the Microsoft.Logz operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the Microsoft.Logz provider. + Value *[]OperationResult `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of OperationResult 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() OperationResult { + if !iter.page.NotDone() { + return OperationResult{} + } + 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 OperationResult 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() []OperationResult { + 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, + } +} + +// OperationResult a Microsoft.Logz REST API operation. +type OperationResult struct { + // Name - Operation name, i.e., {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// OrganizationProperties ... +type OrganizationProperties struct { + // CompanyName - Name of the Logz organization. + CompanyName *string `json:"companyName,omitempty"` + // ID - READ-ONLY; Id of the Logz organization. + ID *string `json:"id,omitempty"` + // EnterpriseAppID - The Id of the Enterprise App used for Single sign on. + EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` + // SingleSignOnURL - The login URL specific to this Logz Organization. + SingleSignOnURL *string `json:"singleSignOnUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for OrganizationProperties. +func (op OrganizationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if op.CompanyName != nil { + objectMap["companyName"] = op.CompanyName + } + if op.EnterpriseAppID != nil { + objectMap["enterpriseAppId"] = op.EnterpriseAppID + } + if op.SingleSignOnURL != nil { + objectMap["singleSignOnUrl"] = op.SingleSignOnURL + } + return json.Marshal(objectMap) +} + +// PlanData ... +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 Logz + PlanDetails *string `json:"planDetails,omitempty"` + // EffectiveDate - date when plan was applied + EffectiveDate *date.Time `json:"effectiveDate,omitempty"` +} + +// 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, "logz.SingleSignOnCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ssor.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("logz.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, "logz.SingleSignOnCreateOrUpdateFuture", "Result", ssor.Response.Response, "Failure responding to request") + } + } + return +} + +// SingleSignOnProperties ... +type SingleSignOnProperties struct { + // SingleSignOnState - Possible values include: 'Initial', 'Enable', 'Disable', 'Existing' + SingleSignOnState SingleSignOnStates `json:"singleSignOnState,omitempty"` + // EnterpriseAppID - The Id of the Enterprise App used for Single sign-on. + EnterpriseAppID *string `json:"enterpriseAppId,omitempty"` + // SingleSignOnURL - The login URL specific to this Logz Organization. + SingleSignOnURL *string `json:"singleSignOnUrl,omitempty"` + // ProvisioningState - Possible values include: 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// SingleSignOnResource ... +type SingleSignOnResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ARM id of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the configuration. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` + Properties *SingleSignOnProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleSignOnResource. +func (ssor SingleSignOnResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssor.SystemData != nil { + objectMap["systemData"] = ssor.SystemData + } + if ssor.Properties != nil { + objectMap["properties"] = ssor.Properties + } + return json.Marshal(objectMap) +} + +// SingleSignOnResourceListResponse response of a list operation. +type SingleSignOnResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]SingleSignOnResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// SingleSignOnResourceListResponseIterator provides access to a complete listing of SingleSignOnResource +// values. +type SingleSignOnResourceListResponseIterator struct { + i int + page SingleSignOnResourceListResponsePage +} + +// 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 *SingleSignOnResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResponseIterator.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 *SingleSignOnResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SingleSignOnResourceListResponseIterator) 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 SingleSignOnResourceListResponseIterator) Response() SingleSignOnResourceListResponse { + 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 SingleSignOnResourceListResponseIterator) Value() SingleSignOnResource { + if !iter.page.NotDone() { + return SingleSignOnResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SingleSignOnResourceListResponseIterator type. +func NewSingleSignOnResourceListResponseIterator(page SingleSignOnResourceListResponsePage) SingleSignOnResourceListResponseIterator { + return SingleSignOnResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssorlr SingleSignOnResourceListResponse) IsEmpty() bool { + return ssorlr.Value == nil || len(*ssorlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssorlr SingleSignOnResourceListResponse) hasNextLink() bool { + return ssorlr.NextLink != nil && len(*ssorlr.NextLink) != 0 +} + +// singleSignOnResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssorlr SingleSignOnResourceListResponse) singleSignOnResourceListResponsePreparer(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))) +} + +// SingleSignOnResourceListResponsePage contains a page of SingleSignOnResource values. +type SingleSignOnResourceListResponsePage struct { + fn func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error) + ssorlr SingleSignOnResourceListResponse +} + +// 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 *SingleSignOnResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SingleSignOnResourceListResponsePage.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 *SingleSignOnResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SingleSignOnResourceListResponsePage) NotDone() bool { + return !page.ssorlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SingleSignOnResourceListResponsePage) Response() SingleSignOnResourceListResponse { + return page.ssorlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SingleSignOnResourceListResponsePage) Values() []SingleSignOnResource { + if page.ssorlr.IsEmpty() { + return nil + } + return *page.ssorlr.Value +} + +// Creates a new instance of the SingleSignOnResourceListResponsePage type. +func NewSingleSignOnResourceListResponsePage(cur SingleSignOnResourceListResponse, getNextPage func(context.Context, SingleSignOnResourceListResponse) (SingleSignOnResourceListResponse, error)) SingleSignOnResourceListResponsePage { + return SingleSignOnResourceListResponsePage{ + fn: getNextPage, + ssorlr: cur, + } +} + +// SubAccountCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubAccountCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubAccountClient) (MonitorResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubAccountCreateFuture) 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 SubAccountCreateFuture.Result. +func (future *SubAccountCreateFuture) result(client SubAccountClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("logz.SubAccountCreateFuture") + 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.CreateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountCreateFuture", "Result", mr.Response.Response, "Failure responding to request") + } + } + return +} + +// SubAccountDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubAccountDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubAccountClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubAccountDeleteFuture) 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 SubAccountDeleteFuture.Result. +func (future *SubAccountDeleteFuture) result(client SubAccountClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("logz.SubAccountDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// 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"` +} + +// UserInfo ... +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 Logz for contacting them if needed + EmailAddress *string `json:"emailAddress,omitempty"` + // PhoneNumber - Phone number of the user used by Logz for contacting them if needed + PhoneNumber *string `json:"phoneNumber,omitempty"` +} + +// UserRoleListResponse response for list of user's role for Logz.io account. +type UserRoleListResponse struct { + autorest.Response `json:"-"` + // Value - List of user roles for Logz.io account. + Value *[]UserRoleResponse `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// UserRoleListResponseIterator provides access to a complete listing of UserRoleResponse values. +type UserRoleListResponseIterator struct { + i int + page UserRoleListResponsePage +} + +// 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 *UserRoleListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserRoleListResponseIterator.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 *UserRoleListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UserRoleListResponseIterator) 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 UserRoleListResponseIterator) Response() UserRoleListResponse { + 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 UserRoleListResponseIterator) Value() UserRoleResponse { + if !iter.page.NotDone() { + return UserRoleResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UserRoleListResponseIterator type. +func NewUserRoleListResponseIterator(page UserRoleListResponsePage) UserRoleListResponseIterator { + return UserRoleListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (urlr UserRoleListResponse) IsEmpty() bool { + return urlr.Value == nil || len(*urlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (urlr UserRoleListResponse) hasNextLink() bool { + return urlr.NextLink != nil && len(*urlr.NextLink) != 0 +} + +// userRoleListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (urlr UserRoleListResponse) userRoleListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !urlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(urlr.NextLink))) +} + +// UserRoleListResponsePage contains a page of UserRoleResponse values. +type UserRoleListResponsePage struct { + fn func(context.Context, UserRoleListResponse) (UserRoleListResponse, error) + urlr UserRoleListResponse +} + +// 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 *UserRoleListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserRoleListResponsePage.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.urlr) + if err != nil { + return err + } + page.urlr = 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 *UserRoleListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UserRoleListResponsePage) NotDone() bool { + return !page.urlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UserRoleListResponsePage) Response() UserRoleListResponse { + return page.urlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UserRoleListResponsePage) Values() []UserRoleResponse { + if page.urlr.IsEmpty() { + return nil + } + return *page.urlr.Value +} + +// Creates a new instance of the UserRoleListResponsePage type. +func NewUserRoleListResponsePage(cur UserRoleListResponse, getNextPage func(context.Context, UserRoleListResponse) (UserRoleListResponse, error)) UserRoleListResponsePage { + return UserRoleListResponsePage{ + fn: getNextPage, + urlr: cur, + } +} + +// UserRoleRequest request for checking user's role for Logz.io account. +type UserRoleRequest struct { + // EmailAddress - Email of the user used by Logz for contacting them if needed + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// UserRoleResponse response for checking user's role for Logz.io account. +type UserRoleResponse struct { + // Role - Possible values include: 'UserRoleNone', 'UserRoleUser', 'UserRoleAdmin' + Role UserRole `json:"role,omitempty"` +} + +// VMExtensionPayload response of payload to be passed while installing VM agent. +type VMExtensionPayload struct { + autorest.Response `json:"-"` + // APIKey - API Key corresponding to the resource. + APIKey *string `json:"apiKey,omitempty"` + // Region - Logz.io region where the resource has been created. + Region *string `json:"region,omitempty"` +} + +// VMHostUpdateRequest request of a list VM Host Update Operation. +type VMHostUpdateRequest struct { + // VMResourceIds - Request of a list vm host update operation. + VMResourceIds *[]VMResources `json:"vmResourceIds,omitempty"` + // State - Specifies the state of the operation - install/ delete. Possible values include: 'Install', 'Delete' + State VMHostUpdateStates `json:"state,omitempty"` +} + +// VMResources VM Resource Ids +type VMResources struct { + // ID - Request of a list vm host update operation. + ID *string `json:"id,omitempty"` + // AgentVersion - Version of the Logz agent installed on the VM. + AgentVersion *string `json:"agentVersion,omitempty"` +} + +// VMResourcesListResponse response of a list VM Host Update Operation. +type VMResourcesListResponse struct { + autorest.Response `json:"-"` + // Value - Response of a list vm host update operation. + Value *[]VMResources `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// VMResourcesListResponseIterator provides access to a complete listing of VMResources values. +type VMResourcesListResponseIterator struct { + i int + page VMResourcesListResponsePage +} + +// 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 *VMResourcesListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMResourcesListResponseIterator.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 *VMResourcesListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VMResourcesListResponseIterator) 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 VMResourcesListResponseIterator) Response() VMResourcesListResponse { + 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 VMResourcesListResponseIterator) Value() VMResources { + if !iter.page.NotDone() { + return VMResources{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VMResourcesListResponseIterator type. +func NewVMResourcesListResponseIterator(page VMResourcesListResponsePage) VMResourcesListResponseIterator { + return VMResourcesListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vrlr VMResourcesListResponse) IsEmpty() bool { + return vrlr.Value == nil || len(*vrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vrlr VMResourcesListResponse) hasNextLink() bool { + return vrlr.NextLink != nil && len(*vrlr.NextLink) != 0 +} + +// vMResourcesListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vrlr VMResourcesListResponse) vMResourcesListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !vrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vrlr.NextLink))) +} + +// VMResourcesListResponsePage contains a page of VMResources values. +type VMResourcesListResponsePage struct { + fn func(context.Context, VMResourcesListResponse) (VMResourcesListResponse, error) + vrlr VMResourcesListResponse +} + +// 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 *VMResourcesListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMResourcesListResponsePage.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.vrlr) + if err != nil { + return err + } + page.vrlr = 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 *VMResourcesListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VMResourcesListResponsePage) NotDone() bool { + return !page.vrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VMResourcesListResponsePage) Response() VMResourcesListResponse { + return page.vrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VMResourcesListResponsePage) Values() []VMResources { + if page.vrlr.IsEmpty() { + return nil + } + return *page.vrlr.Value +} + +// Creates a new instance of the VMResourcesListResponsePage type. +func NewVMResourcesListResponsePage(cur VMResourcesListResponse, getNextPage func(context.Context, VMResourcesListResponse) (VMResourcesListResponse, error)) VMResourcesListResponsePage { + return VMResourcesListResponsePage{ + fn: getNextPage, + vrlr: cur, + } +} diff --git a/services/logz/mgmt/2020-10-01/logz/monitor.go b/services/logz/mgmt/2020-10-01/logz/monitor.go new file mode 100644 index 000000000000..80d4d45b6c26 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/monitor.go @@ -0,0 +1,377 @@ +package logz + +// 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" +) + +// MonitorClient is the client for the Monitor methods of the Logz service. +type MonitorClient struct { + BaseClient +} + +// NewMonitorClient creates an instance of the MonitorClient client. +func NewMonitorClient(subscriptionID string) MonitorClient { + return NewMonitorClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitorClientWithBaseURI creates an instance of the MonitorClient 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 NewMonitorClientWithBaseURI(baseURI string, subscriptionID string) MonitorClient { + return MonitorClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListVMHosts sends the list vm hosts request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorClient) ListVMHosts(ctx context.Context, resourceGroupName string, monitorName string) (result VMResourcesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorClient.ListVMHosts") + defer func() { + sc := -1 + if result.vrlr.Response.Response != nil { + sc = result.vrlr.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("logz.MonitorClient", "ListVMHosts", err.Error()) + } + + result.fn = client.listVMHostsNextResults + req, err := client.ListVMHostsPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "ListVMHosts", nil, "Failure preparing request") + return + } + + resp, err := client.ListVMHostsSender(req) + if err != nil { + result.vrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "ListVMHosts", resp, "Failure sending request") + return + } + + result.vrlr, err = client.ListVMHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "ListVMHosts", resp, "Failure responding to request") + return + } + if result.vrlr.hasNextLink() && result.vrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVMHostsPreparer prepares the ListVMHosts request. +func (client MonitorClient) ListVMHostsPreparer(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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/listVMHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVMHostsSender sends the ListVMHosts request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorClient) ListVMHostsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVMHostsResponder handles the response to the ListVMHosts request. The method always +// closes the http.Response Body. +func (client MonitorClient) ListVMHostsResponder(resp *http.Response) (result VMResourcesListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVMHostsNextResults retrieves the next set of results, if any. +func (client MonitorClient) listVMHostsNextResults(ctx context.Context, lastResults VMResourcesListResponse) (result VMResourcesListResponse, err error) { + req, err := lastResults.vMResourcesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.MonitorClient", "listVMHostsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVMHostsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logz.MonitorClient", "listVMHostsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVMHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "listVMHostsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVMHostsComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorClient) ListVMHostsComplete(ctx context.Context, resourceGroupName string, monitorName string) (result VMResourcesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorClient.ListVMHosts") + 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.ListVMHosts(ctx, resourceGroupName, monitorName) + return +} + +// ListVMHostUpdate sends the list vm host update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// body - request body to update the collection for agent installed in the given monitor. +func (client MonitorClient) ListVMHostUpdate(ctx context.Context, resourceGroupName string, monitorName string, body *VMHostUpdateRequest) (result VMResourcesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorClient.ListVMHostUpdate") + defer func() { + sc := -1 + if result.vrlr.Response.Response != nil { + sc = result.vrlr.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("logz.MonitorClient", "ListVMHostUpdate", err.Error()) + } + + result.fn = client.listVMHostUpdateNextResults + req, err := client.ListVMHostUpdatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "ListVMHostUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.ListVMHostUpdateSender(req) + if err != nil { + result.vrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "ListVMHostUpdate", resp, "Failure sending request") + return + } + + result.vrlr, err = client.ListVMHostUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "ListVMHostUpdate", resp, "Failure responding to request") + return + } + if result.vrlr.hasNextLink() && result.vrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVMHostUpdatePreparer prepares the ListVMHostUpdate request. +func (client MonitorClient) ListVMHostUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *VMHostUpdateRequest) (*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 = "2020-10-01" + 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/Microsoft.Logz/monitors/{monitorName}/vmHostUpdate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVMHostUpdateSender sends the ListVMHostUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorClient) ListVMHostUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVMHostUpdateResponder handles the response to the ListVMHostUpdate request. The method always +// closes the http.Response Body. +func (client MonitorClient) ListVMHostUpdateResponder(resp *http.Response) (result VMResourcesListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVMHostUpdateNextResults retrieves the next set of results, if any. +func (client MonitorClient) listVMHostUpdateNextResults(ctx context.Context, lastResults VMResourcesListResponse) (result VMResourcesListResponse, err error) { + req, err := lastResults.vMResourcesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.MonitorClient", "listVMHostUpdateNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVMHostUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logz.MonitorClient", "listVMHostUpdateNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVMHostUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "listVMHostUpdateNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVMHostUpdateComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorClient) ListVMHostUpdateComplete(ctx context.Context, resourceGroupName string, monitorName string, body *VMHostUpdateRequest) (result VMResourcesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorClient.ListVMHostUpdate") + 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.ListVMHostUpdate(ctx, resourceGroupName, monitorName, body) + return +} + +// VMHostPayload sends the vm host payload request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorClient) VMHostPayload(ctx context.Context, resourceGroupName string, monitorName string) (result VMExtensionPayload, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorClient.VMHostPayload") + 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("logz.MonitorClient", "VMHostPayload", err.Error()) + } + + req, err := client.VMHostPayloadPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "VMHostPayload", nil, "Failure preparing request") + return + } + + resp, err := client.VMHostPayloadSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "VMHostPayload", resp, "Failure sending request") + return + } + + result, err = client.VMHostPayloadResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorClient", "VMHostPayload", resp, "Failure responding to request") + return + } + + return +} + +// VMHostPayloadPreparer prepares the VMHostPayload request. +func (client MonitorClient) VMHostPayloadPreparer(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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/vmHostPayload", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VMHostPayloadSender sends the VMHostPayload request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorClient) VMHostPayloadSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// VMHostPayloadResponder handles the response to the VMHostPayload request. The method always +// closes the http.Response Body. +func (client MonitorClient) VMHostPayloadResponder(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 +} diff --git a/services/logz/mgmt/2020-10-01/logz/monitors.go b/services/logz/mgmt/2020-10-01/logz/monitors.go new file mode 100644 index 000000000000..101be9ed97a9 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/monitors.go @@ -0,0 +1,921 @@ +package logz + +// 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 Logz 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)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Create(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (result MonitorsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Create") + 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: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.FirstName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.FirstName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.LastName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.LastName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Pattern, Rule: `^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$`, Chain: nil}}}, + {Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.MaxLength, Rule: 40, Chain: nil}}}, + }}, + {Target: "body.Properties.PlanData", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.UsageType", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.UsageType", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.PlanData.BillingCycle", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.BillingCycle", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.PlanData.PlanDetails", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.PlanDetails", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + }}, + }}, + {Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("logz.MonitorsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client MonitorsClient) CreatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.SystemData = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) CreateSender(req *http.Request) (future MonitorsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client MonitorsClient) CreateResponder(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("logz.MonitorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "Delete", nil, "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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 + 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("logz.MonitorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.MonitorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 +} + +// 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 MonitorResourceListResponsePage, 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("logz.MonitorsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.MonitorsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 MonitorResourceListResponse, 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 MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.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, "logz.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 MonitorResourceListResponseIterator, 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 +} + +// ListBySubscription sends the list by subscription request. +func (client MonitorsClient) ListBySubscription(ctx context.Context) (result MonitorResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListBySubscription") + 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("logz.MonitorsClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client MonitorsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Logz/monitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListBySubscriptionResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listBySubscriptionNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.MonitorsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logz.MonitorsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListBySubscriptionComplete(ctx context.Context) (result MonitorResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListBySubscription") + 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.ListBySubscription(ctx) + 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("logz.MonitorsClient", "ListMonitoredResources", err.Error()) + } + + result.fn = client.listMonitoredResourcesNextResults + req, err := client.ListMonitoredResourcesPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.MonitorsClient", "ListMonitoredResources", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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, "logz.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, "logz.MonitorsClient", "listMonitoredResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 +} + +// ListUserRoles sends the list user roles request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) ListUserRoles(ctx context.Context, resourceGroupName string, monitorName string, body *UserRoleRequest) (result UserRoleListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListUserRoles") + defer func() { + sc := -1 + if result.urlr.Response.Response != nil { + sc = result.urlr.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}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.EmailAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.EmailAddress", Name: validation.Pattern, Rule: `^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$`, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("logz.MonitorsClient", "ListUserRoles", err.Error()) + } + + result.fn = client.listUserRolesNextResults + req, err := client.ListUserRolesPreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "ListUserRoles", nil, "Failure preparing request") + return + } + + resp, err := client.ListUserRolesSender(req) + if err != nil { + result.urlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "ListUserRoles", resp, "Failure sending request") + return + } + + result.urlr, err = client.ListUserRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "ListUserRoles", resp, "Failure responding to request") + return + } + if result.urlr.hasNextLink() && result.urlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUserRolesPreparer prepares the ListUserRoles request. +func (client MonitorsClient) ListUserRolesPreparer(ctx context.Context, resourceGroupName string, monitorName string, body *UserRoleRequest) (*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 = "2020-10-01" + 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/Microsoft.Logz/monitors/{monitorName}/listUserRoles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUserRolesSender sends the ListUserRoles request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListUserRolesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUserRolesResponder handles the response to the ListUserRoles request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListUserRolesResponder(resp *http.Response) (result UserRoleListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUserRolesNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listUserRolesNextResults(ctx context.Context, lastResults UserRoleListResponse) (result UserRoleListResponse, err error) { + req, err := lastResults.userRoleListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.MonitorsClient", "listUserRolesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUserRolesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logz.MonitorsClient", "listUserRolesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUserRolesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.MonitorsClient", "listUserRolesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUserRolesComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListUserRolesComplete(ctx context.Context, resourceGroupName string, monitorName string, body *UserRoleRequest) (result UserRoleListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListUserRoles") + 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.ListUserRoles(ctx, resourceGroupName, monitorName, body) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (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("logz.MonitorsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.MonitorsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, body *MonitorResourceUpdateParameters) (*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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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/logz/mgmt/2020-10-01/logz/operations.go b/services/logz/mgmt/2020-10-01/logz/operations.go new file mode 100644 index 000000000000..7b83f1243095 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/operations.go @@ -0,0 +1,134 @@ +package logz + +// 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 Logz 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, "logz.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, "logz.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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) { + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Logz/operations")) + 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, "logz.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, "logz.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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/logz/mgmt/2020-10-01/logz/singlesignon.go b/services/logz/mgmt/2020-10-01/logz/singlesignon.go new file mode 100644 index 000000000000..faeb6a554104 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/singlesignon.go @@ -0,0 +1,341 @@ +package logz + +// 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 Logz 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 +func (client SingleSignOnClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, body *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}}}}); err != nil { + return result, validation.NewError("logz.SingleSignOnClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, configurationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SingleSignOnClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SingleSignOnClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SingleSignOnClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, configurationName string, body *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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/singleSignOnConfigurations/{configurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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 + 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 +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("logz.SingleSignOnClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, configurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.SingleSignOnClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 SingleSignOnResourceListResponsePage, 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("logz.SingleSignOnClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.SingleSignOnClient", "List", resp, "Failure sending request") + return + } + + result.ssorlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 SingleSignOnResourceListResponse, 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 SingleSignOnResourceListResponse) (result SingleSignOnResourceListResponse, err error) { + req, err := lastResults.singleSignOnResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.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, "logz.SingleSignOnClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 SingleSignOnResourceListResponseIterator, 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/logz/mgmt/2020-10-01/logz/subaccount.go b/services/logz/mgmt/2020-10-01/logz/subaccount.go new file mode 100644 index 000000000000..772fe09e1013 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/subaccount.go @@ -0,0 +1,1028 @@ +package logz + +// 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" +) + +// SubAccountClient is the client for the SubAccount methods of the Logz service. +type SubAccountClient struct { + BaseClient +} + +// NewSubAccountClient creates an instance of the SubAccountClient client. +func NewSubAccountClient(subscriptionID string) SubAccountClient { + return NewSubAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubAccountClientWithBaseURI creates an instance of the SubAccountClient 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 NewSubAccountClientWithBaseURI(baseURI string, subscriptionID string) SubAccountClient { + return SubAccountClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// subAccountName - sub Account resource name +func (client SubAccountClient) Create(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *MonitorResource) (result SubAccountCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.Create") + 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: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.FirstName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.FirstName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.LastName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.LastName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Pattern, Rule: `^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,}$`, Chain: nil}}}, + {Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.PhoneNumber", Name: validation.MaxLength, Rule: 40, Chain: nil}}}, + }}, + {Target: "body.Properties.PlanData", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.UsageType", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.UsageType", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.PlanData.BillingCycle", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.BillingCycle", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.PlanData.PlanDetails", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.PlanData.PlanDetails", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + }}, + }}, + {Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("logz.SubAccountClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, monitorName, subAccountName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client SubAccountClient) CreatePreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *MonitorResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.SystemData = nil + body.Name = nil + body.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client SubAccountClient) CreateSender(req *http.Request) (future SubAccountCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client SubAccountClient) CreateResponder(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 +// subAccountName - sub Account resource name +func (client SubAccountClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result SubAccountDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.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("logz.SubAccountClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName, subAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubAccountClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}", 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 SubAccountClient) DeleteSender(req *http.Request) (future SubAccountDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubAccountClient) 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 +// subAccountName - sub Account resource name +func (client SubAccountClient) Get(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.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("logz.SubAccountClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, subAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubAccountClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}", 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 SubAccountClient) 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 SubAccountClient) 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 +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +func (client SubAccountClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.List") + 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("logz.SubAccountClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "List", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "List", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SubAccountClient) 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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts", 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 SubAccountClient) 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 SubAccountClient) ListResponder(resp *http.Response) (result MonitorResourceListResponse, 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 SubAccountClient) listNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.SubAccountClient", "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, "logz.SubAccountClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAccountClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.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 +} + +// ListMonitoredResources sends the list monitored resources request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// subAccountName - sub Account resource name +func (client SubAccountClient) ListMonitoredResources(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result MonitoredResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.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("logz.SubAccountClient", "ListMonitoredResources", err.Error()) + } + + result.fn = client.listMonitoredResourcesNextResults + req, err := client.ListMonitoredResourcesPreparer(ctx, resourceGroupName, monitorName, subAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "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, "logz.SubAccountClient", "ListMonitoredResources", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "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 SubAccountClient) ListMonitoredResourcesPreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/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 SubAccountClient) 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 SubAccountClient) 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 SubAccountClient) listMonitoredResourcesNextResults(ctx context.Context, lastResults MonitoredResourceListResponse) (result MonitoredResourceListResponse, err error) { + req, err := lastResults.monitoredResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.SubAccountClient", "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, "logz.SubAccountClient", "listMonitoredResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListMonitoredResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "listMonitoredResourcesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListMonitoredResourcesComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAccountClient) ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result MonitoredResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.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, subAccountName) + return +} + +// ListVMHosts sends the list vm hosts request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// subAccountName - sub Account resource name +func (client SubAccountClient) ListVMHosts(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result VMResourcesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.ListVMHosts") + defer func() { + sc := -1 + if result.vrlr.Response.Response != nil { + sc = result.vrlr.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("logz.SubAccountClient", "ListVMHosts", err.Error()) + } + + result.fn = client.listVMHostsNextResults + req, err := client.ListVMHostsPreparer(ctx, resourceGroupName, monitorName, subAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "ListVMHosts", nil, "Failure preparing request") + return + } + + resp, err := client.ListVMHostsSender(req) + if err != nil { + result.vrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "ListVMHosts", resp, "Failure sending request") + return + } + + result.vrlr, err = client.ListVMHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "ListVMHosts", resp, "Failure responding to request") + return + } + if result.vrlr.hasNextLink() && result.vrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVMHostsPreparer prepares the ListVMHosts request. +func (client SubAccountClient) ListVMHostsPreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/listVMHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVMHostsSender sends the ListVMHosts request. The method will close the +// http.Response Body if it receives an error. +func (client SubAccountClient) ListVMHostsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVMHostsResponder handles the response to the ListVMHosts request. The method always +// closes the http.Response Body. +func (client SubAccountClient) ListVMHostsResponder(resp *http.Response) (result VMResourcesListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVMHostsNextResults retrieves the next set of results, if any. +func (client SubAccountClient) listVMHostsNextResults(ctx context.Context, lastResults VMResourcesListResponse) (result VMResourcesListResponse, err error) { + req, err := lastResults.vMResourcesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.SubAccountClient", "listVMHostsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVMHostsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logz.SubAccountClient", "listVMHostsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVMHostsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "listVMHostsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVMHostsComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAccountClient) ListVMHostsComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result VMResourcesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.ListVMHosts") + 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.ListVMHosts(ctx, resourceGroupName, monitorName, subAccountName) + return +} + +// ListVMHostUpdate sends the list vm host update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// subAccountName - sub Account resource name +// body - request body to update the collection for agent installed in the given monitor. +func (client SubAccountClient) ListVMHostUpdate(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *VMHostUpdateRequest) (result VMResourcesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.ListVMHostUpdate") + defer func() { + sc := -1 + if result.vrlr.Response.Response != nil { + sc = result.vrlr.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("logz.SubAccountClient", "ListVMHostUpdate", err.Error()) + } + + result.fn = client.listVMHostUpdateNextResults + req, err := client.ListVMHostUpdatePreparer(ctx, resourceGroupName, monitorName, subAccountName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "ListVMHostUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.ListVMHostUpdateSender(req) + if err != nil { + result.vrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "ListVMHostUpdate", resp, "Failure sending request") + return + } + + result.vrlr, err = client.ListVMHostUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "ListVMHostUpdate", resp, "Failure responding to request") + return + } + if result.vrlr.hasNextLink() && result.vrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVMHostUpdatePreparer prepares the ListVMHostUpdate request. +func (client SubAccountClient) ListVMHostUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *VMHostUpdateRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + 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/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/vmHostUpdate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVMHostUpdateSender sends the ListVMHostUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubAccountClient) ListVMHostUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVMHostUpdateResponder handles the response to the ListVMHostUpdate request. The method always +// closes the http.Response Body. +func (client SubAccountClient) ListVMHostUpdateResponder(resp *http.Response) (result VMResourcesListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVMHostUpdateNextResults retrieves the next set of results, if any. +func (client SubAccountClient) listVMHostUpdateNextResults(ctx context.Context, lastResults VMResourcesListResponse) (result VMResourcesListResponse, err error) { + req, err := lastResults.vMResourcesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.SubAccountClient", "listVMHostUpdateNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVMHostUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "logz.SubAccountClient", "listVMHostUpdateNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVMHostUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "listVMHostUpdateNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVMHostUpdateComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAccountClient) ListVMHostUpdateComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *VMHostUpdateRequest) (result VMResourcesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.ListVMHostUpdate") + 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.ListVMHostUpdate(ctx, resourceGroupName, monitorName, subAccountName, body) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// subAccountName - sub Account resource name +func (client SubAccountClient) Update(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *MonitorResourceUpdateParameters) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.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("logz.SubAccountClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, subAccountName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SubAccountClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, body *MonitorResourceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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 SubAccountClient) 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 SubAccountClient) 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 +} + +// VMHostPayload sends the vm host payload request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// monitorName - monitor resource name +// subAccountName - sub Account resource name +func (client SubAccountClient) VMHostPayload(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result VMExtensionPayload, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountClient.VMHostPayload") + 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("logz.SubAccountClient", "VMHostPayload", err.Error()) + } + + req, err := client.VMHostPayloadPreparer(ctx, resourceGroupName, monitorName, subAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "VMHostPayload", nil, "Failure preparing request") + return + } + + resp, err := client.VMHostPayloadSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "VMHostPayload", resp, "Failure sending request") + return + } + + result, err = client.VMHostPayloadResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountClient", "VMHostPayload", resp, "Failure responding to request") + return + } + + return +} + +// VMHostPayloadPreparer prepares the VMHostPayload request. +func (client SubAccountClient) VMHostPayloadPreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/vmHostPayload", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VMHostPayloadSender sends the VMHostPayload request. The method will close the +// http.Response Body if it receives an error. +func (client SubAccountClient) VMHostPayloadSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// VMHostPayloadResponder handles the response to the VMHostPayload request. The method always +// closes the http.Response Body. +func (client SubAccountClient) VMHostPayloadResponder(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 +} diff --git a/services/logz/mgmt/2020-10-01/logz/subaccounttagrules.go b/services/logz/mgmt/2020-10-01/logz/subaccounttagrules.go new file mode 100644 index 000000000000..e7cdd740b6f5 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/subaccounttagrules.go @@ -0,0 +1,434 @@ +package logz + +// 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" +) + +// SubAccountTagRulesClient is the client for the SubAccountTagRules methods of the Logz service. +type SubAccountTagRulesClient struct { + BaseClient +} + +// NewSubAccountTagRulesClient creates an instance of the SubAccountTagRulesClient client. +func NewSubAccountTagRulesClient(subscriptionID string) SubAccountTagRulesClient { + return NewSubAccountTagRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubAccountTagRulesClientWithBaseURI creates an instance of the SubAccountTagRulesClient 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 NewSubAccountTagRulesClientWithBaseURI(baseURI string, subscriptionID string) SubAccountTagRulesClient { + return SubAccountTagRulesClient{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 +// subAccountName - sub Account resource name +func (client SubAccountTagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string, body *MonitoringTagRules) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountTagRulesClient.CreateOrUpdate") + 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("logz.SubAccountTagRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, subAccountName, ruleSetName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubAccountTagRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string, body *MonitoringTagRules) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.Name = nil + body.ID = nil + body.Type = nil + body.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/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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 SubAccountTagRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubAccountTagRulesClient) CreateOrUpdateResponder(resp *http.Response) (result MonitoringTagRules, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + 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 +// subAccountName - sub Account resource name +func (client SubAccountTagRulesClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountTagRulesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.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("logz.SubAccountTagRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName, subAccountName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubAccountTagRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName 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), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/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 SubAccountTagRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubAccountTagRulesClient) 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 +// subAccountName - sub Account resource name +func (client SubAccountTagRulesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string, ruleSetName string) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountTagRulesClient.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("logz.SubAccountTagRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, subAccountName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubAccountTagRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName 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), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/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 SubAccountTagRulesClient) 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 SubAccountTagRulesClient) GetResponder(resp *http.Response) (result MonitoringTagRules, 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 +// subAccountName - sub Account resource name +func (client SubAccountTagRulesClient) List(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result MonitoringTagRulesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountTagRulesClient.List") + defer func() { + sc := -1 + if result.mtrlr.Response.Response != nil { + sc = result.mtrlr.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("logz.SubAccountTagRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName, subAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mtrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "List", resp, "Failure sending request") + return + } + + result.mtrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "List", resp, "Failure responding to request") + return + } + if result.mtrlr.hasNextLink() && result.mtrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SubAccountTagRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subAccountName": autorest.Encode("path", subAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors/{monitorName}/accounts/{subAccountName}/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 SubAccountTagRulesClient) 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 SubAccountTagRulesClient) ListResponder(resp *http.Response) (result MonitoringTagRulesListResponse, 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 SubAccountTagRulesClient) listNextResults(ctx context.Context, lastResults MonitoringTagRulesListResponse) (result MonitoringTagRulesListResponse, err error) { + req, err := lastResults.monitoringTagRulesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "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, "logz.SubAccountTagRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.SubAccountTagRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAccountTagRulesClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string, subAccountName string) (result MonitoringTagRulesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAccountTagRulesClient.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, subAccountName) + return +} diff --git a/services/logz/mgmt/2020-10-01/logz/tagrules.go b/services/logz/mgmt/2020-10-01/logz/tagrules.go new file mode 100644 index 000000000000..1ca90f111206 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/tagrules.go @@ -0,0 +1,425 @@ +package logz + +// 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 Logz 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 +func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.CreateOrUpdate") + 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("logz.TagRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, ruleSetName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TagRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (*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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.Name = nil + body.ID = nil + body.Type = nil + body.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/Microsoft.Logz/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + 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) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TagRulesClient) CreateOrUpdateResponder(resp *http.Response) (result MonitoringTagRules, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + 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 TagRulesClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.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("logz.TagRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "Delete", resp, "Failure responding to 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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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 +func (client TagRulesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result MonitoringTagRules, 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("logz.TagRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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, "logz.TagRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 MonitoringTagRules, 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 MonitoringTagRulesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") + defer func() { + sc := -1 + if result.mtrlr.Response.Response != nil { + sc = result.mtrlr.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("logz.TagRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mtrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "List", resp, "Failure sending request") + return + } + + result.mtrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.TagRulesClient", "List", resp, "Failure responding to request") + return + } + if result.mtrlr.hasNextLink() && result.mtrlr.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 = "2020-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/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 MonitoringTagRulesListResponse, 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 MonitoringTagRulesListResponse) (result MonitoringTagRulesListResponse, err error) { + req, err := lastResults.monitoringTagRulesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "logz.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, "logz.TagRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "logz.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 MonitoringTagRulesListResponseIterator, 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 +} diff --git a/services/logz/mgmt/2020-10-01/logz/version.go b/services/logz/mgmt/2020-10-01/logz/version.go new file mode 100644 index 000000000000..ef4ad15ad4d9 --- /dev/null +++ b/services/logz/mgmt/2020-10-01/logz/version.go @@ -0,0 +1,19 @@ +package logz + +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() + " logz/2020-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md b/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json b/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json index 854acc7cea71..9a82cb11c66a 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json @@ -1,5 +1,5 @@ { - "commit": "394395ed0bdc1c5c05cb37a031379ca03bfebbb5", + "commit": "c073d623e6dcc01bbd50a36a078c08e7de030f09", "readme": "/_/azure-rest-api-specs/specification/logz/resource-manager/readme.md", "tag": "package-2020-10-01-preview", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go index 5e9cf8b4fcd2..1111bb48087e 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go @@ -51,8 +51,7 @@ func (client MonitorClient) ListVMHosts(ctx context.Context, resourceGroupName s 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorClient", "ListVMHosts", err.Error()) } @@ -180,8 +179,7 @@ func (client MonitorClient) ListVMHostUpdate(ctx context.Context, resourceGroupN 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorClient", "ListVMHostUpdate", err.Error()) } @@ -313,8 +311,7 @@ func (client MonitorClient) VMHostPayload(ctx context.Context, resourceGroupName 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorClient", "VMHostPayload", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go index 0088a2d280a5..2f1b27dd163f 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go @@ -51,8 +51,7 @@ func (client MonitorsClient) Create(ctx context.Context, resourceGroupName strin 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: false, @@ -172,8 +171,7 @@ func (client MonitorsClient) Delete(ctx context.Context, resourceGroupName strin 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorsClient", "Delete", err.Error()) } @@ -259,8 +257,7 @@ func (client MonitorsClient) Get(ctx context.Context, resourceGroupName string, 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorsClient", "Get", err.Error()) } @@ -344,8 +341,7 @@ func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGr 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorsClient", "ListByResourceGroup", err.Error()) } @@ -590,8 +586,7 @@ func (client MonitorsClient) ListMonitoredResources(ctx context.Context, resourc 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorsClient", "ListMonitoredResources", err.Error()) } @@ -718,8 +713,7 @@ func (client MonitorsClient) ListUserRoles(ctx context.Context, resourceGroupNam 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.EmailAddress", Name: validation.Null, Rule: false, @@ -856,8 +850,7 @@ func (client MonitorsClient) Update(ctx context.Context, resourceGroupName strin 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorsClient", "Update", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go index 0679148e2004..3242c1ba90f7 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go @@ -51,8 +51,7 @@ func (client SingleSignOnClient) CreateOrUpdate(ctx context.Context, resourceGro 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SingleSignOnClient", "CreateOrUpdate", err.Error()) } @@ -148,8 +147,7 @@ func (client SingleSignOnClient) Get(ctx context.Context, resourceGroupName stri 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SingleSignOnClient", "Get", err.Error()) } @@ -235,8 +233,7 @@ func (client SingleSignOnClient) List(ctx context.Context, resourceGroupName str 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SingleSignOnClient", "List", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go index 2a732175c7fb..6c7771565dcd 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go @@ -52,8 +52,7 @@ func (client SubAccountClient) Create(ctx context.Context, resourceGroupName str 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: false, @@ -175,8 +174,7 @@ func (client SubAccountClient) Delete(ctx context.Context, resourceGroupName str 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "Delete", err.Error()) } @@ -264,8 +262,7 @@ func (client SubAccountClient) Get(ctx context.Context, resourceGroupName string 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "Get", err.Error()) } @@ -351,8 +348,7 @@ func (client SubAccountClient) List(ctx context.Context, resourceGroupName strin 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "List", err.Error()) } @@ -480,8 +476,7 @@ func (client SubAccountClient) ListMonitoredResources(ctx context.Context, resou 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "ListMonitoredResources", err.Error()) } @@ -610,8 +605,7 @@ func (client SubAccountClient) ListVMHosts(ctx context.Context, resourceGroupNam 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "ListVMHosts", err.Error()) } @@ -741,8 +735,7 @@ func (client SubAccountClient) ListVMHostUpdate(ctx context.Context, resourceGro 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "ListVMHostUpdate", err.Error()) } @@ -876,8 +869,7 @@ func (client SubAccountClient) Update(ctx context.Context, resourceGroupName str 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "Update", err.Error()) } @@ -969,8 +961,7 @@ func (client SubAccountClient) VMHostPayload(ctx context.Context, resourceGroupN 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "VMHostPayload", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go index 5e76443f5c7d..8ce469202f54 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go @@ -53,8 +53,7 @@ func (client SubAccountTagRulesClient) CreateOrUpdate(ctx context.Context, resou 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountTagRulesClient", "CreateOrUpdate", err.Error()) } @@ -151,8 +150,7 @@ func (client SubAccountTagRulesClient) Delete(ctx context.Context, resourceGroup 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountTagRulesClient", "Delete", err.Error()) } @@ -239,8 +237,7 @@ func (client SubAccountTagRulesClient) Get(ctx context.Context, resourceGroupNam 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountTagRulesClient", "Get", err.Error()) } @@ -328,8 +325,7 @@ func (client SubAccountTagRulesClient) List(ctx context.Context, resourceGroupNa 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountTagRulesClient", "List", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go index 3557d41088cd..5bf2cec94ec2 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go @@ -51,8 +51,7 @@ func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupNa 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.TagRulesClient", "CreateOrUpdate", err.Error()) } @@ -147,8 +146,7 @@ func (client TagRulesClient) Delete(ctx context.Context, resourceGroupName strin 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.TagRulesClient", "Delete", err.Error()) } @@ -233,8 +231,7 @@ func (client TagRulesClient) Get(ctx context.Context, resourceGroupName string, 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.TagRulesClient", "Get", err.Error()) } @@ -320,8 +317,7 @@ func (client TagRulesClient) List(ctx context.Context, resourceGroupName string, 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}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.TagRulesClient", "List", err.Error()) }