diff --git a/CHANGELOG.md b/CHANGELOG.md index 04fa29200e4f..65f0fa716279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # CHANGELOG +## `v61.0.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights` +- `github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics` + +### Breaking Changes + +| Package Path | Changelog | +| :--- | :---: | +| `github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md) | + ## `v60.3.0` ### New Packages diff --git a/profiles/latest/notificationhubs/mgmt/notificationhubs/models.go b/profiles/latest/notificationhubs/mgmt/notificationhubs/models.go index e3a5b87b2852..ed6c37777e3d 100644 --- a/profiles/latest/notificationhubs/mgmt/notificationhubs/models.go +++ b/profiles/latest/notificationhubs/mgmt/notificationhubs/models.go @@ -22,24 +22,24 @@ const ( type AccessRights = original.AccessRights const ( - Listen AccessRights = original.Listen - Manage AccessRights = original.Manage - SendEnumValue AccessRights = original.SendEnumValue + AccessRightsListen AccessRights = original.AccessRightsListen + AccessRightsManage AccessRights = original.AccessRightsManage + AccessRightsSend AccessRights = original.AccessRightsSend ) type NamespaceType = original.NamespaceType const ( - Messaging NamespaceType = original.Messaging - NotificationHub NamespaceType = original.NotificationHub + NamespaceTypeMessaging NamespaceType = original.NamespaceTypeMessaging + NamespaceTypeNotificationHub NamespaceType = original.NamespaceTypeNotificationHub ) type SkuName = original.SkuName const ( - Basic SkuName = original.Basic - Free SkuName = original.Free - Standard SkuName = original.Standard + SkuNameBasic SkuName = original.SkuNameBasic + SkuNameFree SkuName = original.SkuNameFree + SkuNameStandard SkuName = original.SkuNameStandard ) type AdmCredential = original.AdmCredential diff --git a/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go b/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go index 97784a9d51b1..b1f824a69c54 100644 --- a/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go +++ b/profiles/latest/streamanalytics/mgmt/streamanalytics/models.go @@ -12,13 +12,21 @@ package streamanalytics import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2016-03-01/streamanalytics" + original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics" ) const ( DefaultBaseURI = original.DefaultBaseURI ) +type AuthenticationMode = original.AuthenticationMode + +const ( + AuthenticationModeConnectionString AuthenticationMode = original.AuthenticationModeConnectionString + AuthenticationModeMsi AuthenticationMode = original.AuthenticationModeMsi + AuthenticationModeUserToken AuthenticationMode = original.AuthenticationModeUserToken +) + type BindingType = original.BindingType const ( @@ -27,30 +35,92 @@ const ( BindingTypeMicrosoftStreamAnalyticsJavascriptUdf BindingType = original.BindingTypeMicrosoftStreamAnalyticsJavascriptUdf ) +type ClusterProvisioningState = original.ClusterProvisioningState + +const ( + ClusterProvisioningStateCanceled ClusterProvisioningState = original.ClusterProvisioningStateCanceled + ClusterProvisioningStateFailed ClusterProvisioningState = original.ClusterProvisioningStateFailed + ClusterProvisioningStateInProgress ClusterProvisioningState = original.ClusterProvisioningStateInProgress + ClusterProvisioningStateSucceeded ClusterProvisioningState = original.ClusterProvisioningStateSucceeded +) + +type ClusterSkuName = original.ClusterSkuName + +const ( + ClusterSkuNameDefault ClusterSkuName = original.ClusterSkuNameDefault +) + type CompatibilityLevel = original.CompatibilityLevel const ( - OneFullStopZero CompatibilityLevel = original.OneFullStopZero + CompatibilityLevelOneFullStopTwo CompatibilityLevel = original.CompatibilityLevelOneFullStopTwo + CompatibilityLevelOneFullStopZero CompatibilityLevel = original.CompatibilityLevelOneFullStopZero +) + +type CompressionType = original.CompressionType + +const ( + CompressionTypeDeflate CompressionType = original.CompressionTypeDeflate + CompressionTypeGZip CompressionType = original.CompressionTypeGZip + CompressionTypeNone CompressionType = original.CompressionTypeNone +) + +type ContentStoragePolicy = original.ContentStoragePolicy + +const ( + ContentStoragePolicyJobStorageAccount ContentStoragePolicy = original.ContentStoragePolicyJobStorageAccount + ContentStoragePolicySystemAccount ContentStoragePolicy = original.ContentStoragePolicySystemAccount ) type Encoding = original.Encoding const ( - UTF8 Encoding = original.UTF8 + EncodingUTF8 Encoding = original.EncodingUTF8 +) + +type EventSerializationType = original.EventSerializationType + +const ( + EventSerializationTypeAvro EventSerializationType = original.EventSerializationTypeAvro + EventSerializationTypeCsv EventSerializationType = original.EventSerializationTypeCsv + EventSerializationTypeJSON EventSerializationType = original.EventSerializationTypeJSON + EventSerializationTypeParquet EventSerializationType = original.EventSerializationTypeParquet ) type EventsOutOfOrderPolicy = original.EventsOutOfOrderPolicy const ( - Adjust EventsOutOfOrderPolicy = original.Adjust - Drop EventsOutOfOrderPolicy = original.Drop + EventsOutOfOrderPolicyAdjust EventsOutOfOrderPolicy = original.EventsOutOfOrderPolicyAdjust + EventsOutOfOrderPolicyDrop EventsOutOfOrderPolicy = original.EventsOutOfOrderPolicyDrop ) type JSONOutputSerializationFormat = original.JSONOutputSerializationFormat const ( - Array JSONOutputSerializationFormat = original.Array - LineSeparated JSONOutputSerializationFormat = original.LineSeparated + JSONOutputSerializationFormatArray JSONOutputSerializationFormat = original.JSONOutputSerializationFormatArray + JSONOutputSerializationFormatLineSeparated JSONOutputSerializationFormat = original.JSONOutputSerializationFormatLineSeparated +) + +type JobState = original.JobState + +const ( + JobStateCreated JobState = original.JobStateCreated + JobStateDegraded JobState = original.JobStateDegraded + JobStateDeleting JobState = original.JobStateDeleting + JobStateFailed JobState = original.JobStateFailed + JobStateRestarting JobState = original.JobStateRestarting + JobStateRunning JobState = original.JobStateRunning + JobStateScaling JobState = original.JobStateScaling + JobStateStarting JobState = original.JobStateStarting + JobStateStopped JobState = original.JobStateStopped + JobStateStopping JobState = original.JobStateStopping +) + +type JobType = original.JobType + +const ( + JobTypeCloud JobType = original.JobTypeCloud + JobTypeEdge JobType = original.JobTypeEdge ) type OutputErrorPolicy = original.OutputErrorPolicy @@ -63,15 +133,23 @@ const ( type OutputStartMode = original.OutputStartMode const ( - CustomTime OutputStartMode = original.CustomTime - JobStartTime OutputStartMode = original.JobStartTime - LastOutputEventTime OutputStartMode = original.LastOutputEventTime + OutputStartModeCustomTime OutputStartMode = original.OutputStartModeCustomTime + OutputStartModeJobStartTime OutputStartMode = original.OutputStartModeJobStartTime + OutputStartModeLastOutputEventTime OutputStartMode = original.OutputStartModeLastOutputEventTime +) + +type RefreshType = original.RefreshType + +const ( + RefreshTypeRefreshPeriodicallyWithDelta RefreshType = original.RefreshTypeRefreshPeriodicallyWithDelta + RefreshTypeRefreshPeriodicallyWithFull RefreshType = original.RefreshTypeRefreshPeriodicallyWithFull + RefreshTypeStatic RefreshType = original.RefreshTypeStatic ) type SkuName = original.SkuName const ( - Standard SkuName = original.Standard + SkuNameStandard SkuName = original.SkuNameStandard ) type Type = original.Type @@ -80,58 +158,63 @@ const ( TypeAvro Type = original.TypeAvro TypeCsv Type = original.TypeCsv TypeJSON Type = original.TypeJSON + TypeParquet Type = original.TypeParquet TypeSerialization Type = original.TypeSerialization ) type TypeBasicFunctionBinding = original.TypeBasicFunctionBinding const ( - TypeFunctionBinding TypeBasicFunctionBinding = original.TypeFunctionBinding - TypeMicrosoftMachineLearningWebService TypeBasicFunctionBinding = original.TypeMicrosoftMachineLearningWebService - TypeMicrosoftStreamAnalyticsJavascriptUdf TypeBasicFunctionBinding = original.TypeMicrosoftStreamAnalyticsJavascriptUdf + TypeBasicFunctionBindingTypeFunctionBinding TypeBasicFunctionBinding = original.TypeBasicFunctionBindingTypeFunctionBinding + TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService TypeBasicFunctionBinding = original.TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService + TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf TypeBasicFunctionBinding = original.TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf ) type TypeBasicFunctionProperties = original.TypeBasicFunctionProperties const ( - TypeFunctionProperties TypeBasicFunctionProperties = original.TypeFunctionProperties - TypeScalar TypeBasicFunctionProperties = original.TypeScalar + TypeBasicFunctionPropertiesTypeFunctionProperties TypeBasicFunctionProperties = original.TypeBasicFunctionPropertiesTypeFunctionProperties + TypeBasicFunctionPropertiesTypeScalar TypeBasicFunctionProperties = original.TypeBasicFunctionPropertiesTypeScalar ) type TypeBasicInputProperties = original.TypeBasicInputProperties const ( - TypeInputProperties TypeBasicInputProperties = original.TypeInputProperties - TypeReference TypeBasicInputProperties = original.TypeReference - TypeStream TypeBasicInputProperties = original.TypeStream + TypeBasicInputPropertiesTypeInputProperties TypeBasicInputProperties = original.TypeBasicInputPropertiesTypeInputProperties + TypeBasicInputPropertiesTypeReference TypeBasicInputProperties = original.TypeBasicInputPropertiesTypeReference + TypeBasicInputPropertiesTypeStream TypeBasicInputProperties = original.TypeBasicInputPropertiesTypeStream ) type TypeBasicOutputDataSource = original.TypeBasicOutputDataSource const ( - TypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = original.TypeMicrosoftDataLakeAccounts - TypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = original.TypeMicrosoftServiceBusEventHub - TypeMicrosoftServiceBusQueue TypeBasicOutputDataSource = original.TypeMicrosoftServiceBusQueue - TypeMicrosoftServiceBusTopic TypeBasicOutputDataSource = original.TypeMicrosoftServiceBusTopic - TypeMicrosoftSQLServerDatabase TypeBasicOutputDataSource = original.TypeMicrosoftSQLServerDatabase - TypeMicrosoftStorageBlob TypeBasicOutputDataSource = original.TypeMicrosoftStorageBlob - TypeMicrosoftStorageDocumentDB TypeBasicOutputDataSource = original.TypeMicrosoftStorageDocumentDB - TypeMicrosoftStorageTable TypeBasicOutputDataSource = original.TypeMicrosoftStorageTable - TypeOutputDataSource TypeBasicOutputDataSource = original.TypeOutputDataSource - TypePowerBI TypeBasicOutputDataSource = original.TypePowerBI + TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts + TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub + TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub + TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue + TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic + TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase + TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse + TypeBasicOutputDataSourceTypeMicrosoftStorageBlob TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftStorageBlob + TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB + TypeBasicOutputDataSourceTypeMicrosoftStorageTable TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftStorageTable + TypeBasicOutputDataSourceTypeOutputDataSource TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeOutputDataSource + TypeBasicOutputDataSourceTypePowerBI TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypePowerBI ) type TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSource const ( - TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob - TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource + TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase + TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob + TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource ) type TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSource const ( TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs + TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob TypeBasicStreamInputDataSourceTypeStreamInputDataSource TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeStreamInputDataSource @@ -140,7 +223,7 @@ const ( type UdfType = original.UdfType const ( - Scalar UdfType = original.Scalar + UdfTypeScalar UdfType = original.UdfTypeScalar ) type AvroSerialization = original.AvroSerialization @@ -156,6 +239,11 @@ type AzureMachineLearningWebServiceOutputColumn = original.AzureMachineLearningW type AzureSQLDatabaseDataSourceProperties = original.AzureSQLDatabaseDataSourceProperties type AzureSQLDatabaseOutputDataSource = original.AzureSQLDatabaseOutputDataSource type AzureSQLDatabaseOutputDataSourceProperties = original.AzureSQLDatabaseOutputDataSourceProperties +type AzureSQLReferenceInputDataSource = original.AzureSQLReferenceInputDataSource +type AzureSQLReferenceInputDataSourceProperties = original.AzureSQLReferenceInputDataSourceProperties +type AzureSynapseDataSourceProperties = original.AzureSynapseDataSourceProperties +type AzureSynapseOutputDataSource = original.AzureSynapseOutputDataSource +type AzureSynapseOutputDataSourceProperties = original.AzureSynapseOutputDataSourceProperties type AzureTableOutputDataSource = original.AzureTableOutputDataSource type AzureTableOutputDataSourceProperties = original.AzureTableOutputDataSourceProperties type BaseClient = original.BaseClient @@ -174,18 +262,39 @@ type BlobReferenceInputDataSource = original.BlobReferenceInputDataSource type BlobReferenceInputDataSourceProperties = original.BlobReferenceInputDataSourceProperties type BlobStreamInputDataSource = original.BlobStreamInputDataSource type BlobStreamInputDataSourceProperties = original.BlobStreamInputDataSourceProperties +type Cluster = original.Cluster +type ClusterInfo = original.ClusterInfo +type ClusterJob = original.ClusterJob +type ClusterJobListResult = original.ClusterJobListResult +type ClusterJobListResultIterator = original.ClusterJobListResultIterator +type ClusterJobListResultPage = original.ClusterJobListResultPage +type ClusterListResult = original.ClusterListResult +type ClusterListResultIterator = original.ClusterListResultIterator +type ClusterListResultPage = original.ClusterListResultPage +type ClusterProperties = original.ClusterProperties +type ClusterSku = original.ClusterSku +type ClustersClient = original.ClustersClient +type ClustersCreateOrUpdateFuture = original.ClustersCreateOrUpdateFuture +type ClustersDeleteFuture = original.ClustersDeleteFuture +type ClustersUpdateFuture = original.ClustersUpdateFuture +type Compression = original.Compression type CsvSerialization = original.CsvSerialization type CsvSerializationProperties = original.CsvSerializationProperties type DiagnosticCondition = original.DiagnosticCondition type Diagnostics = original.Diagnostics type DocumentDbOutputDataSource = original.DocumentDbOutputDataSource type DocumentDbOutputDataSourceProperties = original.DocumentDbOutputDataSourceProperties +type Error = original.Error +type ErrorDetails = original.ErrorDetails +type ErrorError = original.ErrorError type ErrorResponse = original.ErrorResponse type EventHubDataSourceProperties = original.EventHubDataSourceProperties type EventHubOutputDataSource = original.EventHubOutputDataSource type EventHubOutputDataSourceProperties = original.EventHubOutputDataSourceProperties type EventHubStreamInputDataSource = original.EventHubStreamInputDataSource type EventHubStreamInputDataSourceProperties = original.EventHubStreamInputDataSourceProperties +type EventHubV2OutputDataSource = original.EventHubV2OutputDataSource +type EventHubV2StreamInputDataSource = original.EventHubV2StreamInputDataSource type Function = original.Function type FunctionBinding = original.FunctionBinding type FunctionInput = original.FunctionInput @@ -197,6 +306,7 @@ type FunctionProperties = original.FunctionProperties type FunctionRetrieveDefaultDefinitionParameters = original.FunctionRetrieveDefaultDefinitionParameters type FunctionsClient = original.FunctionsClient type FunctionsTestFuture = original.FunctionsTestFuture +type Identity = original.Identity type Input = original.Input type InputListResult = original.InputListResult type InputListResultIterator = original.InputListResultIterator @@ -212,6 +322,7 @@ type JavaScriptFunctionBinding = original.JavaScriptFunctionBinding type JavaScriptFunctionBindingProperties = original.JavaScriptFunctionBindingProperties type JavaScriptFunctionBindingRetrievalProperties = original.JavaScriptFunctionBindingRetrievalProperties type JavaScriptFunctionRetrieveDefaultDefinitionParameters = original.JavaScriptFunctionRetrieveDefaultDefinitionParameters +type JobStorageAccount = original.JobStorageAccount type OAuthBasedDataSourceProperties = original.OAuthBasedDataSourceProperties type Operation = original.Operation type OperationDisplay = original.OperationDisplay @@ -227,14 +338,27 @@ type OutputListResultPage = original.OutputListResultPage type OutputProperties = original.OutputProperties type OutputsClient = original.OutputsClient type OutputsTestFuture = original.OutputsTestFuture +type ParquetSerialization = original.ParquetSerialization type PowerBIOutputDataSource = original.PowerBIOutputDataSource type PowerBIOutputDataSourceProperties = original.PowerBIOutputDataSourceProperties +type PrivateEndpoint = original.PrivateEndpoint +type PrivateEndpointListResult = original.PrivateEndpointListResult +type PrivateEndpointListResultIterator = original.PrivateEndpointListResultIterator +type PrivateEndpointListResultPage = original.PrivateEndpointListResultPage +type PrivateEndpointProperties = original.PrivateEndpointProperties +type PrivateEndpointsClient = original.PrivateEndpointsClient +type PrivateEndpointsDeleteFuture = original.PrivateEndpointsDeleteFuture +type PrivateLinkConnectionState = original.PrivateLinkConnectionState +type PrivateLinkServiceConnection = original.PrivateLinkServiceConnection +type PrivateLinkServiceConnectionProperties = original.PrivateLinkServiceConnectionProperties +type ProxyResource = original.ProxyResource type ReferenceInputDataSource = original.ReferenceInputDataSource type ReferenceInputProperties = original.ReferenceInputProperties type Resource = original.Resource type ResourceTestStatus = original.ResourceTestStatus type ScalarFunctionConfiguration = original.ScalarFunctionConfiguration type ScalarFunctionProperties = original.ScalarFunctionProperties +type ScaleStreamingJobParameters = original.ScaleStreamingJobParameters type Serialization = original.Serialization type ServiceBusDataSourceProperties = original.ServiceBusDataSourceProperties type ServiceBusQueueOutputDataSource = original.ServiceBusQueueOutputDataSource @@ -254,6 +378,7 @@ type StreamingJobProperties = original.StreamingJobProperties type StreamingJobsClient = original.StreamingJobsClient type StreamingJobsCreateOrReplaceFuture = original.StreamingJobsCreateOrReplaceFuture type StreamingJobsDeleteFuture = original.StreamingJobsDeleteFuture +type StreamingJobsScaleFuture = original.StreamingJobsScaleFuture type StreamingJobsStartFuture = original.StreamingJobsStartFuture type StreamingJobsStopFuture = original.StreamingJobsStopFuture type SubResource = original.SubResource @@ -261,6 +386,7 @@ type SubscriptionQuota = original.SubscriptionQuota type SubscriptionQuotaProperties = original.SubscriptionQuotaProperties type SubscriptionQuotasListResult = original.SubscriptionQuotasListResult type SubscriptionsClient = original.SubscriptionsClient +type TrackedResource = original.TrackedResource type Transformation = original.Transformation type TransformationProperties = original.TransformationProperties type TransformationsClient = original.TransformationsClient @@ -268,6 +394,24 @@ type TransformationsClient = original.TransformationsClient func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewClusterJobListResultIterator(page ClusterJobListResultPage) ClusterJobListResultIterator { + return original.NewClusterJobListResultIterator(page) +} +func NewClusterJobListResultPage(cur ClusterJobListResult, getNextPage func(context.Context, ClusterJobListResult) (ClusterJobListResult, error)) ClusterJobListResultPage { + return original.NewClusterJobListResultPage(cur, getNextPage) +} +func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { + return original.NewClusterListResultIterator(page) +} +func NewClusterListResultPage(cur ClusterListResult, getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { + return original.NewClusterListResultPage(cur, getNextPage) +} +func NewClustersClient(subscriptionID string) ClustersClient { + return original.NewClustersClient(subscriptionID) +} +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return original.NewClustersClientWithBaseURI(baseURI, subscriptionID) +} func NewFunctionListResultIterator(page FunctionListResultPage) FunctionListResultIterator { return original.NewFunctionListResultIterator(page) } @@ -316,6 +460,18 @@ func NewOutputsClient(subscriptionID string) OutputsClient { func NewOutputsClientWithBaseURI(baseURI string, subscriptionID string) OutputsClient { return original.NewOutputsClientWithBaseURI(baseURI, subscriptionID) } +func NewPrivateEndpointListResultIterator(page PrivateEndpointListResultPage) PrivateEndpointListResultIterator { + return original.NewPrivateEndpointListResultIterator(page) +} +func NewPrivateEndpointListResultPage(cur PrivateEndpointListResult, getNextPage func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error)) PrivateEndpointListResultPage { + return original.NewPrivateEndpointListResultPage(cur, getNextPage) +} +func NewPrivateEndpointsClient(subscriptionID string) PrivateEndpointsClient { + return original.NewPrivateEndpointsClient(subscriptionID) +} +func NewPrivateEndpointsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointsClient { + return original.NewPrivateEndpointsClientWithBaseURI(baseURI, subscriptionID) +} func NewStreamingJobListResultIterator(page StreamingJobListResultPage) StreamingJobListResultIterator { return original.NewStreamingJobListResultIterator(page) } @@ -343,27 +499,54 @@ func NewTransformationsClientWithBaseURI(baseURI string, subscriptionID string) func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleAuthenticationModeValues() []AuthenticationMode { + return original.PossibleAuthenticationModeValues() +} func PossibleBindingTypeValues() []BindingType { return original.PossibleBindingTypeValues() } +func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { + return original.PossibleClusterProvisioningStateValues() +} +func PossibleClusterSkuNameValues() []ClusterSkuName { + return original.PossibleClusterSkuNameValues() +} func PossibleCompatibilityLevelValues() []CompatibilityLevel { return original.PossibleCompatibilityLevelValues() } +func PossibleCompressionTypeValues() []CompressionType { + return original.PossibleCompressionTypeValues() +} +func PossibleContentStoragePolicyValues() []ContentStoragePolicy { + return original.PossibleContentStoragePolicyValues() +} func PossibleEncodingValues() []Encoding { return original.PossibleEncodingValues() } +func PossibleEventSerializationTypeValues() []EventSerializationType { + return original.PossibleEventSerializationTypeValues() +} func PossibleEventsOutOfOrderPolicyValues() []EventsOutOfOrderPolicy { return original.PossibleEventsOutOfOrderPolicyValues() } func PossibleJSONOutputSerializationFormatValues() []JSONOutputSerializationFormat { return original.PossibleJSONOutputSerializationFormatValues() } +func PossibleJobStateValues() []JobState { + return original.PossibleJobStateValues() +} +func PossibleJobTypeValues() []JobType { + return original.PossibleJobTypeValues() +} func PossibleOutputErrorPolicyValues() []OutputErrorPolicy { return original.PossibleOutputErrorPolicyValues() } func PossibleOutputStartModeValues() []OutputStartMode { return original.PossibleOutputStartModeValues() } +func PossibleRefreshTypeValues() []RefreshType { + return original.PossibleRefreshTypeValues() +} func PossibleSkuNameValues() []SkuName { return original.PossibleSkuNameValues() } diff --git a/profiles/latest/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go b/profiles/latest/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go index e41169439160..da8a7c5b9d46 100644 --- a/profiles/latest/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go +++ b/profiles/latest/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go @@ -9,12 +9,14 @@ package streamanalyticsapi -import original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2016-03-01/streamanalytics/streamanalyticsapi" +import original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamanalyticsapi" +type ClustersClientAPI = original.ClustersClientAPI type FunctionsClientAPI = original.FunctionsClientAPI type InputsClientAPI = original.InputsClientAPI type OperationsClientAPI = original.OperationsClientAPI type OutputsClientAPI = original.OutputsClientAPI +type PrivateEndpointsClientAPI = original.PrivateEndpointsClientAPI type StreamingJobsClientAPI = original.StreamingJobsClientAPI type SubscriptionsClientAPI = original.SubscriptionsClientAPI type TransformationsClientAPI = original.TransformationsClientAPI diff --git a/profiles/preview/notificationhubs/mgmt/notificationhubs/models.go b/profiles/preview/notificationhubs/mgmt/notificationhubs/models.go index ff673fb353a4..c02671e9fa1e 100644 --- a/profiles/preview/notificationhubs/mgmt/notificationhubs/models.go +++ b/profiles/preview/notificationhubs/mgmt/notificationhubs/models.go @@ -22,24 +22,24 @@ const ( type AccessRights = original.AccessRights const ( - Listen AccessRights = original.Listen - Manage AccessRights = original.Manage - SendEnumValue AccessRights = original.SendEnumValue + AccessRightsListen AccessRights = original.AccessRightsListen + AccessRightsManage AccessRights = original.AccessRightsManage + AccessRightsSend AccessRights = original.AccessRightsSend ) type NamespaceType = original.NamespaceType const ( - Messaging NamespaceType = original.Messaging - NotificationHub NamespaceType = original.NotificationHub + NamespaceTypeMessaging NamespaceType = original.NamespaceTypeMessaging + NamespaceTypeNotificationHub NamespaceType = original.NamespaceTypeNotificationHub ) type SkuName = original.SkuName const ( - Basic SkuName = original.Basic - Free SkuName = original.Free - Standard SkuName = original.Standard + SkuNameBasic SkuName = original.SkuNameBasic + SkuNameFree SkuName = original.SkuNameFree + SkuNameStandard SkuName = original.SkuNameStandard ) type AdmCredential = original.AdmCredential diff --git a/profiles/preview/preview/monitor/mgmt/insights/insightsapi/models.go b/profiles/preview/preview/monitor/mgmt/insights/insightsapi/models.go index f4468d2d12c8..6aa608f155c9 100644 --- a/profiles/preview/preview/monitor/mgmt/insights/insightsapi/models.go +++ b/profiles/preview/preview/monitor/mgmt/insights/insightsapi/models.go @@ -9,7 +9,7 @@ package insightsapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights/insightsapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights/insightsapi" type ActionGroupsClientAPI = original.ActionGroupsClientAPI type ActivityLogAlertsClientAPI = original.ActivityLogAlertsClientAPI diff --git a/profiles/preview/preview/monitor/mgmt/insights/models.go b/profiles/preview/preview/monitor/mgmt/insights/models.go index b232ba4cfdad..597224555ead 100644 --- a/profiles/preview/preview/monitor/mgmt/insights/models.go +++ b/profiles/preview/preview/monitor/mgmt/insights/models.go @@ -12,7 +12,7 @@ package insights import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-07-01-preview/insights" + original "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights" ) const ( @@ -394,7 +394,6 @@ const ( OperatorGreaterThanOrEqual Operator = original.OperatorGreaterThanOrEqual OperatorLessThan Operator = original.OperatorLessThan OperatorLessThanOrEqual Operator = original.OperatorLessThanOrEqual - OperatorNotEquals Operator = original.OperatorNotEquals ) type ProvisioningState = original.ProvisioningState @@ -486,12 +485,14 @@ const ( ) type Action = original.Action +type ActionDetail = original.ActionDetail type ActionGroup = original.ActionGroup type ActionGroupList = original.ActionGroupList type ActionGroupPatch = original.ActionGroupPatch type ActionGroupPatchBody = original.ActionGroupPatchBody type ActionGroupResource = original.ActionGroupResource type ActionGroupsClient = original.ActionGroupsClient +type ActionGroupsPostTestNotificationsFuture = original.ActionGroupsPostTestNotificationsFuture type ActionList = original.ActionList type ActivityLogAlertResource = original.ActivityLogAlertResource type ActivityLogAlertsClient = original.ActivityLogAlertsClient @@ -543,6 +544,7 @@ type BasicRuleAction = original.BasicRuleAction type BasicRuleCondition = original.BasicRuleCondition type BasicRuleDataSource = original.BasicRuleDataSource type ConfigurationAccessEndpointSpec = original.ConfigurationAccessEndpointSpec +type Context = original.Context type Criteria = original.Criteria type DataCollectionEndpoint = original.DataCollectionEndpoint type DataCollectionEndpointConfigurationAccess = original.DataCollectionEndpointConfigurationAccess @@ -605,6 +607,7 @@ type EventData = original.EventData type EventDataCollection = original.EventDataCollection type EventDataCollectionIterator = original.EventDataCollectionIterator type EventDataCollectionPage = original.EventDataCollectionPage +type EventHubReceiver = original.EventHubReceiver type ExtensionDataSource = original.ExtensionDataSource type HTTPRequestInfo = original.HTTPRequestInfo type Incident = original.Incident @@ -665,6 +668,7 @@ type MetricValue = original.MetricValue type MetricsClient = original.MetricsClient type MultiMetricCriteria = original.MultiMetricCriteria type NetworkRuleSet = original.NetworkRuleSet +type NotificationRequestBody = original.NotificationRequestBody type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -731,6 +735,8 @@ type SyslogDataSource = original.SyslogDataSource type SystemData = original.SystemData type TagsResource = original.TagsResource type TenantActivityLogsClient = original.TenantActivityLogsClient +type TestNotificationDetailsResponse = original.TestNotificationDetailsResponse +type TestNotificationResponse = original.TestNotificationResponse type ThresholdRuleCondition = original.ThresholdRuleCondition type TimeSeriesBaseline = original.TimeSeriesBaseline type TimeSeriesElement = original.TimeSeriesElement diff --git a/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go b/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go index 98eaa53a9e8b..6739f9b78fa2 100644 --- a/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go +++ b/profiles/preview/streamanalytics/mgmt/streamanalytics/models.go @@ -12,13 +12,21 @@ package streamanalytics import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2016-03-01/streamanalytics" + original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics" ) const ( DefaultBaseURI = original.DefaultBaseURI ) +type AuthenticationMode = original.AuthenticationMode + +const ( + AuthenticationModeConnectionString AuthenticationMode = original.AuthenticationModeConnectionString + AuthenticationModeMsi AuthenticationMode = original.AuthenticationModeMsi + AuthenticationModeUserToken AuthenticationMode = original.AuthenticationModeUserToken +) + type BindingType = original.BindingType const ( @@ -27,30 +35,92 @@ const ( BindingTypeMicrosoftStreamAnalyticsJavascriptUdf BindingType = original.BindingTypeMicrosoftStreamAnalyticsJavascriptUdf ) +type ClusterProvisioningState = original.ClusterProvisioningState + +const ( + ClusterProvisioningStateCanceled ClusterProvisioningState = original.ClusterProvisioningStateCanceled + ClusterProvisioningStateFailed ClusterProvisioningState = original.ClusterProvisioningStateFailed + ClusterProvisioningStateInProgress ClusterProvisioningState = original.ClusterProvisioningStateInProgress + ClusterProvisioningStateSucceeded ClusterProvisioningState = original.ClusterProvisioningStateSucceeded +) + +type ClusterSkuName = original.ClusterSkuName + +const ( + ClusterSkuNameDefault ClusterSkuName = original.ClusterSkuNameDefault +) + type CompatibilityLevel = original.CompatibilityLevel const ( - OneFullStopZero CompatibilityLevel = original.OneFullStopZero + CompatibilityLevelOneFullStopTwo CompatibilityLevel = original.CompatibilityLevelOneFullStopTwo + CompatibilityLevelOneFullStopZero CompatibilityLevel = original.CompatibilityLevelOneFullStopZero +) + +type CompressionType = original.CompressionType + +const ( + CompressionTypeDeflate CompressionType = original.CompressionTypeDeflate + CompressionTypeGZip CompressionType = original.CompressionTypeGZip + CompressionTypeNone CompressionType = original.CompressionTypeNone +) + +type ContentStoragePolicy = original.ContentStoragePolicy + +const ( + ContentStoragePolicyJobStorageAccount ContentStoragePolicy = original.ContentStoragePolicyJobStorageAccount + ContentStoragePolicySystemAccount ContentStoragePolicy = original.ContentStoragePolicySystemAccount ) type Encoding = original.Encoding const ( - UTF8 Encoding = original.UTF8 + EncodingUTF8 Encoding = original.EncodingUTF8 +) + +type EventSerializationType = original.EventSerializationType + +const ( + EventSerializationTypeAvro EventSerializationType = original.EventSerializationTypeAvro + EventSerializationTypeCsv EventSerializationType = original.EventSerializationTypeCsv + EventSerializationTypeJSON EventSerializationType = original.EventSerializationTypeJSON + EventSerializationTypeParquet EventSerializationType = original.EventSerializationTypeParquet ) type EventsOutOfOrderPolicy = original.EventsOutOfOrderPolicy const ( - Adjust EventsOutOfOrderPolicy = original.Adjust - Drop EventsOutOfOrderPolicy = original.Drop + EventsOutOfOrderPolicyAdjust EventsOutOfOrderPolicy = original.EventsOutOfOrderPolicyAdjust + EventsOutOfOrderPolicyDrop EventsOutOfOrderPolicy = original.EventsOutOfOrderPolicyDrop ) type JSONOutputSerializationFormat = original.JSONOutputSerializationFormat const ( - Array JSONOutputSerializationFormat = original.Array - LineSeparated JSONOutputSerializationFormat = original.LineSeparated + JSONOutputSerializationFormatArray JSONOutputSerializationFormat = original.JSONOutputSerializationFormatArray + JSONOutputSerializationFormatLineSeparated JSONOutputSerializationFormat = original.JSONOutputSerializationFormatLineSeparated +) + +type JobState = original.JobState + +const ( + JobStateCreated JobState = original.JobStateCreated + JobStateDegraded JobState = original.JobStateDegraded + JobStateDeleting JobState = original.JobStateDeleting + JobStateFailed JobState = original.JobStateFailed + JobStateRestarting JobState = original.JobStateRestarting + JobStateRunning JobState = original.JobStateRunning + JobStateScaling JobState = original.JobStateScaling + JobStateStarting JobState = original.JobStateStarting + JobStateStopped JobState = original.JobStateStopped + JobStateStopping JobState = original.JobStateStopping +) + +type JobType = original.JobType + +const ( + JobTypeCloud JobType = original.JobTypeCloud + JobTypeEdge JobType = original.JobTypeEdge ) type OutputErrorPolicy = original.OutputErrorPolicy @@ -63,15 +133,23 @@ const ( type OutputStartMode = original.OutputStartMode const ( - CustomTime OutputStartMode = original.CustomTime - JobStartTime OutputStartMode = original.JobStartTime - LastOutputEventTime OutputStartMode = original.LastOutputEventTime + OutputStartModeCustomTime OutputStartMode = original.OutputStartModeCustomTime + OutputStartModeJobStartTime OutputStartMode = original.OutputStartModeJobStartTime + OutputStartModeLastOutputEventTime OutputStartMode = original.OutputStartModeLastOutputEventTime +) + +type RefreshType = original.RefreshType + +const ( + RefreshTypeRefreshPeriodicallyWithDelta RefreshType = original.RefreshTypeRefreshPeriodicallyWithDelta + RefreshTypeRefreshPeriodicallyWithFull RefreshType = original.RefreshTypeRefreshPeriodicallyWithFull + RefreshTypeStatic RefreshType = original.RefreshTypeStatic ) type SkuName = original.SkuName const ( - Standard SkuName = original.Standard + SkuNameStandard SkuName = original.SkuNameStandard ) type Type = original.Type @@ -80,58 +158,63 @@ const ( TypeAvro Type = original.TypeAvro TypeCsv Type = original.TypeCsv TypeJSON Type = original.TypeJSON + TypeParquet Type = original.TypeParquet TypeSerialization Type = original.TypeSerialization ) type TypeBasicFunctionBinding = original.TypeBasicFunctionBinding const ( - TypeFunctionBinding TypeBasicFunctionBinding = original.TypeFunctionBinding - TypeMicrosoftMachineLearningWebService TypeBasicFunctionBinding = original.TypeMicrosoftMachineLearningWebService - TypeMicrosoftStreamAnalyticsJavascriptUdf TypeBasicFunctionBinding = original.TypeMicrosoftStreamAnalyticsJavascriptUdf + TypeBasicFunctionBindingTypeFunctionBinding TypeBasicFunctionBinding = original.TypeBasicFunctionBindingTypeFunctionBinding + TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService TypeBasicFunctionBinding = original.TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService + TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf TypeBasicFunctionBinding = original.TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf ) type TypeBasicFunctionProperties = original.TypeBasicFunctionProperties const ( - TypeFunctionProperties TypeBasicFunctionProperties = original.TypeFunctionProperties - TypeScalar TypeBasicFunctionProperties = original.TypeScalar + TypeBasicFunctionPropertiesTypeFunctionProperties TypeBasicFunctionProperties = original.TypeBasicFunctionPropertiesTypeFunctionProperties + TypeBasicFunctionPropertiesTypeScalar TypeBasicFunctionProperties = original.TypeBasicFunctionPropertiesTypeScalar ) type TypeBasicInputProperties = original.TypeBasicInputProperties const ( - TypeInputProperties TypeBasicInputProperties = original.TypeInputProperties - TypeReference TypeBasicInputProperties = original.TypeReference - TypeStream TypeBasicInputProperties = original.TypeStream + TypeBasicInputPropertiesTypeInputProperties TypeBasicInputProperties = original.TypeBasicInputPropertiesTypeInputProperties + TypeBasicInputPropertiesTypeReference TypeBasicInputProperties = original.TypeBasicInputPropertiesTypeReference + TypeBasicInputPropertiesTypeStream TypeBasicInputProperties = original.TypeBasicInputPropertiesTypeStream ) type TypeBasicOutputDataSource = original.TypeBasicOutputDataSource const ( - TypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = original.TypeMicrosoftDataLakeAccounts - TypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = original.TypeMicrosoftServiceBusEventHub - TypeMicrosoftServiceBusQueue TypeBasicOutputDataSource = original.TypeMicrosoftServiceBusQueue - TypeMicrosoftServiceBusTopic TypeBasicOutputDataSource = original.TypeMicrosoftServiceBusTopic - TypeMicrosoftSQLServerDatabase TypeBasicOutputDataSource = original.TypeMicrosoftSQLServerDatabase - TypeMicrosoftStorageBlob TypeBasicOutputDataSource = original.TypeMicrosoftStorageBlob - TypeMicrosoftStorageDocumentDB TypeBasicOutputDataSource = original.TypeMicrosoftStorageDocumentDB - TypeMicrosoftStorageTable TypeBasicOutputDataSource = original.TypeMicrosoftStorageTable - TypeOutputDataSource TypeBasicOutputDataSource = original.TypeOutputDataSource - TypePowerBI TypeBasicOutputDataSource = original.TypePowerBI + TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts + TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub + TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub + TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue + TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic + TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase + TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse + TypeBasicOutputDataSourceTypeMicrosoftStorageBlob TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftStorageBlob + TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB + TypeBasicOutputDataSourceTypeMicrosoftStorageTable TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeMicrosoftStorageTable + TypeBasicOutputDataSourceTypeOutputDataSource TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypeOutputDataSource + TypeBasicOutputDataSourceTypePowerBI TypeBasicOutputDataSource = original.TypeBasicOutputDataSourceTypePowerBI ) type TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSource const ( - TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob - TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource + TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase + TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob + TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource TypeBasicReferenceInputDataSource = original.TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource ) type TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSource const ( TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs + TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob TypeBasicStreamInputDataSourceTypeStreamInputDataSource TypeBasicStreamInputDataSource = original.TypeBasicStreamInputDataSourceTypeStreamInputDataSource @@ -140,7 +223,7 @@ const ( type UdfType = original.UdfType const ( - Scalar UdfType = original.Scalar + UdfTypeScalar UdfType = original.UdfTypeScalar ) type AvroSerialization = original.AvroSerialization @@ -156,6 +239,11 @@ type AzureMachineLearningWebServiceOutputColumn = original.AzureMachineLearningW type AzureSQLDatabaseDataSourceProperties = original.AzureSQLDatabaseDataSourceProperties type AzureSQLDatabaseOutputDataSource = original.AzureSQLDatabaseOutputDataSource type AzureSQLDatabaseOutputDataSourceProperties = original.AzureSQLDatabaseOutputDataSourceProperties +type AzureSQLReferenceInputDataSource = original.AzureSQLReferenceInputDataSource +type AzureSQLReferenceInputDataSourceProperties = original.AzureSQLReferenceInputDataSourceProperties +type AzureSynapseDataSourceProperties = original.AzureSynapseDataSourceProperties +type AzureSynapseOutputDataSource = original.AzureSynapseOutputDataSource +type AzureSynapseOutputDataSourceProperties = original.AzureSynapseOutputDataSourceProperties type AzureTableOutputDataSource = original.AzureTableOutputDataSource type AzureTableOutputDataSourceProperties = original.AzureTableOutputDataSourceProperties type BaseClient = original.BaseClient @@ -174,18 +262,39 @@ type BlobReferenceInputDataSource = original.BlobReferenceInputDataSource type BlobReferenceInputDataSourceProperties = original.BlobReferenceInputDataSourceProperties type BlobStreamInputDataSource = original.BlobStreamInputDataSource type BlobStreamInputDataSourceProperties = original.BlobStreamInputDataSourceProperties +type Cluster = original.Cluster +type ClusterInfo = original.ClusterInfo +type ClusterJob = original.ClusterJob +type ClusterJobListResult = original.ClusterJobListResult +type ClusterJobListResultIterator = original.ClusterJobListResultIterator +type ClusterJobListResultPage = original.ClusterJobListResultPage +type ClusterListResult = original.ClusterListResult +type ClusterListResultIterator = original.ClusterListResultIterator +type ClusterListResultPage = original.ClusterListResultPage +type ClusterProperties = original.ClusterProperties +type ClusterSku = original.ClusterSku +type ClustersClient = original.ClustersClient +type ClustersCreateOrUpdateFuture = original.ClustersCreateOrUpdateFuture +type ClustersDeleteFuture = original.ClustersDeleteFuture +type ClustersUpdateFuture = original.ClustersUpdateFuture +type Compression = original.Compression type CsvSerialization = original.CsvSerialization type CsvSerializationProperties = original.CsvSerializationProperties type DiagnosticCondition = original.DiagnosticCondition type Diagnostics = original.Diagnostics type DocumentDbOutputDataSource = original.DocumentDbOutputDataSource type DocumentDbOutputDataSourceProperties = original.DocumentDbOutputDataSourceProperties +type Error = original.Error +type ErrorDetails = original.ErrorDetails +type ErrorError = original.ErrorError type ErrorResponse = original.ErrorResponse type EventHubDataSourceProperties = original.EventHubDataSourceProperties type EventHubOutputDataSource = original.EventHubOutputDataSource type EventHubOutputDataSourceProperties = original.EventHubOutputDataSourceProperties type EventHubStreamInputDataSource = original.EventHubStreamInputDataSource type EventHubStreamInputDataSourceProperties = original.EventHubStreamInputDataSourceProperties +type EventHubV2OutputDataSource = original.EventHubV2OutputDataSource +type EventHubV2StreamInputDataSource = original.EventHubV2StreamInputDataSource type Function = original.Function type FunctionBinding = original.FunctionBinding type FunctionInput = original.FunctionInput @@ -197,6 +306,7 @@ type FunctionProperties = original.FunctionProperties type FunctionRetrieveDefaultDefinitionParameters = original.FunctionRetrieveDefaultDefinitionParameters type FunctionsClient = original.FunctionsClient type FunctionsTestFuture = original.FunctionsTestFuture +type Identity = original.Identity type Input = original.Input type InputListResult = original.InputListResult type InputListResultIterator = original.InputListResultIterator @@ -212,6 +322,7 @@ type JavaScriptFunctionBinding = original.JavaScriptFunctionBinding type JavaScriptFunctionBindingProperties = original.JavaScriptFunctionBindingProperties type JavaScriptFunctionBindingRetrievalProperties = original.JavaScriptFunctionBindingRetrievalProperties type JavaScriptFunctionRetrieveDefaultDefinitionParameters = original.JavaScriptFunctionRetrieveDefaultDefinitionParameters +type JobStorageAccount = original.JobStorageAccount type OAuthBasedDataSourceProperties = original.OAuthBasedDataSourceProperties type Operation = original.Operation type OperationDisplay = original.OperationDisplay @@ -227,14 +338,27 @@ type OutputListResultPage = original.OutputListResultPage type OutputProperties = original.OutputProperties type OutputsClient = original.OutputsClient type OutputsTestFuture = original.OutputsTestFuture +type ParquetSerialization = original.ParquetSerialization type PowerBIOutputDataSource = original.PowerBIOutputDataSource type PowerBIOutputDataSourceProperties = original.PowerBIOutputDataSourceProperties +type PrivateEndpoint = original.PrivateEndpoint +type PrivateEndpointListResult = original.PrivateEndpointListResult +type PrivateEndpointListResultIterator = original.PrivateEndpointListResultIterator +type PrivateEndpointListResultPage = original.PrivateEndpointListResultPage +type PrivateEndpointProperties = original.PrivateEndpointProperties +type PrivateEndpointsClient = original.PrivateEndpointsClient +type PrivateEndpointsDeleteFuture = original.PrivateEndpointsDeleteFuture +type PrivateLinkConnectionState = original.PrivateLinkConnectionState +type PrivateLinkServiceConnection = original.PrivateLinkServiceConnection +type PrivateLinkServiceConnectionProperties = original.PrivateLinkServiceConnectionProperties +type ProxyResource = original.ProxyResource type ReferenceInputDataSource = original.ReferenceInputDataSource type ReferenceInputProperties = original.ReferenceInputProperties type Resource = original.Resource type ResourceTestStatus = original.ResourceTestStatus type ScalarFunctionConfiguration = original.ScalarFunctionConfiguration type ScalarFunctionProperties = original.ScalarFunctionProperties +type ScaleStreamingJobParameters = original.ScaleStreamingJobParameters type Serialization = original.Serialization type ServiceBusDataSourceProperties = original.ServiceBusDataSourceProperties type ServiceBusQueueOutputDataSource = original.ServiceBusQueueOutputDataSource @@ -254,6 +378,7 @@ type StreamingJobProperties = original.StreamingJobProperties type StreamingJobsClient = original.StreamingJobsClient type StreamingJobsCreateOrReplaceFuture = original.StreamingJobsCreateOrReplaceFuture type StreamingJobsDeleteFuture = original.StreamingJobsDeleteFuture +type StreamingJobsScaleFuture = original.StreamingJobsScaleFuture type StreamingJobsStartFuture = original.StreamingJobsStartFuture type StreamingJobsStopFuture = original.StreamingJobsStopFuture type SubResource = original.SubResource @@ -261,6 +386,7 @@ type SubscriptionQuota = original.SubscriptionQuota type SubscriptionQuotaProperties = original.SubscriptionQuotaProperties type SubscriptionQuotasListResult = original.SubscriptionQuotasListResult type SubscriptionsClient = original.SubscriptionsClient +type TrackedResource = original.TrackedResource type Transformation = original.Transformation type TransformationProperties = original.TransformationProperties type TransformationsClient = original.TransformationsClient @@ -268,6 +394,24 @@ type TransformationsClient = original.TransformationsClient func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewClusterJobListResultIterator(page ClusterJobListResultPage) ClusterJobListResultIterator { + return original.NewClusterJobListResultIterator(page) +} +func NewClusterJobListResultPage(cur ClusterJobListResult, getNextPage func(context.Context, ClusterJobListResult) (ClusterJobListResult, error)) ClusterJobListResultPage { + return original.NewClusterJobListResultPage(cur, getNextPage) +} +func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { + return original.NewClusterListResultIterator(page) +} +func NewClusterListResultPage(cur ClusterListResult, getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { + return original.NewClusterListResultPage(cur, getNextPage) +} +func NewClustersClient(subscriptionID string) ClustersClient { + return original.NewClustersClient(subscriptionID) +} +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return original.NewClustersClientWithBaseURI(baseURI, subscriptionID) +} func NewFunctionListResultIterator(page FunctionListResultPage) FunctionListResultIterator { return original.NewFunctionListResultIterator(page) } @@ -316,6 +460,18 @@ func NewOutputsClient(subscriptionID string) OutputsClient { func NewOutputsClientWithBaseURI(baseURI string, subscriptionID string) OutputsClient { return original.NewOutputsClientWithBaseURI(baseURI, subscriptionID) } +func NewPrivateEndpointListResultIterator(page PrivateEndpointListResultPage) PrivateEndpointListResultIterator { + return original.NewPrivateEndpointListResultIterator(page) +} +func NewPrivateEndpointListResultPage(cur PrivateEndpointListResult, getNextPage func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error)) PrivateEndpointListResultPage { + return original.NewPrivateEndpointListResultPage(cur, getNextPage) +} +func NewPrivateEndpointsClient(subscriptionID string) PrivateEndpointsClient { + return original.NewPrivateEndpointsClient(subscriptionID) +} +func NewPrivateEndpointsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointsClient { + return original.NewPrivateEndpointsClientWithBaseURI(baseURI, subscriptionID) +} func NewStreamingJobListResultIterator(page StreamingJobListResultPage) StreamingJobListResultIterator { return original.NewStreamingJobListResultIterator(page) } @@ -343,27 +499,54 @@ func NewTransformationsClientWithBaseURI(baseURI string, subscriptionID string) func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleAuthenticationModeValues() []AuthenticationMode { + return original.PossibleAuthenticationModeValues() +} func PossibleBindingTypeValues() []BindingType { return original.PossibleBindingTypeValues() } +func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { + return original.PossibleClusterProvisioningStateValues() +} +func PossibleClusterSkuNameValues() []ClusterSkuName { + return original.PossibleClusterSkuNameValues() +} func PossibleCompatibilityLevelValues() []CompatibilityLevel { return original.PossibleCompatibilityLevelValues() } +func PossibleCompressionTypeValues() []CompressionType { + return original.PossibleCompressionTypeValues() +} +func PossibleContentStoragePolicyValues() []ContentStoragePolicy { + return original.PossibleContentStoragePolicyValues() +} func PossibleEncodingValues() []Encoding { return original.PossibleEncodingValues() } +func PossibleEventSerializationTypeValues() []EventSerializationType { + return original.PossibleEventSerializationTypeValues() +} func PossibleEventsOutOfOrderPolicyValues() []EventsOutOfOrderPolicy { return original.PossibleEventsOutOfOrderPolicyValues() } func PossibleJSONOutputSerializationFormatValues() []JSONOutputSerializationFormat { return original.PossibleJSONOutputSerializationFormatValues() } +func PossibleJobStateValues() []JobState { + return original.PossibleJobStateValues() +} +func PossibleJobTypeValues() []JobType { + return original.PossibleJobTypeValues() +} func PossibleOutputErrorPolicyValues() []OutputErrorPolicy { return original.PossibleOutputErrorPolicyValues() } func PossibleOutputStartModeValues() []OutputStartMode { return original.PossibleOutputStartModeValues() } +func PossibleRefreshTypeValues() []RefreshType { + return original.PossibleRefreshTypeValues() +} func PossibleSkuNameValues() []SkuName { return original.PossibleSkuNameValues() } diff --git a/profiles/preview/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go b/profiles/preview/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go index e41169439160..da8a7c5b9d46 100644 --- a/profiles/preview/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go +++ b/profiles/preview/streamanalytics/mgmt/streamanalytics/streamanalyticsapi/models.go @@ -9,12 +9,14 @@ package streamanalyticsapi -import original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2016-03-01/streamanalytics/streamanalyticsapi" +import original "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamanalyticsapi" +type ClustersClientAPI = original.ClustersClientAPI type FunctionsClientAPI = original.FunctionsClientAPI type InputsClientAPI = original.InputsClientAPI type OperationsClientAPI = original.OperationsClientAPI type OutputsClientAPI = original.OutputsClientAPI +type PrivateEndpointsClientAPI = original.PrivateEndpointsClientAPI type StreamingJobsClientAPI = original.StreamingJobsClientAPI type SubscriptionsClientAPI = original.SubscriptionsClientAPI type TransformationsClientAPI = original.TransformationsClientAPI diff --git a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md index 52911e4cc5e4..082db3aba3b8 100644 --- a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md +++ b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/CHANGELOG.md @@ -1,2 +1,40 @@ # Change History +## Breaking Changes + +### Removed Constants + +1. AccessRights.Listen +1. AccessRights.Manage +1. AccessRights.SendEnumValue +1. NamespaceType.Messaging +1. NamespaceType.NotificationHub +1. SkuName.Basic +1. SkuName.Free +1. SkuName.Standard + +### Signature Changes + +#### Funcs + +1. NamespacesClient.ListKeys + - Returns + - From: SharedAccessAuthorizationRuleListResult, error + - To: ResourceListKeys, error +1. NamespacesClient.ListKeysResponder + - Returns + - From: SharedAccessAuthorizationRuleListResult, error + - To: ResourceListKeys, error + +## Additive Changes + +### New Constants + +1. AccessRights.AccessRightsListen +1. AccessRights.AccessRightsManage +1. AccessRights.AccessRightsSend +1. NamespaceType.NamespaceTypeMessaging +1. NamespaceType.NamespaceTypeNotificationHub +1. SkuName.SkuNameBasic +1. SkuName.SkuNameFree +1. SkuName.SkuNameStandard diff --git a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json index d7cf0406cf8f..8e3ea6368e90 100644 --- a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json +++ b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/_meta.json @@ -1,11 +1,11 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "81ab10cd9d46a85258b710c6150ec48021c6d202", "readme": "/_/azure-rest-api-specs/specification/notificationhubs/resource-manager/readme.md", "tag": "package-2017-04", "use": "@microsoft.azure/autorest.go@2.1.187", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-04 --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/notificationhubs/resource-manager/readme.md", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2017-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/notificationhubs/resource-manager/readme.md", "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" } } \ No newline at end of file diff --git a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go index 16fa324c5fdb..883ea250dd5a 100644 --- a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go +++ b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/enums.go @@ -10,47 +10,47 @@ package notificationhubs type AccessRights string const ( - // Listen ... - Listen AccessRights = "Listen" - // Manage ... - Manage AccessRights = "Manage" - // SendEnumValue ... - SendEnumValue AccessRights = "Send" + // AccessRightsListen ... + AccessRightsListen AccessRights = "Listen" + // AccessRightsManage ... + AccessRightsManage AccessRights = "Manage" + // AccessRightsSend ... + AccessRightsSend AccessRights = "Send" ) // PossibleAccessRightsValues returns an array of possible values for the AccessRights const type. func PossibleAccessRightsValues() []AccessRights { - return []AccessRights{Listen, Manage, SendEnumValue} + return []AccessRights{AccessRightsListen, AccessRightsManage, AccessRightsSend} } // NamespaceType enumerates the values for namespace type. type NamespaceType string const ( - // Messaging ... - Messaging NamespaceType = "Messaging" - // NotificationHub ... - NotificationHub NamespaceType = "NotificationHub" + // NamespaceTypeMessaging ... + NamespaceTypeMessaging NamespaceType = "Messaging" + // NamespaceTypeNotificationHub ... + NamespaceTypeNotificationHub NamespaceType = "NotificationHub" ) // PossibleNamespaceTypeValues returns an array of possible values for the NamespaceType const type. func PossibleNamespaceTypeValues() []NamespaceType { - return []NamespaceType{Messaging, NotificationHub} + return []NamespaceType{NamespaceTypeMessaging, NamespaceTypeNotificationHub} } // SkuName enumerates the values for sku name. type SkuName string const ( - // Basic ... - Basic SkuName = "Basic" - // Free ... - Free SkuName = "Free" - // Standard ... - Standard SkuName = "Standard" + // SkuNameBasic ... + SkuNameBasic SkuName = "Basic" + // SkuNameFree ... + SkuNameFree SkuName = "Free" + // SkuNameStandard ... + SkuNameStandard SkuName = "Standard" ) // PossibleSkuNameValues returns an array of possible values for the SkuName const type. func PossibleSkuNameValues() []SkuName { - return []SkuName{Basic, Free, Standard} + return []SkuName{SkuNameBasic, SkuNameFree, SkuNameStandard} } diff --git a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go index 59b405bab09f..76d0e1dc36a7 100644 --- a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go +++ b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/models.go @@ -1080,7 +1080,7 @@ type NamespaceProperties struct { Critical *bool `json:"critical,omitempty"` // DataCenter - Data center for the namespace DataCenter *string `json:"dataCenter,omitempty"` - // NamespaceType - The namespace type. Possible values include: 'Messaging', 'NotificationHub' + // NamespaceType - The namespace type. Possible values include: 'NamespaceTypeMessaging', 'NamespaceTypeNotificationHub' NamespaceType NamespaceType `json:"namespaceType,omitempty"` } @@ -2230,7 +2230,7 @@ func (saarr *SharedAccessAuthorizationRuleResource) UnmarshalJSON(body []byte) e // Sku the Sku description for a namespace type Sku struct { - // Name - Name of the notification hub sku. Possible values include: 'Free', 'Basic', 'Standard' + // Name - Name of the notification hub sku. Possible values include: 'SkuNameFree', 'SkuNameBasic', 'SkuNameStandard' Name SkuName `json:"name,omitempty"` // Tier - The tier of particular sku Tier *string `json:"tier,omitempty"` diff --git a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go index c2853866fc29..96e740dcb7b9 100644 --- a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go +++ b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/namespaces.go @@ -945,7 +945,7 @@ func (client NamespacesClient) ListAuthorizationRulesComplete(ctx context.Contex // resourceGroupName - the name of the resource group. // namespaceName - the namespace name. // authorizationRuleName - the connection string of the namespace for the specified authorizationRule. -func (client NamespacesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client NamespacesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result ResourceListKeys, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/NamespacesClient.ListKeys") defer func() { @@ -1008,7 +1008,7 @@ func (client NamespacesClient) ListKeysSender(req *http.Request) (*http.Response // ListKeysResponder handles the response to the ListKeys request. The method always // closes the http.Response Body. -func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result SharedAccessAuthorizationRuleListResult, err error) { +func (client NamespacesClient) ListKeysResponder(resp *http.Response) (result ResourceListKeys, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubsapi/interfaces.go b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubsapi/interfaces.go index 61adf636632e..3e589a6c5979 100644 --- a/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubsapi/interfaces.go +++ b/services/notificationhubs/mgmt/2017-04-01/notificationhubs/notificationhubsapi/interfaces.go @@ -35,7 +35,7 @@ type NamespacesClientAPI interface { ListAllComplete(ctx context.Context) (result notificationhubs.NamespaceListResultIterator, err error) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string) (result notificationhubs.SharedAccessAuthorizationRuleListResultPage, err error) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string) (result notificationhubs.SharedAccessAuthorizationRuleListResultIterator, err error) - ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result notificationhubs.SharedAccessAuthorizationRuleListResult, err error) + ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string) (result notificationhubs.ResourceListKeys, err error) Patch(ctx context.Context, resourceGroupName string, namespaceName string, parameters notificationhubs.NamespacePatchParameters) (result notificationhubs.NamespaceResource, err error) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters notificationhubs.PolicykeyResource) (result notificationhubs.ResourceListKeys, err error) } diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md b/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json b/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json new file mode 100644 index 000000000000..511839dd06a9 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "81ab10cd9d46a85258b710c6150ec48021c6d202", + "readme": "/_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "tag": "package-2021-09", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/monitor/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/actiongroups.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/actiongroups.go new file mode 100644 index 000000000000..50a6561de07c --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/actiongroups.go @@ -0,0 +1,800 @@ +package insights + +// 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" +) + +// ActionGroupsClient is the monitor Management Client +type ActionGroupsClient struct { + BaseClient +} + +// NewActionGroupsClient creates an instance of the ActionGroupsClient client. +func NewActionGroupsClient(subscriptionID string) ActionGroupsClient { + return NewActionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActionGroupsClientWithBaseURI creates an instance of the ActionGroupsClient 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 NewActionGroupsClientWithBaseURI(baseURI string, subscriptionID string) ActionGroupsClient { + return ActionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new action group or update an existing one. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// actionGroupName - the name of the action group. +// actionGroup - the action group to create or use for the update. +func (client ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (result ActionGroupResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: actionGroup, + Constraints: []validation.Constraint{{Target: "actionGroup.ActionGroup", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "actionGroup.ActionGroup.GroupShortName", Name: validation.MaxLength, Rule: 12, Chain: nil}}}, + {Target: "actionGroup.ActionGroup.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ActionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithJSON(actionGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) 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 ActionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ActionGroupResource, 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 delete an action group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// actionGroupName - the name of the action group. +func (client ActionGroupsClient) Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, actionGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ActionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-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.Insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableReceiver enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. +// This operation is only supported for Email or SMS receivers. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// actionGroupName - the name of the action group. +// enableRequest - the receiver to re-enable. +func (client ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.EnableReceiver") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: enableRequest, + Constraints: []validation.Constraint{{Target: "enableRequest.ReceiverName", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "EnableReceiver", err.Error()) + } + + req, err := client.EnableReceiverPreparer(ctx, resourceGroupName, actionGroupName, enableRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", nil, "Failure preparing request") + return + } + + resp, err := client.EnableReceiverSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure sending request") + return + } + + result, err = client.EnableReceiverResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "EnableReceiver", resp, "Failure responding to request") + return + } + + return +} + +// EnableReceiverPreparer prepares the EnableReceiver request. +func (client ActionGroupsClient) EnableReceiverPreparer(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-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.Insights/actionGroups/{actionGroupName}/subscribe", pathParameters), + autorest.WithJSON(enableRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableReceiverSender sends the EnableReceiver request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) EnableReceiverSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableReceiverResponder handles the response to the EnableReceiver request. The method always +// closes the http.Response Body. +func (client ActionGroupsClient) EnableReceiverResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an action group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// actionGroupName - the name of the action group. +func (client ActionGroupsClient) Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result ActionGroupResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, actionGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, actionGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-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.Insights/actionGroups/{actionGroupName}", 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 ActionGroupsClient) 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 ActionGroupsClient) GetResponder(resp *http.Response) (result ActionGroupResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTestNotifications get the test notifications by the notification id +// Parameters: +// notificationID - the notification id +func (client ActionGroupsClient) GetTestNotifications(ctx context.Context, notificationID string) (result TestNotificationDetailsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.GetTestNotifications") + 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}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "GetTestNotifications", err.Error()) + } + + req, err := client.GetTestNotificationsPreparer(ctx, notificationID) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "GetTestNotifications", nil, "Failure preparing request") + return + } + + resp, err := client.GetTestNotificationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "GetTestNotifications", resp, "Failure sending request") + return + } + + result, err = client.GetTestNotificationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "GetTestNotifications", resp, "Failure responding to request") + return + } + + return +} + +// GetTestNotificationsPreparer prepares the GetTestNotifications request. +func (client ActionGroupsClient) GetTestNotificationsPreparer(ctx context.Context, notificationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "notificationId": autorest.Encode("path", notificationID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTestNotificationsSender sends the GetTestNotifications request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) GetTestNotificationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTestNotificationsResponder handles the response to the GetTestNotifications request. The method always +// closes the http.Response Body. +func (client ActionGroupsClient) GetTestNotificationsResponder(resp *http.Response) (result TestNotificationDetailsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get a list of all action groups in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ActionGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ActionGroupList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListByResourceGroup") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ActionGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups", 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 ActionGroupsClient) 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 ActionGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result ActionGroupList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscriptionID get a list of all action groups in a subscription. +func (client ActionGroupsClient) ListBySubscriptionID(ctx context.Context) (result ActionGroupList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.ListBySubscriptionID") + 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}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "ListBySubscriptionID", err.Error()) + } + + req, err := client.ListBySubscriptionIDPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "ListBySubscriptionID", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client ActionGroupsClient) ListBySubscriptionIDPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client ActionGroupsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActionGroupList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PostTestNotifications send test notifications to a set of provided receivers +// Parameters: +// notificationRequest - the notification request body which includes the contact details +func (client ActionGroupsClient) PostTestNotifications(ctx context.Context, notificationRequest NotificationRequestBody) (result ActionGroupsPostTestNotificationsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.PostTestNotifications") + 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: notificationRequest, + Constraints: []validation.Constraint{{Target: "notificationRequest.AlertType", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "notificationRequest.AlertType", Name: validation.MaxLength, Rule: 30, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("insights.ActionGroupsClient", "PostTestNotifications", err.Error()) + } + + req, err := client.PostTestNotificationsPreparer(ctx, notificationRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "PostTestNotifications", nil, "Failure preparing request") + return + } + + result, err = client.PostTestNotificationsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "PostTestNotifications", result.Response(), "Failure sending request") + return + } + + return +} + +// PostTestNotificationsPreparer prepares the PostTestNotifications request. +func (client ActionGroupsClient) PostTestNotificationsPreparer(ctx context.Context, notificationRequest NotificationRequestBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-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}/providers/Microsoft.Insights/createNotifications", pathParameters), + autorest.WithJSON(notificationRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostTestNotificationsSender sends the PostTestNotifications request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) PostTestNotificationsSender(req *http.Request) (future ActionGroupsPostTestNotificationsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PostTestNotificationsResponder handles the response to the PostTestNotifications request. The method always +// closes the http.Response Body. +func (client ActionGroupsClient) PostTestNotificationsResponder(resp *http.Response) (result TestNotificationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing action group's tags. To update other fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// actionGroupName - the name of the action group. +// actionGroupPatch - parameters supplied to the operation. +func (client ActionGroupsClient) Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (result ActionGroupResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActionGroupsClient.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("insights.ActionGroupsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, actionGroupName, actionGroupPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ActionGroupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "actionGroupName": autorest.Encode("path", actionGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-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.Insights/actionGroups/{actionGroupName}", pathParameters), + autorest.WithJSON(actionGroupPatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ActionGroupsClient) 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 ActionGroupsClient) UpdateResponder(resp *http.Response) (result ActionGroupResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/activitylogalerts.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/activitylogalerts.go new file mode 100644 index 000000000000..361db434a6a1 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/activitylogalerts.go @@ -0,0 +1,630 @@ +package insights + +// 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" +) + +// ActivityLogAlertsClient is the monitor Management Client +type ActivityLogAlertsClient struct { + BaseClient +} + +// NewActivityLogAlertsClient creates an instance of the ActivityLogAlertsClient client. +func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient { + return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActivityLogAlertsClientWithBaseURI creates an instance of the ActivityLogAlertsClient 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 NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient { + return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Activity Log Alert rule or update an existing one. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// activityLogAlertName - the name of the Activity Log Alert rule. +// activityLogAlertRule - the Activity Log Alert rule to create or use for the update. +func (client ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource) (result ActivityLogAlertResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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}}}, + {TargetValue: activityLogAlertRule, + Constraints: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "activityLogAlertRule.AlertRuleProperties.Condition", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "activityLogAlertRule.AlertRuleProperties.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "activityLogAlertRule.AlertRuleProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.ActivityLogAlertsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRule) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "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.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlertRule), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 delete an Activity Log Alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// activityLogAlertName - the name of the Activity Log Alert rule. +func (client ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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("insights.ActivityLogAlertsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, activityLogAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ActivityLogAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "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.Insights/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an Activity Log Alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// activityLogAlertName - the name of the Activity Log Alert rule. +func (client ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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("insights.ActivityLogAlertsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, activityLogAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ActivityLogAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "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.Insights/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup get a list of all Activity Log Alert rules in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ActivityLogAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.arl.Response.Response != nil { + sc = result.arl.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("insights.ActivityLogAlertsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.arl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.arl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.arl.hasNextLink() && result.arl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ActivityLogAlertsClient) 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.Insights/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleList, 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 ActivityLogAlertsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AlertRuleList) (result AlertRuleList, err error) { + req, err := lastResults.alertRuleListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "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, "insights.ActivityLogAlertsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ActivityLogAlertsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AlertRuleListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscriptionID get a list of all Activity Log Alert rules in a subscription. +func (client ActivityLogAlertsClient) ListBySubscriptionID(ctx context.Context) (result AlertRuleListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") + defer func() { + sc := -1 + if result.arl.Response.Response != nil { + sc = result.arl.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("insights.ActivityLogAlertsClient", "ListBySubscriptionID", err.Error()) + } + + result.fn = client.listBySubscriptionIDNextResults + req, err := client.ListBySubscriptionIDPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.arl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request") + return + } + + result.arl, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request") + return + } + if result.arl.hasNextLink() && result.arl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request. +func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer(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.Insights/activityLogAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always +// closes the http.Response Body. +func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result AlertRuleList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionIDNextResults retrieves the next set of results, if any. +func (client ActivityLogAlertsClient) listBySubscriptionIDNextResults(ctx context.Context, lastResults AlertRuleList) (result AlertRuleList, err error) { + req, err := lastResults.alertRuleListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "listBySubscriptionIDNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "listBySubscriptionIDNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "listBySubscriptionIDNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionIDComplete enumerates all values, automatically crossing page boundaries as required. +func (client ActivityLogAlertsClient) ListBySubscriptionIDComplete(ctx context.Context) (result AlertRuleListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.ListBySubscriptionID") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscriptionID(ctx) + return +} + +// Update updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule +// tags, and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// activityLogAlertName - the name of the Activity Log Alert rule. +// activityLogAlertRulePatch - parameters supplied to the operation. +func (client ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject) (result ActivityLogAlertResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogAlertsClient.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("insights.ActivityLogAlertsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, activityLogAlertName, activityLogAlertRulePatch) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogAlertsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ActivityLogAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "activityLogAlertName": autorest.Encode("path", activityLogAlertName), + "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.Insights/activityLogAlerts/{activityLogAlertName}", pathParameters), + autorest.WithJSON(activityLogAlertRulePatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ActivityLogAlertsClient) 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 ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/activitylogs.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/activitylogs.go new file mode 100644 index 000000000000..fc6927fa0e16 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/activitylogs.go @@ -0,0 +1,173 @@ +package insights + +// 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" +) + +// ActivityLogsClient is the monitor Management Client +type ActivityLogsClient struct { + BaseClient +} + +// NewActivityLogsClient creates an instance of the ActivityLogsClient client. +func NewActivityLogsClient(subscriptionID string) ActivityLogsClient { + return NewActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewActivityLogsClientWithBaseURI creates an instance of the ActivityLogsClient 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 NewActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogsClient { + return ActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List provides the list of records from the activity logs. +// Parameters: +// filter - reduces the set of data collected.
This argument is required and it also requires at least the +// start date/time.
The **$filter** argument is very restricted and allows only the following patterns.
- +// *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and +// eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.
- *List +// events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le +// '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.
- *List events for a subscription in a +// time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le +// '2014-07-20T04:36:37.6407898Z'.
- *List events for a resource provider*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq +// 'resourceProviderName'.
- *List events for a correlation Id*: $filter=eventTimestamp ge +// '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq +// 'correlationID'.

**NOTE**: No other syntax is allowed. +// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a +// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, +// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, +// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, +// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* +func (client ActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.List") + defer func() { + sc := -1 + if result.edc.Response.Response != nil { + sc = result.edc.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("insights.ActivityLogsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.edc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure sending request") + return + } + + result.edc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "List", resp, "Failure responding to request") + return + } + if result.edc.hasNextLink() && result.edc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", filter), + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values", 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 ActivityLogsClient) 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 ActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 ActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { + req, err := lastResults.eventDataCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "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, "insights.ActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ActivityLogsClient.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, filter, selectParameter) + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/alertruleincidents.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/alertruleincidents.go new file mode 100644 index 000000000000..a7dcd9cba31e --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/alertruleincidents.go @@ -0,0 +1,205 @@ +package insights + +// 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" +) + +// AlertRuleIncidentsClient is the monitor Management Client +type AlertRuleIncidentsClient struct { + BaseClient +} + +// NewAlertRuleIncidentsClient creates an instance of the AlertRuleIncidentsClient client. +func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient { + return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the AlertRuleIncidentsClient 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 NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient { + return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets an incident associated to an alert rule +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// incidentName - the name of the incident to retrieve. +func (client AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName, incidentName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRuleIncidentsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "incidentName": autorest.Encode("path", incidentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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.insights/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAlertRule gets a list of incidents associated to an alert rule +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client AlertRuleIncidentsClient) ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result IncidentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleIncidentsClient.ListByAlertRule") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRuleIncidentsClient", "ListByAlertRule", err.Error()) + } + + req, err := client.ListByAlertRulePreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAlertRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request") + return + } + + result, err = client.ListByAlertRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request") + return + } + + return +} + +// ListByAlertRulePreparer prepares the ListByAlertRule request. +func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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.insights/alertrules/{ruleName}/incidents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always +// closes the http.Response Body. +func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/alertrules.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/alertrules.go new file mode 100644 index 000000000000..888ed122e267 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/alertrules.go @@ -0,0 +1,542 @@ +package insights + +// 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" +) + +// AlertRulesClient is the monitor Management Client +type AlertRulesClient struct { + BaseClient +} + +// NewAlertRulesClient creates an instance of the AlertRulesClient client. +func NewAlertRulesClient(subscriptionID string) AlertRulesClient { + return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient 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 NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { + return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a classic metric alert rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// parameters - the parameters of the rule to create or update. +func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) 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 AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a classic metric alert rule +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AlertRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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.Insights/alertrules/{ruleName}", 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 AlertRulesClient) 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 AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a classic metric alert rule +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result AlertRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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.Insights/alertrules/{ruleName}", 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 AlertRulesClient) 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 AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list the classic metric alert rules within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client AlertRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AlertRuleResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListByResourceGroup") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AlertRulesClient) 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 = "2016-03-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.Insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription list the classic metric alert rules within a subscription. +func (client AlertRulesClient) ListBySubscription(ctx context.Context) (result AlertRuleResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.ListBySubscription") + 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}}}}); err != nil { + return result, validation.NewError("insights.AlertRulesClient", "ListBySubscription", err.Error()) + } + + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client AlertRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListBySubscriptionResponder(resp *http.Response) (result AlertRuleResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// alertRulesResource - parameters supplied to the operation. +func (client AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (result AlertRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.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("insights.AlertRulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, alertRulesResource) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AlertRulesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AlertRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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.Insights/alertrules/{ruleName}", pathParameters), + autorest.WithJSON(alertRulesResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AlertRulesClient) 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 AlertRulesClient) UpdateResponder(resp *http.Response) (result AlertRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/autoscalesettings.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/autoscalesettings.go new file mode 100644 index 000000000000..d9118bd2d049 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/autoscalesettings.go @@ -0,0 +1,627 @@ +package insights + +// 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" +) + +// AutoscaleSettingsClient is the monitor Management Client +type AutoscaleSettingsClient struct { + BaseClient +} + +// NewAutoscaleSettingsClient creates an instance of the AutoscaleSettingsClient client. +func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient { + return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAutoscaleSettingsClientWithBaseURI creates an instance of the AutoscaleSettingsClient 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 NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient { + return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an autoscale setting. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// autoscaleSettingName - the autoscale setting name. +// parameters - parameters supplied to the operation. +func (client AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}}, + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes and autoscale setting +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// autoscaleSettingName - the autoscale setting name. +func (client AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutoscaleSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-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.Insights/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an autoscale setting +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// autoscaleSettingName - the autoscale setting name. +func (client AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, autoscaleSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutoscaleSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-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.Insights/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists the autoscale settings for a resource group +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client AutoscaleSettingsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.asrc.Response.Response != nil { + sc = result.asrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.AutoscaleSettingsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.asrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.asrc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.asrc.hasNextLink() && result.asrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutoscaleSettingsClient) 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 = "2015-04-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.Insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { + req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutoscaleSettingsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutoscaleSettingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 lists the autoscale settings for a subscription +func (client AutoscaleSettingsClient) ListBySubscription(ctx context.Context) (result AutoscaleSettingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.ListBySubscription") + defer func() { + sc := -1 + if result.asrc.Response.Response != nil { + sc = result.asrc.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("insights.AutoscaleSettingsClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.asrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.asrc, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.asrc.hasNextLink() && result.asrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client AutoscaleSettingsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListBySubscriptionResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, 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 AutoscaleSettingsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) { + req, err := lastResults.autoscaleSettingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "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, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutoscaleSettingsClient) ListBySubscriptionComplete(ctx context.Context) (result AutoscaleSettingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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 +} + +// Update updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// autoscaleSettingName - the autoscale setting name. +// autoscaleSettingResource - parameters supplied to the operation. +func (client AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (result AutoscaleSettingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingsClient.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("insights.AutoscaleSettingsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, autoscaleSettingName, autoscaleSettingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.AutoscaleSettingsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AutoscaleSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "autoscaleSettingName": autorest.Encode("path", autoscaleSettingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-04-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.Insights/autoscalesettings/{autoscaleSettingName}", pathParameters), + autorest.WithJSON(autoscaleSettingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client AutoscaleSettingsClient) 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 AutoscaleSettingsClient) UpdateResponder(resp *http.Response) (result AutoscaleSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/baselines.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/baselines.go new file mode 100644 index 000000000000..337ce4d1fa0f --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/baselines.go @@ -0,0 +1,154 @@ +package insights + +// 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" +) + +// BaselinesClient is the monitor Management Client +type BaselinesClient struct { + BaseClient +} + +// NewBaselinesClient creates an instance of the BaselinesClient client. +func NewBaselinesClient(subscriptionID string) BaselinesClient { + return NewBaselinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBaselinesClientWithBaseURI creates an instance of the BaselinesClient 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 NewBaselinesClientWithBaseURI(baseURI string, subscriptionID string) BaselinesClient { + return BaselinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List **Lists the metric baseline values for a resource**. +// Parameters: +// resourceURI - the identifier of the resource. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** +// metricnamespace - metric namespace to query metric definitions for. +// timespan - the timespan of the query. It is a string with the following format +// 'startDateTime_ISO/endDateTime_ISO'. +// interval - the interval (i.e. timegrain) of the query. +// aggregation - the list of aggregation types (comma separated) to retrieve. +// sensitivities - the list of sensitivities (comma separated) to retrieve. +// filter - the **$filter** is used to reduce the set of metric data returned. Example: Metric contains +// metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B +// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' or B = +// 'b2'** This is invalid because the logical or operator cannot separate two different metadata names. - +// Return all time series where A = a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - +// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** +// resultType - allows retrieving only metadata of the baseline. On data request all information is retrieved. +func (client BaselinesClient) List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (result MetricBaselinesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaselinesClient.List") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.BaselinesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceURI, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.BaselinesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BaselinesClient) ListPreparer(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType ResultType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2019-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if len(sensitivities) > 0 { + queryParameters["sensitivities"] = autorest.Encode("query", sensitivities) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricBaselines", 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 BaselinesClient) 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 BaselinesClient) ListResponder(resp *http.Response) (result MetricBaselinesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/client.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/client.go new file mode 100644 index 000000000000..a777181b0785 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/client.go @@ -0,0 +1,41 @@ +// Package insights implements the Azure ARM Insights service API version . +// +// Monitor Management Client +package insights + +// 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 Insights + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Insights. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionendpoints.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionendpoints.go new file mode 100644 index 000000000000..7369932edf27 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionendpoints.go @@ -0,0 +1,636 @@ +package insights + +// 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" +) + +// DataCollectionEndpointsClient is the monitor Management Client +type DataCollectionEndpointsClient struct { + BaseClient +} + +// NewDataCollectionEndpointsClient creates an instance of the DataCollectionEndpointsClient client. +func NewDataCollectionEndpointsClient(subscriptionID string) DataCollectionEndpointsClient { + return NewDataCollectionEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataCollectionEndpointsClientWithBaseURI creates an instance of the DataCollectionEndpointsClient 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 NewDataCollectionEndpointsClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionEndpointsClient { + return DataCollectionEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. +// body - the payload +func (client DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *DataCollectionEndpointResource) (result DataCollectionEndpointResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.Create") + 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}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("insights.DataCollectionEndpointsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, dataCollectionEndpointName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client DataCollectionEndpointsClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *DataCollectionEndpointResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.Etag = 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.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", 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 DataCollectionEndpointsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client DataCollectionEndpointsClient) CreateResponder(resp *http.Response) (result DataCollectionEndpointResource, 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. +// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. +func (client DataCollectionEndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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("insights.DataCollectionEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, dataCollectionEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataCollectionEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, 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. +// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. +func (client DataCollectionEndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result DataCollectionEndpointResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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("insights.DataCollectionEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, dataCollectionEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataCollectionEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) GetResponder(resp *http.Response) (result DataCollectionEndpointResource, 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 DataCollectionEndpointsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataCollectionEndpointResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dcerlr.Response.Response != nil { + sc = result.dcerlr.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("insights.DataCollectionEndpointsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dcerlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dcerlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dcerlr.hasNextLink() && result.dcerlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DataCollectionEndpointsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionEndpoints", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) ListByResourceGroupResponder(resp *http.Response) (result DataCollectionEndpointResourceListResult, 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 DataCollectionEndpointsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DataCollectionEndpointResourceListResult) (result DataCollectionEndpointResourceListResult, err error) { + req, err := lastResults.dataCollectionEndpointResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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, "insights.DataCollectionEndpointsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataCollectionEndpointsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DataCollectionEndpointResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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 DataCollectionEndpointsClient) ListBySubscription(ctx context.Context) (result DataCollectionEndpointResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.ListBySubscription") + defer func() { + sc := -1 + if result.dcerlr.Response.Response != nil { + sc = result.dcerlr.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("insights.DataCollectionEndpointsClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dcerlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dcerlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.dcerlr.hasNextLink() && result.dcerlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DataCollectionEndpointsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) ListBySubscriptionResponder(resp *http.Response) (result DataCollectionEndpointResourceListResult, 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 DataCollectionEndpointsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DataCollectionEndpointResourceListResult) (result DataCollectionEndpointResourceListResult, err error) { + req, err := lastResults.dataCollectionEndpointResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "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, "insights.DataCollectionEndpointsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataCollectionEndpointsClient) ListBySubscriptionComplete(ctx context.Context) (result DataCollectionEndpointResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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 +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionEndpointName - the name of the data collection endpoint. The name is case insensitive. +// body - the payload +func (client DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (result DataCollectionEndpointResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointsClient.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("insights.DataCollectionEndpointsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, dataCollectionEndpointName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionEndpointsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DataCollectionEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *ResourceForUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionEndpointName": autorest.Encode("path", dataCollectionEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}", 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 DataCollectionEndpointsClient) 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 DataCollectionEndpointsClient) UpdateResponder(resp *http.Response) (result DataCollectionEndpointResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionruleassociations.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionruleassociations.go new file mode 100644 index 000000000000..59878dbc8c2f --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionruleassociations.go @@ -0,0 +1,534 @@ +package insights + +// 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" +) + +// DataCollectionRuleAssociationsClient is the monitor Management Client +type DataCollectionRuleAssociationsClient struct { + BaseClient +} + +// NewDataCollectionRuleAssociationsClient creates an instance of the DataCollectionRuleAssociationsClient client. +func NewDataCollectionRuleAssociationsClient(subscriptionID string) DataCollectionRuleAssociationsClient { + return NewDataCollectionRuleAssociationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataCollectionRuleAssociationsClientWithBaseURI creates an instance of the DataCollectionRuleAssociationsClient +// 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 NewDataCollectionRuleAssociationsClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionRuleAssociationsClient { + return DataCollectionRuleAssociationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceURI - the identifier of the resource. +// associationName - the name of the association. The name is case insensitive. +// body - the payload +func (client DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, body *DataCollectionRuleAssociationProxyOnlyResource) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.Create") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceURI, associationName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client DataCollectionRuleAssociationsClient) CreatePreparer(ctx context.Context, resourceURI string, associationName string, body *DataCollectionRuleAssociationProxyOnlyResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "associationName": autorest.Encode("path", associationName), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.Etag = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", 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 DataCollectionRuleAssociationsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client DataCollectionRuleAssociationsClient) CreateResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResource, 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: +// resourceURI - the identifier of the resource. +// associationName - the name of the association. The name is case insensitive. +func (client DataCollectionRuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceURI, associationName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataCollectionRuleAssociationsClient) DeletePreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "associationName": autorest.Encode("path", associationName), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", 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 DataCollectionRuleAssociationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataCollectionRuleAssociationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceURI - the identifier of the resource. +// associationName - the name of the association. The name is case insensitive. +func (client DataCollectionRuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceURI, associationName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataCollectionRuleAssociationsClient) GetPreparer(ctx context.Context, resourceURI string, associationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "associationName": autorest.Encode("path", associationName), + "resourceUri": resourceURI, + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", 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 DataCollectionRuleAssociationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataCollectionRuleAssociationsClient) GetResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResource sends the list by resource request. +// Parameters: +// resourceURI - the identifier of the resource. +func (client DataCollectionRuleAssociationsClient) ListByResource(ctx context.Context, resourceURI string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByResource") + defer func() { + sc := -1 + if result.dcraporlr.Response.Response != nil { + sc = result.dcraporlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DataCollectionRuleAssociationsClient", "ListByResource", err.Error()) + } + + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.dcraporlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", resp, "Failure sending request") + return + } + + result.dcraporlr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.dcraporlr.hasNextLink() && result.dcraporlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client DataCollectionRuleAssociationsClient) ListByResourcePreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceSender sends the ListByResource request. The method will close the +// http.Response Body if it receives an error. +func (client DataCollectionRuleAssociationsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client DataCollectionRuleAssociationsClient) ListByResourceResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceNextResults retrieves the next set of results, if any. +func (client DataCollectionRuleAssociationsClient) listByResourceNextResults(ctx context.Context, lastResults DataCollectionRuleAssociationProxyOnlyResourceListResult) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { + req, err := lastResults.dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataCollectionRuleAssociationsClient) ListByResourceComplete(ctx context.Context, resourceURI string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByResource") + 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.ListByResource(ctx, resourceURI) + return +} + +// ListByRule sends the list by rule request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. +func (client DataCollectionRuleAssociationsClient) ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByRule") + defer func() { + sc := -1 + if result.dcraporlr.Response.Response != nil { + sc = result.dcraporlr.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("insights.DataCollectionRuleAssociationsClient", "ListByRule", err.Error()) + } + + result.fn = client.listByRuleNextResults + req, err := client.ListByRulePreparer(ctx, resourceGroupName, dataCollectionRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRuleSender(req) + if err != nil { + result.dcraporlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", resp, "Failure sending request") + return + } + + result.dcraporlr, err = client.ListByRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "ListByRule", resp, "Failure responding to request") + return + } + if result.dcraporlr.hasNextLink() && result.dcraporlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByRulePreparer prepares the ListByRule request. +func (client DataCollectionRuleAssociationsClient) ListByRulePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionRules/{dataCollectionRuleName}/associations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByRuleSender sends the ListByRule request. The method will close the +// http.Response Body if it receives an error. +func (client DataCollectionRuleAssociationsClient) ListByRuleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByRuleResponder handles the response to the ListByRule request. The method always +// closes the http.Response Body. +func (client DataCollectionRuleAssociationsClient) ListByRuleResponder(resp *http.Response) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByRuleNextResults retrieves the next set of results, if any. +func (client DataCollectionRuleAssociationsClient) listByRuleNextResults(ctx context.Context, lastResults DataCollectionRuleAssociationProxyOnlyResourceListResult) (result DataCollectionRuleAssociationProxyOnlyResourceListResult, err error) { + req, err := lastResults.dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByRuleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByRuleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRuleAssociationsClient", "listByRuleNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByRuleComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataCollectionRuleAssociationsClient) ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationsClient.ListByRule") + 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.ListByRule(ctx, resourceGroupName, dataCollectionRuleName) + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionrules.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionrules.go new file mode 100644 index 000000000000..e3baabf0f6b4 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/datacollectionrules.go @@ -0,0 +1,636 @@ +package insights + +// 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" +) + +// DataCollectionRulesClient is the monitor Management Client +type DataCollectionRulesClient struct { + BaseClient +} + +// NewDataCollectionRulesClient creates an instance of the DataCollectionRulesClient client. +func NewDataCollectionRulesClient(subscriptionID string) DataCollectionRulesClient { + return NewDataCollectionRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataCollectionRulesClientWithBaseURI creates an instance of the DataCollectionRulesClient 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 NewDataCollectionRulesClientWithBaseURI(baseURI string, subscriptionID string) DataCollectionRulesClient { + return DataCollectionRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. +// body - the payload +func (client DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *DataCollectionRuleResource) (result DataCollectionRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.Create") + 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}}}, + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("insights.DataCollectionRulesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, dataCollectionRuleName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client DataCollectionRulesClient) CreatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *DataCollectionRuleResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.Etag = 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.Insights/dataCollectionRules/{dataCollectionRuleName}", 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 DataCollectionRulesClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client DataCollectionRulesClient) CreateResponder(resp *http.Response) (result DataCollectionRuleResource, 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. +// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. +func (client DataCollectionRulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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("insights.DataCollectionRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, dataCollectionRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataCollectionRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionRules/{dataCollectionRuleName}", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, 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. +// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. +func (client DataCollectionRulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result DataCollectionRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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("insights.DataCollectionRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, dataCollectionRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataCollectionRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionRules/{dataCollectionRuleName}", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) GetResponder(resp *http.Response) (result DataCollectionRuleResource, 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 DataCollectionRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DataCollectionRuleResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dcrrlr.Response.Response != nil { + sc = result.dcrrlr.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("insights.DataCollectionRulesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dcrrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dcrrlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dcrrlr.hasNextLink() && result.dcrrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DataCollectionRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionRules", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) ListByResourceGroupResponder(resp *http.Response) (result DataCollectionRuleResourceListResult, 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 DataCollectionRulesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DataCollectionRuleResourceListResult) (result DataCollectionRuleResourceListResult, err error) { + req, err := lastResults.dataCollectionRuleResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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, "insights.DataCollectionRulesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataCollectionRulesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DataCollectionRuleResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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 DataCollectionRulesClient) ListBySubscription(ctx context.Context) (result DataCollectionRuleResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.ListBySubscription") + defer func() { + sc := -1 + if result.dcrrlr.Response.Response != nil { + sc = result.dcrrlr.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("insights.DataCollectionRulesClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dcrrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dcrrlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.dcrrlr.hasNextLink() && result.dcrrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DataCollectionRulesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) ListBySubscriptionResponder(resp *http.Response) (result DataCollectionRuleResourceListResult, 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 DataCollectionRulesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DataCollectionRuleResourceListResult) (result DataCollectionRuleResourceListResult, err error) { + req, err := lastResults.dataCollectionRuleResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "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, "insights.DataCollectionRulesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataCollectionRulesClient) ListBySubscriptionComplete(ctx context.Context) (result DataCollectionRuleResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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 +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// dataCollectionRuleName - the name of the data collection rule. The name is case insensitive. +// body - the payload +func (client DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (result DataCollectionRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRulesClient.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("insights.DataCollectionRulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, dataCollectionRuleName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DataCollectionRulesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DataCollectionRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *ResourceForUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataCollectionRuleName": autorest.Encode("path", dataCollectionRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-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.Insights/dataCollectionRules/{dataCollectionRuleName}", 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 DataCollectionRulesClient) 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 DataCollectionRulesClient) UpdateResponder(resp *http.Response) (result DataCollectionRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/diagnosticsettings.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/diagnosticsettings.go new file mode 100644 index 000000000000..7d9d3f85a2ce --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/diagnosticsettings.go @@ -0,0 +1,357 @@ +package insights + +// 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" +) + +// DiagnosticSettingsClient is the monitor Management Client +type DiagnosticSettingsClient struct { + BaseClient +} + +// NewDiagnosticSettingsClient creates an instance of the DiagnosticSettingsClient client. +func NewDiagnosticSettingsClient(subscriptionID string) DiagnosticSettingsClient { + return NewDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDiagnosticSettingsClientWithBaseURI creates an instance of the DiagnosticSettingsClient 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 NewDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsClient { + return DiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates diagnostic settings for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +// parameters - parameters supplied to the operation. +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (result DiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DiagnosticSettingsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceURI, parameters, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DiagnosticSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceURI string, parameters DiagnosticSettingsResource, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DiagnosticSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes existing diagnostic settings for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DiagnosticSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DiagnosticSettingsClient) DeletePreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the active diagnostic settings for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DiagnosticSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DiagnosticSettingsClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", 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 DiagnosticSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsClient) GetResponder(resp *http.Response) (result DiagnosticSettingsResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the active diagnostic settings list for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +func (client DiagnosticSettingsClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsClient.List") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DiagnosticSettingsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DiagnosticSettingsClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings", 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 DiagnosticSettingsClient) 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 DiagnosticSettingsClient) ListResponder(resp *http.Response) (result DiagnosticSettingsResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/diagnosticsettingscategory.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/diagnosticsettingscategory.go new file mode 100644 index 000000000000..d26b755764e6 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/diagnosticsettingscategory.go @@ -0,0 +1,193 @@ +package insights + +// 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" +) + +// DiagnosticSettingsCategoryClient is the monitor Management Client +type DiagnosticSettingsCategoryClient struct { + BaseClient +} + +// NewDiagnosticSettingsCategoryClient creates an instance of the DiagnosticSettingsCategoryClient client. +func NewDiagnosticSettingsCategoryClient(subscriptionID string) DiagnosticSettingsCategoryClient { + return NewDiagnosticSettingsCategoryClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDiagnosticSettingsCategoryClientWithBaseURI creates an instance of the DiagnosticSettingsCategoryClient 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 NewDiagnosticSettingsCategoryClientWithBaseURI(baseURI string, subscriptionID string) DiagnosticSettingsCategoryClient { + return DiagnosticSettingsCategoryClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the diagnostic settings category for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +// name - the name of the diagnostic setting. +func (client DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string) (result DiagnosticSettingsCategoryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DiagnosticSettingsCategoryClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceURI, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DiagnosticSettingsCategoryClient) GetPreparer(ctx context.Context, resourceURI string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}", 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 DiagnosticSettingsCategoryClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DiagnosticSettingsCategoryClient) GetResponder(resp *http.Response) (result DiagnosticSettingsCategoryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the diagnostic settings categories for the specified resource. +// Parameters: +// resourceURI - the identifier of the resource. +func (client DiagnosticSettingsCategoryClient) List(ctx context.Context, resourceURI string) (result DiagnosticSettingsCategoryResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiagnosticSettingsCategoryClient.List") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.DiagnosticSettingsCategoryClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.DiagnosticSettingsCategoryClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DiagnosticSettingsCategoryClient) ListPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories", 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 DiagnosticSettingsCategoryClient) 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 DiagnosticSettingsCategoryClient) ListResponder(resp *http.Response) (result DiagnosticSettingsCategoryResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/enums.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/enums.go new file mode 100644 index 000000000000..eff6f3788f50 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/enums.go @@ -0,0 +1,991 @@ +package insights + +// 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. + +// AggregationType enumerates the values for aggregation type. +type AggregationType string + +const ( + // AggregationTypeAverage ... + AggregationTypeAverage AggregationType = "Average" + // AggregationTypeCount ... + AggregationTypeCount AggregationType = "Count" + // AggregationTypeMaximum ... + AggregationTypeMaximum AggregationType = "Maximum" + // AggregationTypeMinimum ... + AggregationTypeMinimum AggregationType = "Minimum" + // AggregationTypeNone ... + AggregationTypeNone AggregationType = "None" + // AggregationTypeTotal ... + AggregationTypeTotal AggregationType = "Total" +) + +// PossibleAggregationTypeValues returns an array of possible values for the AggregationType const type. +func PossibleAggregationTypeValues() []AggregationType { + return []AggregationType{AggregationTypeAverage, AggregationTypeCount, AggregationTypeMaximum, AggregationTypeMinimum, AggregationTypeNone, AggregationTypeTotal} +} + +// AggregationTypeEnum enumerates the values for aggregation type enum. +type AggregationTypeEnum string + +const ( + // AggregationTypeEnumAverage ... + AggregationTypeEnumAverage AggregationTypeEnum = "Average" + // AggregationTypeEnumCount ... + AggregationTypeEnumCount AggregationTypeEnum = "Count" + // AggregationTypeEnumMaximum ... + AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" + // AggregationTypeEnumMinimum ... + AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" + // AggregationTypeEnumTotal ... + AggregationTypeEnumTotal AggregationTypeEnum = "Total" +) + +// PossibleAggregationTypeEnumValues returns an array of possible values for the AggregationTypeEnum const type. +func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { + return []AggregationTypeEnum{AggregationTypeEnumAverage, AggregationTypeEnumCount, AggregationTypeEnumMaximum, AggregationTypeEnumMinimum, AggregationTypeEnumTotal} +} + +// AlertSeverity enumerates the values for alert severity. +type AlertSeverity string + +const ( + // AlertSeverityFour ... + AlertSeverityFour AlertSeverity = "4" + // AlertSeverityOne ... + AlertSeverityOne AlertSeverity = "1" + // AlertSeverityThree ... + AlertSeverityThree AlertSeverity = "3" + // AlertSeverityTwo ... + AlertSeverityTwo AlertSeverity = "2" + // AlertSeverityZero ... + AlertSeverityZero AlertSeverity = "0" +) + +// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. +func PossibleAlertSeverityValues() []AlertSeverity { + return []AlertSeverity{AlertSeverityFour, AlertSeverityOne, AlertSeverityThree, AlertSeverityTwo, AlertSeverityZero} +} + +// BaselineSensitivity enumerates the values for baseline sensitivity. +type BaselineSensitivity string + +const ( + // BaselineSensitivityHigh ... + BaselineSensitivityHigh BaselineSensitivity = "High" + // BaselineSensitivityLow ... + BaselineSensitivityLow BaselineSensitivity = "Low" + // BaselineSensitivityMedium ... + BaselineSensitivityMedium BaselineSensitivity = "Medium" +) + +// PossibleBaselineSensitivityValues returns an array of possible values for the BaselineSensitivity const type. +func PossibleBaselineSensitivityValues() []BaselineSensitivity { + return []BaselineSensitivity{BaselineSensitivityHigh, BaselineSensitivityLow, BaselineSensitivityMedium} +} + +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // CategoryTypeLogs ... + CategoryTypeLogs CategoryType = "Logs" + // CategoryTypeMetrics ... + CategoryTypeMetrics CategoryType = "Metrics" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{CategoryTypeLogs, CategoryTypeMetrics} +} + +// ComparisonOperationType enumerates the values for comparison operation type. +type ComparisonOperationType string + +const ( + // ComparisonOperationTypeEquals ... + ComparisonOperationTypeEquals ComparisonOperationType = "Equals" + // ComparisonOperationTypeGreaterThan ... + ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" + // ComparisonOperationTypeGreaterThanOrEqual ... + ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" + // ComparisonOperationTypeLessThan ... + ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" + // ComparisonOperationTypeLessThanOrEqual ... + ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" + // ComparisonOperationTypeNotEquals ... + ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" +) + +// PossibleComparisonOperationTypeValues returns an array of possible values for the ComparisonOperationType const type. +func PossibleComparisonOperationTypeValues() []ComparisonOperationType { + return []ComparisonOperationType{ComparisonOperationTypeEquals, ComparisonOperationTypeGreaterThan, ComparisonOperationTypeGreaterThanOrEqual, ComparisonOperationTypeLessThan, ComparisonOperationTypeLessThanOrEqual, ComparisonOperationTypeNotEquals} +} + +// ConditionalOperator enumerates the values for conditional operator. +type ConditionalOperator string + +const ( + // ConditionalOperatorEqual ... + ConditionalOperatorEqual ConditionalOperator = "Equal" + // ConditionalOperatorGreaterThan ... + ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual ... + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" + // ConditionalOperatorLessThan ... + ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual ... + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" +) + +// PossibleConditionalOperatorValues returns an array of possible values for the ConditionalOperator const type. +func PossibleConditionalOperatorValues() []ConditionalOperator { + return []ConditionalOperator{ConditionalOperatorEqual, ConditionalOperatorGreaterThan, ConditionalOperatorGreaterThanOrEqual, ConditionalOperatorLessThan, ConditionalOperatorLessThanOrEqual} +} + +// ConditionOperator enumerates the values for condition operator. +type ConditionOperator string + +const ( + // ConditionOperatorGreaterThan ... + ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" + // ConditionOperatorGreaterThanOrEqual ... + ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" + // ConditionOperatorLessThan ... + ConditionOperatorLessThan ConditionOperator = "LessThan" + // ConditionOperatorLessThanOrEqual ... + ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual" +) + +// PossibleConditionOperatorValues returns an array of possible values for the ConditionOperator const type. +func PossibleConditionOperatorValues() []ConditionOperator { + return []ConditionOperator{ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, ConditionOperatorLessThanOrEqual} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// CriterionType enumerates the values for criterion type. +type CriterionType string + +const ( + // CriterionTypeDynamicThresholdCriterion ... + CriterionTypeDynamicThresholdCriterion CriterionType = "DynamicThresholdCriterion" + // CriterionTypeMultiMetricCriteria ... + CriterionTypeMultiMetricCriteria CriterionType = "MultiMetricCriteria" + // CriterionTypeStaticThresholdCriterion ... + CriterionTypeStaticThresholdCriterion CriterionType = "StaticThresholdCriterion" +) + +// PossibleCriterionTypeValues returns an array of possible values for the CriterionType const type. +func PossibleCriterionTypeValues() []CriterionType { + return []CriterionType{CriterionTypeDynamicThresholdCriterion, CriterionTypeMultiMetricCriteria, CriterionTypeStaticThresholdCriterion} +} + +// DataStatus enumerates the values for data status. +type DataStatus string + +const ( + // DataStatusNotPresent ... + DataStatusNotPresent DataStatus = "notPresent" + // DataStatusPresent ... + DataStatusPresent DataStatus = "present" +) + +// PossibleDataStatusValues returns an array of possible values for the DataStatus const type. +func PossibleDataStatusValues() []DataStatus { + return []DataStatus{DataStatusNotPresent, DataStatusPresent} +} + +// DynamicThresholdOperator enumerates the values for dynamic threshold operator. +type DynamicThresholdOperator string + +const ( + // DynamicThresholdOperatorGreaterOrLessThan ... + DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" + // DynamicThresholdOperatorGreaterThan ... + DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" + // DynamicThresholdOperatorLessThan ... + DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" +) + +// PossibleDynamicThresholdOperatorValues returns an array of possible values for the DynamicThresholdOperator const type. +func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { + return []DynamicThresholdOperator{DynamicThresholdOperatorGreaterOrLessThan, DynamicThresholdOperatorGreaterThan, DynamicThresholdOperatorLessThan} +} + +// DynamicThresholdSensitivity enumerates the values for dynamic threshold sensitivity. +type DynamicThresholdSensitivity string + +const ( + // DynamicThresholdSensitivityHigh ... + DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" + // DynamicThresholdSensitivityLow ... + DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" + // DynamicThresholdSensitivityMedium ... + DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" +) + +// PossibleDynamicThresholdSensitivityValues returns an array of possible values for the DynamicThresholdSensitivity const type. +func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { + return []DynamicThresholdSensitivity{DynamicThresholdSensitivityHigh, DynamicThresholdSensitivityLow, DynamicThresholdSensitivityMedium} +} + +// Enabled enumerates the values for enabled. +type Enabled string + +const ( + // EnabledFalse ... + EnabledFalse Enabled = "false" + // EnabledTrue ... + EnabledTrue Enabled = "true" +) + +// PossibleEnabledValues returns an array of possible values for the Enabled const type. +func PossibleEnabledValues() []Enabled { + return []Enabled{EnabledFalse, EnabledTrue} +} + +// EventLevel enumerates the values for event level. +type EventLevel string + +const ( + // EventLevelCritical ... + EventLevelCritical EventLevel = "Critical" + // EventLevelError ... + EventLevelError EventLevel = "Error" + // EventLevelInformational ... + EventLevelInformational EventLevel = "Informational" + // EventLevelVerbose ... + EventLevelVerbose EventLevel = "Verbose" + // EventLevelWarning ... + EventLevelWarning EventLevel = "Warning" +) + +// PossibleEventLevelValues returns an array of possible values for the EventLevel const type. +func PossibleEventLevelValues() []EventLevel { + return []EventLevel{EventLevelCritical, EventLevelError, EventLevelInformational, EventLevelVerbose, EventLevelWarning} +} + +// KnownDataCollectionEndpointProvisioningState enumerates the values for known data collection endpoint +// provisioning state. +type KnownDataCollectionEndpointProvisioningState string + +const ( + // KnownDataCollectionEndpointProvisioningStateCreating ... + KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" + // KnownDataCollectionEndpointProvisioningStateDeleting ... + KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" + // KnownDataCollectionEndpointProvisioningStateFailed ... + KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" + // KnownDataCollectionEndpointProvisioningStateSucceeded ... + KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" + // KnownDataCollectionEndpointProvisioningStateUpdating ... + KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" +) + +// PossibleKnownDataCollectionEndpointProvisioningStateValues returns an array of possible values for the KnownDataCollectionEndpointProvisioningState const type. +func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCollectionEndpointProvisioningState { + return []KnownDataCollectionEndpointProvisioningState{KnownDataCollectionEndpointProvisioningStateCreating, KnownDataCollectionEndpointProvisioningStateDeleting, KnownDataCollectionEndpointProvisioningStateFailed, KnownDataCollectionEndpointProvisioningStateSucceeded, KnownDataCollectionEndpointProvisioningStateUpdating} +} + +// KnownDataCollectionEndpointResourceKind enumerates the values for known data collection endpoint resource +// kind. +type KnownDataCollectionEndpointResourceKind string + +const ( + // KnownDataCollectionEndpointResourceKindLinux ... + KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" + // KnownDataCollectionEndpointResourceKindWindows ... + KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" +) + +// PossibleKnownDataCollectionEndpointResourceKindValues returns an array of possible values for the KnownDataCollectionEndpointResourceKind const type. +func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollectionEndpointResourceKind { + return []KnownDataCollectionEndpointResourceKind{KnownDataCollectionEndpointResourceKindLinux, KnownDataCollectionEndpointResourceKindWindows} +} + +// KnownDataCollectionRuleAssociationProvisioningState enumerates the values for known data collection rule +// association provisioning state. +type KnownDataCollectionRuleAssociationProvisioningState string + +const ( + // KnownDataCollectionRuleAssociationProvisioningStateCreating ... + KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" + // KnownDataCollectionRuleAssociationProvisioningStateDeleting ... + KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" + // KnownDataCollectionRuleAssociationProvisioningStateFailed ... + KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" + // KnownDataCollectionRuleAssociationProvisioningStateSucceeded ... + KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" + // KnownDataCollectionRuleAssociationProvisioningStateUpdating ... + KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" +) + +// PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. +func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []KnownDataCollectionRuleAssociationProvisioningState { + return []KnownDataCollectionRuleAssociationProvisioningState{KnownDataCollectionRuleAssociationProvisioningStateCreating, KnownDataCollectionRuleAssociationProvisioningStateDeleting, KnownDataCollectionRuleAssociationProvisioningStateFailed, KnownDataCollectionRuleAssociationProvisioningStateSucceeded, KnownDataCollectionRuleAssociationProvisioningStateUpdating} +} + +// KnownDataCollectionRuleProvisioningState enumerates the values for known data collection rule provisioning +// state. +type KnownDataCollectionRuleProvisioningState string + +const ( + // KnownDataCollectionRuleProvisioningStateCreating ... + KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" + // KnownDataCollectionRuleProvisioningStateDeleting ... + KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" + // KnownDataCollectionRuleProvisioningStateFailed ... + KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" + // KnownDataCollectionRuleProvisioningStateSucceeded ... + KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" + // KnownDataCollectionRuleProvisioningStateUpdating ... + KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" +) + +// PossibleKnownDataCollectionRuleProvisioningStateValues returns an array of possible values for the KnownDataCollectionRuleProvisioningState const type. +func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollectionRuleProvisioningState { + return []KnownDataCollectionRuleProvisioningState{KnownDataCollectionRuleProvisioningStateCreating, KnownDataCollectionRuleProvisioningStateDeleting, KnownDataCollectionRuleProvisioningStateFailed, KnownDataCollectionRuleProvisioningStateSucceeded, KnownDataCollectionRuleProvisioningStateUpdating} +} + +// KnownDataCollectionRuleResourceKind enumerates the values for known data collection rule resource kind. +type KnownDataCollectionRuleResourceKind string + +const ( + // KnownDataCollectionRuleResourceKindLinux ... + KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" + // KnownDataCollectionRuleResourceKindWindows ... + KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" +) + +// PossibleKnownDataCollectionRuleResourceKindValues returns an array of possible values for the KnownDataCollectionRuleResourceKind const type. +func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRuleResourceKind { + return []KnownDataCollectionRuleResourceKind{KnownDataCollectionRuleResourceKindLinux, KnownDataCollectionRuleResourceKindWindows} +} + +// KnownDataFlowStreams enumerates the values for known data flow streams. +type KnownDataFlowStreams string + +const ( + // KnownDataFlowStreamsMicrosoftEvent ... + KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" + // KnownDataFlowStreamsMicrosoftInsightsMetrics ... + KnownDataFlowStreamsMicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" + // KnownDataFlowStreamsMicrosoftPerf ... + KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" + // KnownDataFlowStreamsMicrosoftSyslog ... + KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" + // KnownDataFlowStreamsMicrosoftWindowsEvent ... + KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" +) + +// PossibleKnownDataFlowStreamsValues returns an array of possible values for the KnownDataFlowStreams const type. +func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { + return []KnownDataFlowStreams{KnownDataFlowStreamsMicrosoftEvent, KnownDataFlowStreamsMicrosoftInsightsMetrics, KnownDataFlowStreamsMicrosoftPerf, KnownDataFlowStreamsMicrosoftSyslog, KnownDataFlowStreamsMicrosoftWindowsEvent} +} + +// KnownExtensionDataSourceStreams enumerates the values for known extension data source streams. +type KnownExtensionDataSourceStreams string + +const ( + // KnownExtensionDataSourceStreamsMicrosoftEvent ... + KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" + // KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics ... + KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" + // KnownExtensionDataSourceStreamsMicrosoftPerf ... + KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" + // KnownExtensionDataSourceStreamsMicrosoftSyslog ... + KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" + // KnownExtensionDataSourceStreamsMicrosoftWindowsEvent ... + KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" +) + +// PossibleKnownExtensionDataSourceStreamsValues returns an array of possible values for the KnownExtensionDataSourceStreams const type. +func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceStreams { + return []KnownExtensionDataSourceStreams{KnownExtensionDataSourceStreamsMicrosoftEvent, KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics, KnownExtensionDataSourceStreamsMicrosoftPerf, KnownExtensionDataSourceStreamsMicrosoftSyslog, KnownExtensionDataSourceStreamsMicrosoftWindowsEvent} +} + +// KnownPerfCounterDataSourceStreams enumerates the values for known perf counter data source streams. +type KnownPerfCounterDataSourceStreams string + +const ( + // KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics ... + KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" + // KnownPerfCounterDataSourceStreamsMicrosoftPerf ... + KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" +) + +// PossibleKnownPerfCounterDataSourceStreamsValues returns an array of possible values for the KnownPerfCounterDataSourceStreams const type. +func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSourceStreams { + return []KnownPerfCounterDataSourceStreams{KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics, KnownPerfCounterDataSourceStreamsMicrosoftPerf} +} + +// KnownPublicNetworkAccessOptions enumerates the values for known public network access options. +type KnownPublicNetworkAccessOptions string + +const ( + // KnownPublicNetworkAccessOptionsDisabled ... + KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" + // KnownPublicNetworkAccessOptionsEnabled ... + KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" +) + +// PossibleKnownPublicNetworkAccessOptionsValues returns an array of possible values for the KnownPublicNetworkAccessOptions const type. +func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessOptions { + return []KnownPublicNetworkAccessOptions{KnownPublicNetworkAccessOptionsDisabled, KnownPublicNetworkAccessOptionsEnabled} +} + +// KnownSyslogDataSourceFacilityNames enumerates the values for known syslog data source facility names. +type KnownSyslogDataSourceFacilityNames string + +const ( + // KnownSyslogDataSourceFacilityNamesAsterisk ... + KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" + // KnownSyslogDataSourceFacilityNamesAuth ... + KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" + // KnownSyslogDataSourceFacilityNamesAuthpriv ... + KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" + // KnownSyslogDataSourceFacilityNamesCron ... + KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" + // KnownSyslogDataSourceFacilityNamesDaemon ... + KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" + // KnownSyslogDataSourceFacilityNamesKern ... + KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" + // KnownSyslogDataSourceFacilityNamesLocal0 ... + KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" + // KnownSyslogDataSourceFacilityNamesLocal1 ... + KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" + // KnownSyslogDataSourceFacilityNamesLocal2 ... + KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" + // KnownSyslogDataSourceFacilityNamesLocal3 ... + KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" + // KnownSyslogDataSourceFacilityNamesLocal4 ... + KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" + // KnownSyslogDataSourceFacilityNamesLocal5 ... + KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" + // KnownSyslogDataSourceFacilityNamesLocal6 ... + KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" + // KnownSyslogDataSourceFacilityNamesLocal7 ... + KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" + // KnownSyslogDataSourceFacilityNamesLpr ... + KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" + // KnownSyslogDataSourceFacilityNamesMail ... + KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" + // KnownSyslogDataSourceFacilityNamesMark ... + KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" + // KnownSyslogDataSourceFacilityNamesNews ... + KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" + // KnownSyslogDataSourceFacilityNamesSyslog ... + KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" + // KnownSyslogDataSourceFacilityNamesUser ... + KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" + // KnownSyslogDataSourceFacilityNamesUucp ... + KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" +) + +// PossibleKnownSyslogDataSourceFacilityNamesValues returns an array of possible values for the KnownSyslogDataSourceFacilityNames const type. +func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { + return []KnownSyslogDataSourceFacilityNames{KnownSyslogDataSourceFacilityNamesAsterisk, KnownSyslogDataSourceFacilityNamesAuth, KnownSyslogDataSourceFacilityNamesAuthpriv, KnownSyslogDataSourceFacilityNamesCron, KnownSyslogDataSourceFacilityNamesDaemon, KnownSyslogDataSourceFacilityNamesKern, KnownSyslogDataSourceFacilityNamesLocal0, KnownSyslogDataSourceFacilityNamesLocal1, KnownSyslogDataSourceFacilityNamesLocal2, KnownSyslogDataSourceFacilityNamesLocal3, KnownSyslogDataSourceFacilityNamesLocal4, KnownSyslogDataSourceFacilityNamesLocal5, KnownSyslogDataSourceFacilityNamesLocal6, KnownSyslogDataSourceFacilityNamesLocal7, KnownSyslogDataSourceFacilityNamesLpr, KnownSyslogDataSourceFacilityNamesMail, KnownSyslogDataSourceFacilityNamesMark, KnownSyslogDataSourceFacilityNamesNews, KnownSyslogDataSourceFacilityNamesSyslog, KnownSyslogDataSourceFacilityNamesUser, KnownSyslogDataSourceFacilityNamesUucp} +} + +// KnownSyslogDataSourceLogLevels enumerates the values for known syslog data source log levels. +type KnownSyslogDataSourceLogLevels string + +const ( + // KnownSyslogDataSourceLogLevelsAlert ... + KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" + // KnownSyslogDataSourceLogLevelsAsterisk ... + KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" + // KnownSyslogDataSourceLogLevelsCritical ... + KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" + // KnownSyslogDataSourceLogLevelsDebug ... + KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" + // KnownSyslogDataSourceLogLevelsEmergency ... + KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" + // KnownSyslogDataSourceLogLevelsError ... + KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" + // KnownSyslogDataSourceLogLevelsInfo ... + KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" + // KnownSyslogDataSourceLogLevelsNotice ... + KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" + // KnownSyslogDataSourceLogLevelsWarning ... + KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" +) + +// PossibleKnownSyslogDataSourceLogLevelsValues returns an array of possible values for the KnownSyslogDataSourceLogLevels const type. +func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLevels { + return []KnownSyslogDataSourceLogLevels{KnownSyslogDataSourceLogLevelsAlert, KnownSyslogDataSourceLogLevelsAsterisk, KnownSyslogDataSourceLogLevelsCritical, KnownSyslogDataSourceLogLevelsDebug, KnownSyslogDataSourceLogLevelsEmergency, KnownSyslogDataSourceLogLevelsError, KnownSyslogDataSourceLogLevelsInfo, KnownSyslogDataSourceLogLevelsNotice, KnownSyslogDataSourceLogLevelsWarning} +} + +// KnownSyslogDataSourceStreams enumerates the values for known syslog data source streams. +type KnownSyslogDataSourceStreams string + +const ( + // KnownSyslogDataSourceStreamsMicrosoftSyslog ... + KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" +) + +// PossibleKnownSyslogDataSourceStreamsValues returns an array of possible values for the KnownSyslogDataSourceStreams const type. +func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams { + return []KnownSyslogDataSourceStreams{KnownSyslogDataSourceStreamsMicrosoftSyslog} +} + +// KnownWindowsEventLogDataSourceStreams enumerates the values for known windows event log data source streams. +type KnownWindowsEventLogDataSourceStreams string + +const ( + // KnownWindowsEventLogDataSourceStreamsMicrosoftEvent ... + KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" + // KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent ... + KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" +) + +// PossibleKnownWindowsEventLogDataSourceStreamsValues returns an array of possible values for the KnownWindowsEventLogDataSourceStreams const type. +func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLogDataSourceStreams { + return []KnownWindowsEventLogDataSourceStreams{KnownWindowsEventLogDataSourceStreamsMicrosoftEvent, KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent} +} + +// MetricClass enumerates the values for metric class. +type MetricClass string + +const ( + // MetricClassAvailability ... + MetricClassAvailability MetricClass = "Availability" + // MetricClassErrors ... + MetricClassErrors MetricClass = "Errors" + // MetricClassLatency ... + MetricClassLatency MetricClass = "Latency" + // MetricClassSaturation ... + MetricClassSaturation MetricClass = "Saturation" + // MetricClassTransactions ... + MetricClassTransactions MetricClass = "Transactions" +) + +// PossibleMetricClassValues returns an array of possible values for the MetricClass const type. +func PossibleMetricClassValues() []MetricClass { + return []MetricClass{MetricClassAvailability, MetricClassErrors, MetricClassLatency, MetricClassSaturation, MetricClassTransactions} +} + +// MetricStatisticType enumerates the values for metric statistic type. +type MetricStatisticType string + +const ( + // MetricStatisticTypeAverage ... + MetricStatisticTypeAverage MetricStatisticType = "Average" + // MetricStatisticTypeCount ... + MetricStatisticTypeCount MetricStatisticType = "Count" + // MetricStatisticTypeMax ... + MetricStatisticTypeMax MetricStatisticType = "Max" + // MetricStatisticTypeMin ... + MetricStatisticTypeMin MetricStatisticType = "Min" + // MetricStatisticTypeSum ... + MetricStatisticTypeSum MetricStatisticType = "Sum" +) + +// PossibleMetricStatisticTypeValues returns an array of possible values for the MetricStatisticType const type. +func PossibleMetricStatisticTypeValues() []MetricStatisticType { + return []MetricStatisticType{MetricStatisticTypeAverage, MetricStatisticTypeCount, MetricStatisticTypeMax, MetricStatisticTypeMin, MetricStatisticTypeSum} +} + +// MetricTriggerType enumerates the values for metric trigger type. +type MetricTriggerType string + +const ( + // MetricTriggerTypeConsecutive ... + MetricTriggerTypeConsecutive MetricTriggerType = "Consecutive" + // MetricTriggerTypeTotal ... + MetricTriggerTypeTotal MetricTriggerType = "Total" +) + +// PossibleMetricTriggerTypeValues returns an array of possible values for the MetricTriggerType const type. +func PossibleMetricTriggerTypeValues() []MetricTriggerType { + return []MetricTriggerType{MetricTriggerTypeConsecutive, MetricTriggerTypeTotal} +} + +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // MetricUnitBitsPerSecond ... + MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" + // MetricUnitBytes ... + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitByteSeconds ... + MetricUnitByteSeconds MetricUnit = "ByteSeconds" + // MetricUnitBytesPerSecond ... + MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" + // MetricUnitCores ... + MetricUnitCores MetricUnit = "Cores" + // MetricUnitCount ... + MetricUnitCount MetricUnit = "Count" + // MetricUnitCountPerSecond ... + MetricUnitCountPerSecond MetricUnit = "CountPerSecond" + // MetricUnitMilliCores ... + MetricUnitMilliCores MetricUnit = "MilliCores" + // MetricUnitMilliSeconds ... + MetricUnitMilliSeconds MetricUnit = "MilliSeconds" + // MetricUnitNanoCores ... + MetricUnitNanoCores MetricUnit = "NanoCores" + // MetricUnitPercent ... + MetricUnitPercent MetricUnit = "Percent" + // MetricUnitSeconds ... + MetricUnitSeconds MetricUnit = "Seconds" + // MetricUnitUnspecified ... + MetricUnitUnspecified MetricUnit = "Unspecified" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{MetricUnitBitsPerSecond, MetricUnitBytes, MetricUnitByteSeconds, MetricUnitBytesPerSecond, MetricUnitCores, MetricUnitCount, MetricUnitCountPerSecond, MetricUnitMilliCores, MetricUnitMilliSeconds, MetricUnitNanoCores, MetricUnitPercent, MetricUnitSeconds, MetricUnitUnspecified} +} + +// NamespaceClassification enumerates the values for namespace classification. +type NamespaceClassification string + +const ( + // NamespaceClassificationCustom ... + NamespaceClassificationCustom NamespaceClassification = "Custom" + // NamespaceClassificationPlatform ... + NamespaceClassificationPlatform NamespaceClassification = "Platform" + // NamespaceClassificationQos ... + NamespaceClassificationQos NamespaceClassification = "Qos" +) + +// PossibleNamespaceClassificationValues returns an array of possible values for the NamespaceClassification const type. +func PossibleNamespaceClassificationValues() []NamespaceClassification { + return []NamespaceClassification{NamespaceClassificationCustom, NamespaceClassificationPlatform, NamespaceClassificationQos} +} + +// OdataType enumerates the values for odata type. +type OdataType string + +const ( + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" + // OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource ... + OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" + // OdataTypeRuleDataSource ... + OdataTypeRuleDataSource OdataType = "RuleDataSource" +) + +// PossibleOdataTypeValues returns an array of possible values for the OdataType const type. +func PossibleOdataTypeValues() []OdataType { + return []OdataType{OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource, OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource, OdataTypeRuleDataSource} +} + +// OdataTypeBasicAction enumerates the values for odata type basic action. +type OdataTypeBasicAction string + +const ( + // OdataTypeBasicActionOdataTypeAction ... + OdataTypeBasicActionOdataTypeAction OdataTypeBasicAction = "Action" + // OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction ... + OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction" + // OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction ... + OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction OdataTypeBasicAction = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" +) + +// PossibleOdataTypeBasicActionValues returns an array of possible values for the OdataTypeBasicAction const type. +func PossibleOdataTypeBasicActionValues() []OdataTypeBasicAction { + return []OdataTypeBasicAction{OdataTypeBasicActionOdataTypeAction, OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction, OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction} +} + +// OdataTypeBasicMetricAlertCriteria enumerates the values for odata type basic metric alert criteria. +type OdataTypeBasicMetricAlertCriteria string + +const ( + // OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria ... + OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria OdataTypeBasicMetricAlertCriteria = "MetricAlertCriteria" + // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria ... + OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" + // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria ... + OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" + // OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria ... + OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria OdataTypeBasicMetricAlertCriteria = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" +) + +// PossibleOdataTypeBasicMetricAlertCriteriaValues returns an array of possible values for the OdataTypeBasicMetricAlertCriteria const type. +func PossibleOdataTypeBasicMetricAlertCriteriaValues() []OdataTypeBasicMetricAlertCriteria { + return []OdataTypeBasicMetricAlertCriteria{OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria} +} + +// OdataTypeBasicRuleAction enumerates the values for odata type basic rule action. +type OdataTypeBasicRuleAction string + +const ( + // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction ... + OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" + // OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction ... + OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction OdataTypeBasicRuleAction = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" + // OdataTypeBasicRuleActionOdataTypeRuleAction ... + OdataTypeBasicRuleActionOdataTypeRuleAction OdataTypeBasicRuleAction = "RuleAction" +) + +// PossibleOdataTypeBasicRuleActionValues returns an array of possible values for the OdataTypeBasicRuleAction const type. +func PossibleOdataTypeBasicRuleActionValues() []OdataTypeBasicRuleAction { + return []OdataTypeBasicRuleAction{OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction, OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction, OdataTypeBasicRuleActionOdataTypeRuleAction} +} + +// OdataTypeBasicRuleCondition enumerates the values for odata type basic rule condition. +type OdataTypeBasicRuleCondition string + +const ( + // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition ... + OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" + // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition ... + OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" + // OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition ... + OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition OdataTypeBasicRuleCondition = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" + // OdataTypeBasicRuleConditionOdataTypeRuleCondition ... + OdataTypeBasicRuleConditionOdataTypeRuleCondition OdataTypeBasicRuleCondition = "RuleCondition" +) + +// PossibleOdataTypeBasicRuleConditionValues returns an array of possible values for the OdataTypeBasicRuleCondition const type. +func PossibleOdataTypeBasicRuleConditionValues() []OdataTypeBasicRuleCondition { + return []OdataTypeBasicRuleCondition{OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition, OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition, OdataTypeBasicRuleConditionOdataTypeRuleCondition} +} + +// OnboardingStatus enumerates the values for onboarding status. +type OnboardingStatus string + +const ( + // OnboardingStatusNotOnboarded ... + OnboardingStatusNotOnboarded OnboardingStatus = "notOnboarded" + // OnboardingStatusOnboarded ... + OnboardingStatusOnboarded OnboardingStatus = "onboarded" + // OnboardingStatusUnknown ... + OnboardingStatusUnknown OnboardingStatus = "unknown" +) + +// PossibleOnboardingStatusValues returns an array of possible values for the OnboardingStatus const type. +func PossibleOnboardingStatusValues() []OnboardingStatus { + return []OnboardingStatus{OnboardingStatusNotOnboarded, OnboardingStatusOnboarded, OnboardingStatusUnknown} +} + +// Operator enumerates the values for operator. +type Operator string + +const ( + // OperatorEquals ... + OperatorEquals Operator = "Equals" + // OperatorGreaterThan ... + OperatorGreaterThan Operator = "GreaterThan" + // OperatorGreaterThanOrEqual ... + OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" + // OperatorLessThan ... + OperatorLessThan Operator = "LessThan" + // OperatorLessThanOrEqual ... + OperatorLessThanOrEqual Operator = "LessThanOrEqual" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{OperatorEquals, OperatorGreaterThan, OperatorGreaterThanOrEqual, OperatorLessThan, OperatorLessThanOrEqual} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeploying ... + ProvisioningStateDeploying ProvisioningState = "Deploying" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateDeploying, ProvisioningStateFailed, ProvisioningStateSucceeded} +} + +// QueryType enumerates the values for query type. +type QueryType string + +const ( + // QueryTypeResultCount ... + QueryTypeResultCount QueryType = "ResultCount" +) + +// PossibleQueryTypeValues returns an array of possible values for the QueryType const type. +func PossibleQueryTypeValues() []QueryType { + return []QueryType{QueryTypeResultCount} +} + +// ReceiverStatus enumerates the values for receiver status. +type ReceiverStatus string + +const ( + // ReceiverStatusDisabled ... + ReceiverStatusDisabled ReceiverStatus = "Disabled" + // ReceiverStatusEnabled ... + ReceiverStatusEnabled ReceiverStatus = "Enabled" + // ReceiverStatusNotSpecified ... + ReceiverStatusNotSpecified ReceiverStatus = "NotSpecified" +) + +// PossibleReceiverStatusValues returns an array of possible values for the ReceiverStatus const type. +func PossibleReceiverStatusValues() []ReceiverStatus { + return []ReceiverStatus{ReceiverStatusDisabled, ReceiverStatusEnabled, ReceiverStatusNotSpecified} +} + +// RecurrenceFrequency enumerates the values for recurrence frequency. +type RecurrenceFrequency string + +const ( + // RecurrenceFrequencyDay ... + RecurrenceFrequencyDay RecurrenceFrequency = "Day" + // RecurrenceFrequencyHour ... + RecurrenceFrequencyHour RecurrenceFrequency = "Hour" + // RecurrenceFrequencyMinute ... + RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" + // RecurrenceFrequencyMonth ... + RecurrenceFrequencyMonth RecurrenceFrequency = "Month" + // RecurrenceFrequencyNone ... + RecurrenceFrequencyNone RecurrenceFrequency = "None" + // RecurrenceFrequencySecond ... + RecurrenceFrequencySecond RecurrenceFrequency = "Second" + // RecurrenceFrequencyWeek ... + RecurrenceFrequencyWeek RecurrenceFrequency = "Week" + // RecurrenceFrequencyYear ... + RecurrenceFrequencyYear RecurrenceFrequency = "Year" +) + +// PossibleRecurrenceFrequencyValues returns an array of possible values for the RecurrenceFrequency const type. +func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { + return []RecurrenceFrequency{RecurrenceFrequencyDay, RecurrenceFrequencyHour, RecurrenceFrequencyMinute, RecurrenceFrequencyMonth, RecurrenceFrequencyNone, RecurrenceFrequencySecond, RecurrenceFrequencyWeek, RecurrenceFrequencyYear} +} + +// ResultType enumerates the values for result type. +type ResultType string + +const ( + // ResultTypeData ... + ResultTypeData ResultType = "Data" + // ResultTypeMetadata ... + ResultTypeMetadata ResultType = "Metadata" +) + +// PossibleResultTypeValues returns an array of possible values for the ResultType const type. +func PossibleResultTypeValues() []ResultType { + return []ResultType{ResultTypeData, ResultTypeMetadata} +} + +// ScaleDirection enumerates the values for scale direction. +type ScaleDirection string + +const ( + // ScaleDirectionDecrease ... + ScaleDirectionDecrease ScaleDirection = "Decrease" + // ScaleDirectionIncrease ... + ScaleDirectionIncrease ScaleDirection = "Increase" + // ScaleDirectionNone ... + ScaleDirectionNone ScaleDirection = "None" +) + +// PossibleScaleDirectionValues returns an array of possible values for the ScaleDirection const type. +func PossibleScaleDirectionValues() []ScaleDirection { + return []ScaleDirection{ScaleDirectionDecrease, ScaleDirectionIncrease, ScaleDirectionNone} +} + +// ScaleRuleMetricDimensionOperationType enumerates the values for scale rule metric dimension operation type. +type ScaleRuleMetricDimensionOperationType string + +const ( + // ScaleRuleMetricDimensionOperationTypeEquals ... + ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" + // ScaleRuleMetricDimensionOperationTypeNotEquals ... + ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" +) + +// PossibleScaleRuleMetricDimensionOperationTypeValues returns an array of possible values for the ScaleRuleMetricDimensionOperationType const type. +func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { + return []ScaleRuleMetricDimensionOperationType{ScaleRuleMetricDimensionOperationTypeEquals, ScaleRuleMetricDimensionOperationTypeNotEquals} +} + +// ScaleType enumerates the values for scale type. +type ScaleType string + +const ( + // ScaleTypeChangeCount ... + ScaleTypeChangeCount ScaleType = "ChangeCount" + // ScaleTypeExactCount ... + ScaleTypeExactCount ScaleType = "ExactCount" + // ScaleTypePercentChangeCount ... + ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" + // ScaleTypeServiceAllowedNextValue ... + ScaleTypeServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" +) + +// PossibleScaleTypeValues returns an array of possible values for the ScaleType const type. +func PossibleScaleTypeValues() []ScaleType { + return []ScaleType{ScaleTypeChangeCount, ScaleTypeExactCount, ScaleTypePercentChangeCount, ScaleTypeServiceAllowedNextValue} +} + +// TimeAggregationOperator enumerates the values for time aggregation operator. +type TimeAggregationOperator string + +const ( + // TimeAggregationOperatorAverage ... + TimeAggregationOperatorAverage TimeAggregationOperator = "Average" + // TimeAggregationOperatorLast ... + TimeAggregationOperatorLast TimeAggregationOperator = "Last" + // TimeAggregationOperatorMaximum ... + TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" + // TimeAggregationOperatorMinimum ... + TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" + // TimeAggregationOperatorTotal ... + TimeAggregationOperatorTotal TimeAggregationOperator = "Total" +) + +// PossibleTimeAggregationOperatorValues returns an array of possible values for the TimeAggregationOperator const type. +func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { + return []TimeAggregationOperator{TimeAggregationOperatorAverage, TimeAggregationOperatorLast, TimeAggregationOperatorMaximum, TimeAggregationOperatorMinimum, TimeAggregationOperatorTotal} +} + +// TimeAggregationType enumerates the values for time aggregation type. +type TimeAggregationType string + +const ( + // TimeAggregationTypeAverage ... + TimeAggregationTypeAverage TimeAggregationType = "Average" + // TimeAggregationTypeCount ... + TimeAggregationTypeCount TimeAggregationType = "Count" + // TimeAggregationTypeLast ... + TimeAggregationTypeLast TimeAggregationType = "Last" + // TimeAggregationTypeMaximum ... + TimeAggregationTypeMaximum TimeAggregationType = "Maximum" + // TimeAggregationTypeMinimum ... + TimeAggregationTypeMinimum TimeAggregationType = "Minimum" + // TimeAggregationTypeTotal ... + TimeAggregationTypeTotal TimeAggregationType = "Total" +) + +// PossibleTimeAggregationTypeValues returns an array of possible values for the TimeAggregationType const type. +func PossibleTimeAggregationTypeValues() []TimeAggregationType { + return []TimeAggregationType{TimeAggregationTypeAverage, TimeAggregationTypeCount, TimeAggregationTypeLast, TimeAggregationTypeMaximum, TimeAggregationTypeMinimum, TimeAggregationTypeTotal} +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/eventcategories.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/eventcategories.go new file mode 100644 index 000000000000..f43c5468ac51 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/eventcategories.go @@ -0,0 +1,99 @@ +package insights + +// 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" +) + +// EventCategoriesClient is the monitor Management Client +type EventCategoriesClient struct { + BaseClient +} + +// NewEventCategoriesClient creates an instance of the EventCategoriesClient client. +func NewEventCategoriesClient(subscriptionID string) EventCategoriesClient { + return NewEventCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventCategoriesClientWithBaseURI creates an instance of the EventCategoriesClient 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 NewEventCategoriesClientWithBaseURI(baseURI string, subscriptionID string) EventCategoriesClient { + return EventCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get the list of available event categories supported in the Activity Logs Service.
The current list includes +// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. +func (client EventCategoriesClient) List(ctx context.Context) (result EventCategoryCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventCategoriesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.EventCategoriesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EventCategoriesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Insights/eventcategories"), + 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 EventCategoriesClient) 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 EventCategoriesClient) ListResponder(resp *http.Response) (result EventCategoryCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/insightsapi/interfaces.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/insightsapi/interfaces.go new file mode 100644 index 000000000000..f983cceafc80 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/insightsapi/interfaces.go @@ -0,0 +1,295 @@ +package insightsapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights" + "github.com/Azure/go-autorest/autorest" +) + +// AutoscaleSettingsClientAPI contains the set of methods on the AutoscaleSettingsClient type. +type AutoscaleSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters insights.AutoscaleSettingResource) (result insights.AutoscaleSettingResource, err error) + Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string) (result insights.AutoscaleSettingResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AutoscaleSettingResourceCollectionIterator, err error) + ListBySubscription(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result insights.AutoscaleSettingResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource insights.AutoscaleSettingResourcePatch) (result insights.AutoscaleSettingResource, err error) +} + +var _ AutoscaleSettingsClientAPI = (*insights.AutoscaleSettingsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result insights.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*insights.OperationsClient)(nil) + +// AlertRuleIncidentsClientAPI contains the set of methods on the AlertRuleIncidentsClient type. +type AlertRuleIncidentsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string) (result insights.Incident, err error) + ListByAlertRule(ctx context.Context, resourceGroupName string, ruleName string) (result insights.IncidentListResult, err error) +} + +var _ AlertRuleIncidentsClientAPI = (*insights.AlertRuleIncidentsClient)(nil) + +// AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. +type AlertRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.AlertRuleResource) (result insights.AlertRuleResource, err error) + Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.AlertRuleResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleResourceCollection, err error) + ListBySubscription(ctx context.Context) (result insights.AlertRuleResourceCollection, err error) + Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource insights.AlertRuleResourcePatch) (result insights.AlertRuleResource, err error) +} + +var _ AlertRulesClientAPI = (*insights.AlertRulesClient)(nil) + +// LogProfilesClientAPI contains the set of methods on the LogProfilesClient type. +type LogProfilesClientAPI interface { + CreateOrUpdate(ctx context.Context, logProfileName string, parameters insights.LogProfileResource) (result insights.LogProfileResource, err error) + Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) + Get(ctx context.Context, logProfileName string) (result insights.LogProfileResource, err error) + List(ctx context.Context) (result insights.LogProfileCollection, err error) + Update(ctx context.Context, logProfileName string, logProfilesResource insights.LogProfileResourcePatch) (result insights.LogProfileResource, err error) +} + +var _ LogProfilesClientAPI = (*insights.LogProfilesClient)(nil) + +// DiagnosticSettingsClientAPI contains the set of methods on the DiagnosticSettingsClient type. +type DiagnosticSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceURI string, parameters insights.DiagnosticSettingsResource, name string) (result insights.DiagnosticSettingsResource, err error) + Delete(ctx context.Context, resourceURI string, name string) (result autorest.Response, err error) + Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsResource, err error) + List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsResourceCollection, err error) +} + +var _ DiagnosticSettingsClientAPI = (*insights.DiagnosticSettingsClient)(nil) + +// DiagnosticSettingsCategoryClientAPI contains the set of methods on the DiagnosticSettingsCategoryClient type. +type DiagnosticSettingsCategoryClientAPI interface { + Get(ctx context.Context, resourceURI string, name string) (result insights.DiagnosticSettingsCategoryResource, err error) + List(ctx context.Context, resourceURI string) (result insights.DiagnosticSettingsCategoryResourceCollection, err error) +} + +var _ DiagnosticSettingsCategoryClientAPI = (*insights.DiagnosticSettingsCategoryClient)(nil) + +// ActionGroupsClientAPI contains the set of methods on the ActionGroupsClient type. +type ActionGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup insights.ActionGroupResource) (result insights.ActionGroupResource, err error) + Delete(ctx context.Context, resourceGroupName string, actionGroupName string) (result autorest.Response, err error) + EnableReceiver(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest insights.EnableRequest) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, actionGroupName string) (result insights.ActionGroupResource, err error) + GetTestNotifications(ctx context.Context, notificationID string) (result insights.TestNotificationDetailsResponse, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ActionGroupList, err error) + ListBySubscriptionID(ctx context.Context) (result insights.ActionGroupList, err error) + PostTestNotifications(ctx context.Context, notificationRequest insights.NotificationRequestBody) (result insights.ActionGroupsPostTestNotificationsFuture, err error) + Update(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch insights.ActionGroupPatchBody) (result insights.ActionGroupResource, err error) +} + +var _ ActionGroupsClientAPI = (*insights.ActionGroupsClient)(nil) + +// ActivityLogsClientAPI contains the set of methods on the ActivityLogsClient type. +type ActivityLogsClientAPI interface { + List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) +} + +var _ ActivityLogsClientAPI = (*insights.ActivityLogsClient)(nil) + +// EventCategoriesClientAPI contains the set of methods on the EventCategoriesClient type. +type EventCategoriesClientAPI interface { + List(ctx context.Context) (result insights.EventCategoryCollection, err error) +} + +var _ EventCategoriesClientAPI = (*insights.EventCategoriesClient)(nil) + +// TenantActivityLogsClientAPI contains the set of methods on the TenantActivityLogsClient type. +type TenantActivityLogsClientAPI interface { + List(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string) (result insights.EventDataCollectionIterator, err error) +} + +var _ TenantActivityLogsClientAPI = (*insights.TenantActivityLogsClient)(nil) + +// MetricDefinitionsClientAPI contains the set of methods on the MetricDefinitionsClient type. +type MetricDefinitionsClientAPI interface { + List(ctx context.Context, resourceURI string, metricnamespace string) (result insights.MetricDefinitionCollection, err error) +} + +var _ MetricDefinitionsClientAPI = (*insights.MetricDefinitionsClient)(nil) + +// MetricsClientAPI contains the set of methods on the MetricsClient type. +type MetricsClientAPI interface { + List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType insights.ResultType, metricnamespace string) (result insights.Response, err error) +} + +var _ MetricsClientAPI = (*insights.MetricsClient)(nil) + +// BaselinesClientAPI contains the set of methods on the BaselinesClient type. +type BaselinesClientAPI interface { + List(ctx context.Context, resourceURI string, metricnames string, metricnamespace string, timespan string, interval *string, aggregation string, sensitivities string, filter string, resultType insights.ResultType) (result insights.MetricBaselinesResponse, err error) +} + +var _ BaselinesClientAPI = (*insights.BaselinesClient)(nil) + +// MetricAlertsClientAPI contains the set of methods on the MetricAlertsClient type. +type MetricAlertsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResource) (result insights.MetricAlertResource, err error) + Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.MetricAlertResourceCollection, err error) + ListBySubscription(ctx context.Context) (result insights.MetricAlertResourceCollection, err error) + Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.MetricAlertResourcePatch) (result insights.MetricAlertResource, err error) +} + +var _ MetricAlertsClientAPI = (*insights.MetricAlertsClient)(nil) + +// MetricAlertsStatusClientAPI contains the set of methods on the MetricAlertsStatusClient type. +type MetricAlertsStatusClientAPI interface { + List(ctx context.Context, resourceGroupName string, ruleName string) (result insights.MetricAlertStatusCollection, err error) + ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result insights.MetricAlertStatusCollection, err error) +} + +var _ MetricAlertsStatusClientAPI = (*insights.MetricAlertsStatusClient)(nil) + +// ScheduledQueryRulesClientAPI contains the set of methods on the ScheduledQueryRulesClient type. +type ScheduledQueryRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResource) (result insights.LogSearchRuleResource, err error) + Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, ruleName string) (result insights.LogSearchRuleResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result insights.LogSearchRuleResourceCollection, err error) + ListBySubscription(ctx context.Context, filter string) (result insights.LogSearchRuleResourceCollection, err error) + Update(ctx context.Context, resourceGroupName string, ruleName string, parameters insights.LogSearchRuleResourcePatch) (result insights.LogSearchRuleResource, err error) +} + +var _ ScheduledQueryRulesClientAPI = (*insights.ScheduledQueryRulesClient)(nil) + +// MetricNamespacesClientAPI contains the set of methods on the MetricNamespacesClient type. +type MetricNamespacesClientAPI interface { + List(ctx context.Context, resourceURI string, startTime string) (result insights.MetricNamespaceCollection, err error) +} + +var _ MetricNamespacesClientAPI = (*insights.MetricNamespacesClient)(nil) + +// VMInsightsClientAPI contains the set of methods on the VMInsightsClient type. +type VMInsightsClientAPI interface { + GetOnboardingStatus(ctx context.Context, resourceURI string) (result insights.VMInsightsOnboardingStatus, err error) +} + +var _ VMInsightsClientAPI = (*insights.VMInsightsClient)(nil) + +// PrivateLinkScopesClientAPI contains the set of methods on the PrivateLinkScopesClient type. +type PrivateLinkScopesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload insights.AzureMonitorPrivateLinkScope) (result insights.AzureMonitorPrivateLinkScope, err error) + Delete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkScopesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, scopeName string) (result insights.AzureMonitorPrivateLinkScope, err error) + List(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) + ListComplete(ctx context.Context) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AzureMonitorPrivateLinkScopeListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags insights.TagsResource) (result insights.AzureMonitorPrivateLinkScope, err error) +} + +var _ PrivateLinkScopesClientAPI = (*insights.PrivateLinkScopesClient)(nil) + +// PrivateLinkScopeOperationStatusClientAPI contains the set of methods on the PrivateLinkScopeOperationStatusClient type. +type PrivateLinkScopeOperationStatusClientAPI interface { + Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result insights.OperationStatus, err error) +} + +var _ PrivateLinkScopeOperationStatusClientAPI = (*insights.PrivateLinkScopeOperationStatusClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result insights.PrivateLinkResource, err error) + ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultPage, err error) + ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateLinkResourceListResultIterator, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*insights.PrivateLinkResourcesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters insights.PrivateEndpointConnection) (result insights.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result insights.PrivateEndpointConnection, err error) + ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultPage, err error) + ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.PrivateEndpointConnectionListResultIterator, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*insights.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkScopedResourcesClientAPI contains the set of methods on the PrivateLinkScopedResourcesClient type. +type PrivateLinkScopedResourcesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters insights.ScopedResource) (result insights.PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.PrivateLinkScopedResourcesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result insights.ScopedResource, err error) + ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultPage, err error) + ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result insights.ScopedResourceListResultIterator, err error) +} + +var _ PrivateLinkScopedResourcesClientAPI = (*insights.PrivateLinkScopedResourcesClient)(nil) + +// ActivityLogAlertsClientAPI contains the set of methods on the ActivityLogAlertsClient type. +type ActivityLogAlertsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule insights.ActivityLogAlertResource) (result insights.ActivityLogAlertResource, err error) + Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, activityLogAlertName string) (result insights.ActivityLogAlertResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.AlertRuleListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.AlertRuleListIterator, err error) + ListBySubscriptionID(ctx context.Context) (result insights.AlertRuleListPage, err error) + ListBySubscriptionIDComplete(ctx context.Context) (result insights.AlertRuleListIterator, err error) + Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch insights.AlertRulePatchObject) (result insights.ActivityLogAlertResource, err error) +} + +var _ ActivityLogAlertsClientAPI = (*insights.ActivityLogAlertsClient)(nil) + +// DataCollectionEndpointsClientAPI contains the set of methods on the DataCollectionEndpointsClient type. +type DataCollectionEndpointsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *insights.DataCollectionEndpointResource) (result insights.DataCollectionEndpointResource, err error) + Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string) (result insights.DataCollectionEndpointResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.DataCollectionEndpointResourceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.DataCollectionEndpointResourceListResultIterator, err error) + ListBySubscription(ctx context.Context) (result insights.DataCollectionEndpointResourceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result insights.DataCollectionEndpointResourceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, body *insights.ResourceForUpdate) (result insights.DataCollectionEndpointResource, err error) +} + +var _ DataCollectionEndpointsClientAPI = (*insights.DataCollectionEndpointsClient)(nil) + +// DataCollectionRuleAssociationsClientAPI contains the set of methods on the DataCollectionRuleAssociationsClient type. +type DataCollectionRuleAssociationsClientAPI interface { + Create(ctx context.Context, resourceURI string, associationName string, body *insights.DataCollectionRuleAssociationProxyOnlyResource) (result insights.DataCollectionRuleAssociationProxyOnlyResource, err error) + Delete(ctx context.Context, resourceURI string, associationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceURI string, associationName string) (result insights.DataCollectionRuleAssociationProxyOnlyResource, err error) + ListByResource(ctx context.Context, resourceURI string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceURI string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) + ListByRule(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultPage, err error) + ListByRuleComplete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleAssociationProxyOnlyResourceListResultIterator, err error) +} + +var _ DataCollectionRuleAssociationsClientAPI = (*insights.DataCollectionRuleAssociationsClient)(nil) + +// DataCollectionRulesClientAPI contains the set of methods on the DataCollectionRulesClient type. +type DataCollectionRulesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *insights.DataCollectionRuleResource) (result insights.DataCollectionRuleResource, err error) + Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string) (result insights.DataCollectionRuleResource, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.DataCollectionRuleResourceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.DataCollectionRuleResourceListResultIterator, err error) + ListBySubscription(ctx context.Context) (result insights.DataCollectionRuleResourceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result insights.DataCollectionRuleResourceListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, body *insights.ResourceForUpdate) (result insights.DataCollectionRuleResource, err error) +} + +var _ DataCollectionRulesClientAPI = (*insights.DataCollectionRulesClient)(nil) diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/logprofiles.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/logprofiles.go new file mode 100644 index 000000000000..cfa5e8be2997 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/logprofiles.go @@ -0,0 +1,444 @@ +package insights + +// 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" +) + +// LogProfilesClient is the monitor Management Client +type LogProfilesClient struct { + BaseClient +} + +// NewLogProfilesClient creates an instance of the LogProfilesClient client. +func NewLogProfilesClient(subscriptionID string) LogProfilesClient { + return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient 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 NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient { + return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a log profile in Azure Monitoring REST API. +// Parameters: +// logProfileName - the name of the log profile. +// parameters - parameters supplied to the operation. +func (client LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + }}, + }}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, logProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LogProfilesClient) CreateOrUpdatePreparer(ctx context.Context, logProfileName string, parameters LogProfileResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the log profile. +// Parameters: +// logProfileName - the name of the log profile. +func (client LogProfilesClient) Delete(ctx context.Context, logProfileName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LogProfilesClient) DeletePreparer(ctx context.Context, logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the log profile. +// Parameters: +// logProfileName - the name of the log profile. +func (client LogProfilesClient) Get(ctx context.Context, logProfileName string) (result LogProfileResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, logProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LogProfilesClient) GetPreparer(ctx context.Context, logProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the log profiles. +func (client LogProfilesClient) List(ctx context.Context) (result LogProfileCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.List") + 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}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LogProfilesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. +// Parameters: +// logProfileName - the name of the log profile. +// logProfilesResource - parameters supplied to the operation. +func (client LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (result LogProfileResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LogProfilesClient.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}}}}); err != nil { + return result, validation.NewError("insights.LogProfilesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, logProfileName, logProfilesResource) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.LogProfilesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LogProfilesClient) UpdatePreparer(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "logProfileName": autorest.Encode("path", logProfileName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2016-03-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}/providers/Microsoft.Insights/logprofiles/{logProfileName}", pathParameters), + autorest.WithJSON(logProfilesResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LogProfilesClient) 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 LogProfilesClient) UpdateResponder(resp *http.Response) (result LogProfileResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricalerts.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricalerts.go new file mode 100644 index 000000000000..f9706664d9be --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricalerts.go @@ -0,0 +1,545 @@ +package insights + +// 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" +) + +// MetricAlertsClient is the monitor Management Client +type MetricAlertsClient struct { + BaseClient +} + +// NewMetricAlertsClient creates an instance of the MetricAlertsClient client. +func NewMetricAlertsClient(subscriptionID string) MetricAlertsClient { + return NewMetricAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricAlertsClientWithBaseURI creates an instance of the MetricAlertsClient 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 NewMetricAlertsClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsClient { + return MetricAlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update an metric alert definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// parameters - the parameters of the rule to create or update. +func (client MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (result MetricAlertResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.MetricAlertProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.MetricAlertProperties.Severity", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.Scopes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.EvaluationFrequency", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.MetricAlertProperties.WindowSize", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MetricAlertsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MetricAlertsClient) 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 MetricAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result MetricAlertResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete an alert rule definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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("insights.MetricAlertsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MetricAlertsClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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.Insights/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve an alert rule definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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("insights.MetricAlertsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MetricAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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.Insights/metricAlerts/{ruleName}", 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 MetricAlertsClient) 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 MetricAlertsClient) GetResponder(resp *http.Response) (result MetricAlertResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup retrieve alert rule definitions in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client MetricAlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MetricAlertResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListByResourceGroup") + 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("insights.MetricAlertsClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client MetricAlertsClient) 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 = "2018-03-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.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription retrieve alert rule definitions in a subscription. +func (client MetricAlertsClient) ListBySubscription(ctx context.Context) (result MetricAlertResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.ListBySubscription") + 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}}}}); err != nil { + return result, validation.NewError("insights.MetricAlertsClient", "ListBySubscription", err.Error()) + } + + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client MetricAlertsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts", 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 MetricAlertsClient) 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 MetricAlertsClient) ListBySubscriptionResponder(resp *http.Response) (result MetricAlertResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update an metric alert definition. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// parameters - the parameters of the rule to update. +func (client MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (result MetricAlertResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsClient.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("insights.MetricAlertsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MetricAlertsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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.Insights/metricAlerts/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MetricAlertsClient) 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 MetricAlertsClient) UpdateResponder(resp *http.Response) (result MetricAlertResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricalertsstatus.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricalertsstatus.go new file mode 100644 index 000000000000..4709142160be --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricalertsstatus.go @@ -0,0 +1,205 @@ +package insights + +// 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" +) + +// MetricAlertsStatusClient is the monitor Management Client +type MetricAlertsStatusClient struct { + BaseClient +} + +// NewMetricAlertsStatusClient creates an instance of the MetricAlertsStatusClient client. +func NewMetricAlertsStatusClient(subscriptionID string) MetricAlertsStatusClient { + return NewMetricAlertsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricAlertsStatusClientWithBaseURI creates an instance of the MetricAlertsStatusClient 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 NewMetricAlertsStatusClientWithBaseURI(baseURI string, subscriptionID string) MetricAlertsStatusClient { + return MetricAlertsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List retrieve an alert rule status. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string) (result MetricAlertStatusCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.List") + 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("insights.MetricAlertsStatusClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MetricAlertsStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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.Insights/metricAlerts/{ruleName}/status", 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 MetricAlertsStatusClient) 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 MetricAlertsStatusClient) ListResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByName retrieve an alert rule status. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// statusName - the name of the status. +func (client MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (result MetricAlertStatusCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricAlertsStatusClient.ListByName") + 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("insights.MetricAlertsStatusClient", "ListByName", err.Error()) + } + + req, err := client.ListByNamePreparer(ctx, resourceGroupName, ruleName, statusName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure sending request") + return + } + + result, err = client.ListByNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricAlertsStatusClient", "ListByName", resp, "Failure responding to request") + return + } + + return +} + +// ListByNamePreparer prepares the ListByName request. +func (client MetricAlertsStatusClient) ListByNamePreparer(ctx context.Context, resourceGroupName string, ruleName string, statusName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "statusName": autorest.Encode("path", statusName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-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.Insights/metricAlerts/{ruleName}/status/{statusName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByNameSender sends the ListByName request. The method will close the +// http.Response Body if it receives an error. +func (client MetricAlertsStatusClient) ListByNameSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByNameResponder handles the response to the ListByName request. The method always +// closes the http.Response Body. +func (client MetricAlertsStatusClient) ListByNameResponder(resp *http.Response) (result MetricAlertStatusCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricdefinitions.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricdefinitions.go new file mode 100644 index 000000000000..34383acfb3e7 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricdefinitions.go @@ -0,0 +1,116 @@ +package insights + +// 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" +) + +// MetricDefinitionsClient is the monitor Management Client +type MetricDefinitionsClient struct { + BaseClient +} + +// NewMetricDefinitionsClient creates an instance of the MetricDefinitionsClient client. +func NewMetricDefinitionsClient(subscriptionID string) MetricDefinitionsClient { + return NewMetricDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricDefinitionsClientWithBaseURI creates an instance of the MetricDefinitionsClient 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 NewMetricDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) MetricDefinitionsClient { + return MetricDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the metric definitions for the resource. +// Parameters: +// resourceURI - the identifier of the resource. +// metricnamespace - metric namespace to query metric definitions for. +func (client MetricDefinitionsClient) List(ctx context.Context, resourceURI string, metricnamespace string) (result MetricDefinitionCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricDefinitionsClient.List") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricDefinitionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceURI, metricnamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricDefinitionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MetricDefinitionsClient) ListPreparer(ctx context.Context, resourceURI string, metricnamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2018-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions", 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 MetricDefinitionsClient) 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 MetricDefinitionsClient) ListResponder(resp *http.Response) (result MetricDefinitionCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricnamespaces.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricnamespaces.go new file mode 100644 index 000000000000..a1a70c21f9d6 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metricnamespaces.go @@ -0,0 +1,116 @@ +package insights + +// 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" +) + +// MetricNamespacesClient is the monitor Management Client +type MetricNamespacesClient struct { + BaseClient +} + +// NewMetricNamespacesClient creates an instance of the MetricNamespacesClient client. +func NewMetricNamespacesClient(subscriptionID string) MetricNamespacesClient { + return NewMetricNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricNamespacesClientWithBaseURI creates an instance of the MetricNamespacesClient 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 NewMetricNamespacesClientWithBaseURI(baseURI string, subscriptionID string) MetricNamespacesClient { + return MetricNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the metric namespaces for the resource. +// Parameters: +// resourceURI - the identifier of the resource. +// startTime - the ISO 8601 conform Date start time from which to query for metric namespaces. +func (client MetricNamespacesClient) List(ctx context.Context, resourceURI string, startTime string) (result MetricNamespaceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricNamespacesClient.List") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricNamespacesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceURI, startTime) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricNamespacesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MetricNamespacesClient) ListPreparer(ctx context.Context, resourceURI string, startTime string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2017-12-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(startTime) > 0 { + queryParameters["startTime"] = autorest.Encode("query", startTime) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/metricNamespaces", 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 MetricNamespacesClient) 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 MetricNamespacesClient) ListResponder(resp *http.Response) (result MetricNamespaceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/metrics.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metrics.go new file mode 100644 index 000000000000..297183565d38 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/metrics.go @@ -0,0 +1,163 @@ +package insights + +// 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" +) + +// MetricsClient is the monitor Management Client +type MetricsClient struct { + BaseClient +} + +// NewMetricsClient creates an instance of the MetricsClient client. +func NewMetricsClient(subscriptionID string) MetricsClient { + return NewMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMetricsClientWithBaseURI creates an instance of the MetricsClient 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 NewMetricsClientWithBaseURI(baseURI string, subscriptionID string) MetricsClient { + return MetricsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List **Lists the metric values for a resource**. +// Parameters: +// resourceURI - the identifier of the resource. +// timespan - the timespan of the query. It is a string with the following format +// 'startDateTime_ISO/endDateTime_ISO'. +// interval - the interval (i.e. timegrain) of the query. +// metricnames - the names of the metrics (comma separated) to retrieve. Special case: If a metricname itself +// has a comma in it then use %2 to indicate it. Eg: 'Metric,Name1' should be **'Metric%2Name1'** +// aggregation - the list of aggregation types (comma separated) to retrieve. +// top - the maximum number of records to retrieve. +// Valid only if $filter is specified. +// Defaults to 10. +// orderby - the aggregation to use for sorting results and the direction of the sort. +// Only one order can be specified. +// Examples: sum asc. +// filter - the **$filter** is used to reduce the set of metric data returned. Example: Metric contains +// metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **$filter=A eq 'a1' and B +// eq 'b1' or B eq 'b2' and C eq '*'** - Invalid variant: **$filter=A eq 'a1' and B eq 'b1' and C eq '*' or B = +// 'b2'** This is invalid because the logical or operator cannot separate two different metadata names. - +// Return all time series where A = a1, B = b1 and C = c1: **$filter=A eq 'a1' and B eq 'b1' and C eq 'c1'** - +// Return all time series where A = a1 **$filter=A eq 'a1' and B eq '*' and C eq '*'**. Special case: When +// dimension name or dimension value uses round brackets. Eg: When dimension name is **dim (test) 1** Instead +// of using $filter= "dim (test) 1 eq '*' " use **$filter= "dim %2528test%2529 1 eq '*' "** When dimension name +// is **dim (test) 3** and dimension value is **dim3 (test) val** Instead of using $filter= "dim (test) 3 eq +// 'dim3 (test) val' " use **$filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "** +// resultType - reduces the set of data collected. The syntax allowed depends on the operation. See the +// operation's description for details. +// metricnamespace - metric namespace to query metric definitions for. +func (client MetricsClient) List(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (result Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MetricsClient.List") + 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: resourceURI, + Constraints: []validation.Constraint{{Target: "resourceURI", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.MetricsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceURI, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.MetricsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MetricsClient) ListPreparer(ctx context.Context, resourceURI string, timespan string, interval *string, metricnames string, aggregation string, top *int32, orderby string, filter string, resultType ResultType, metricnamespace string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2018-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(timespan) > 0 { + queryParameters["timespan"] = autorest.Encode("query", timespan) + } + if interval != nil { + queryParameters["interval"] = autorest.Encode("query", *interval) + } + if len(metricnames) > 0 { + queryParameters["metricnames"] = autorest.Encode("query", metricnames) + } + if len(aggregation) > 0 { + queryParameters["aggregation"] = autorest.Encode("query", aggregation) + } + if top != nil { + queryParameters["top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["orderby"] = autorest.Encode("query", orderby) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(string(resultType)) > 0 { + queryParameters["resultType"] = autorest.Encode("query", resultType) + } + if len(metricnamespace) > 0 { + queryParameters["metricnamespace"] = autorest.Encode("query", metricnamespace) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/metrics", 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 MetricsClient) 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 MetricsClient) ListResponder(resp *http.Response) (result Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/models.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/models.go new file mode 100644 index 000000000000..1b1c47535ed5 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/models.go @@ -0,0 +1,9041 @@ +package insights + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-09-01-preview/insights" + +// BasicAction action descriptor. +type BasicAction interface { + AsAlertingAction() (*AlertingAction, bool) + AsLogToMetricAction() (*LogToMetricAction, bool) + AsAction() (*Action, bool) +} + +// Action action descriptor. +type Action struct { + // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' + OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` +} + +func unmarshalBasicAction(body []byte) (BasicAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction): + var aa AlertingAction + err := json.Unmarshal(body, &aa) + return aa, err + case string(OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction): + var ltma LogToMetricAction + err := json.Unmarshal(body, <ma) + return ltma, err + default: + var a Action + err := json.Unmarshal(body, &a) + return a, err + } +} +func unmarshalBasicActionArray(body []byte) ([]BasicAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aArray := make([]BasicAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + a, err := unmarshalBasicAction(*rawMessage) + if err != nil { + return nil, err + } + aArray[index] = a + } + return aArray, nil +} + +// MarshalJSON is the custom marshaler for Action. +func (a Action) MarshalJSON() ([]byte, error) { + a.OdataType = OdataTypeBasicActionOdataTypeAction + objectMap := make(map[string]interface{}) + if a.OdataType != "" { + objectMap["odata.type"] = a.OdataType + } + return json.Marshal(objectMap) +} + +// AsAlertingAction is the BasicAction implementation for Action. +func (a Action) AsAlertingAction() (*AlertingAction, bool) { + return nil, false +} + +// AsLogToMetricAction is the BasicAction implementation for Action. +func (a Action) AsLogToMetricAction() (*LogToMetricAction, bool) { + return nil, false +} + +// AsAction is the BasicAction implementation for Action. +func (a Action) AsAction() (*Action, bool) { + return &a, true +} + +// AsBasicAction is the BasicAction implementation for Action. +func (a Action) AsBasicAction() (BasicAction, bool) { + return &a, true +} + +// ActionDetail the action detail +type ActionDetail struct { + // MechanismType - The mechanism type + MechanismType *string `json:"MechanismType,omitempty"` + // Name - The name of the action + Name *string `json:"Name,omitempty"` + // Status - The status of the action + Status *string `json:"Status,omitempty"` + // SubState - The substatus of the action + SubState *string `json:"SubState,omitempty"` + // SendTime - The send time + SendTime *string `json:"SendTime,omitempty"` + // Detail - The detail of the friendly error message + Detail *string `json:"Detail,omitempty"` +} + +// ActionGroup an Azure action group. +type ActionGroup struct { + // GroupShortName - The short name of the action group. This will be used in SMS messages. + GroupShortName *string `json:"groupShortName,omitempty"` + // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + Enabled *bool `json:"enabled,omitempty"` + // EmailReceivers - The list of email receivers that are part of this action group. + EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` + // SmsReceivers - The list of SMS receivers that are part of this action group. + SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` + // WebhookReceivers - The list of webhook receivers that are part of this action group. + WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` + // ItsmReceivers - The list of ITSM receivers that are part of this action group. + ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` + // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` + // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` + // VoiceReceivers - The list of voice receivers that are part of this action group. + VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` + // LogicAppReceivers - The list of logic app receivers that are part of this action group. + LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` + // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. + AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` + // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. + ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` + // EventHubReceivers - The list of event hub receivers that are part of this action group. + EventHubReceivers *[]EventHubReceiver `json:"eventHubReceivers,omitempty"` +} + +// ActionGroupList a list of action groups. +type ActionGroupList struct { + autorest.Response `json:"-"` + // Value - The list of action groups. + Value *[]ActionGroupResource `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// ActionGroupPatch an Azure action group for patch operations. +type ActionGroupPatch struct { + // Enabled - Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + +// ActionGroupPatchBody an action group object for the body of patch operations. +type ActionGroupPatchBody struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // ActionGroupPatch - The action group settings for an update operation. + *ActionGroupPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActionGroupPatchBody. +func (agpb ActionGroupPatchBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpb.Tags != nil { + objectMap["tags"] = agpb.Tags + } + if agpb.ActionGroupPatch != nil { + objectMap["properties"] = agpb.ActionGroupPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionGroupPatchBody struct. +func (agpb *ActionGroupPatchBody) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agpb.Tags = tags + } + case "properties": + if v != nil { + var actionGroupPatch ActionGroupPatch + err = json.Unmarshal(*v, &actionGroupPatch) + if err != nil { + return err + } + agpb.ActionGroupPatch = &actionGroupPatch + } + } + } + + return nil +} + +// ActionGroupResource an action group resource. +type ActionGroupResource struct { + autorest.Response `json:"-"` + // ActionGroup - The action groups properties of the resource. + *ActionGroup `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ActionGroupResource. +func (agr ActionGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agr.ActionGroup != nil { + objectMap["properties"] = agr.ActionGroup + } + if agr.Location != nil { + objectMap["location"] = agr.Location + } + if agr.Tags != nil { + objectMap["tags"] = agr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActionGroupResource struct. +func (agr *ActionGroupResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var actionGroup ActionGroup + err = json.Unmarshal(*v, &actionGroup) + if err != nil { + return err + } + agr.ActionGroup = &actionGroup + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agr.Type = &typeVar + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + agr.Kind = &kind + } + case "identity": + if v != nil { + var identity string + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + agr.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agr.Tags = tags + } + } + } + + return nil +} + +// ActionGroupsPostTestNotificationsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ActionGroupsPostTestNotificationsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ActionGroupsClient) (TestNotificationResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ActionGroupsPostTestNotificationsFuture) 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 ActionGroupsPostTestNotificationsFuture.Result. +func (future *ActionGroupsPostTestNotificationsFuture) result(client ActionGroupsClient) (tnr TestNotificationResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsPostTestNotificationsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("insights.ActionGroupsPostTestNotificationsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tnr.Response.Response, err = future.GetResult(sender); err == nil && tnr.Response.Response.StatusCode != http.StatusNoContent { + tnr, err = client.PostTestNotificationsResponder(tnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ActionGroupsPostTestNotificationsFuture", "Result", tnr.Response.Response, "Failure responding to request") + } + } + return +} + +// ActionList a list of Activity Log Alert rule actions. +type ActionList struct { + // ActionGroups - The list of the Action Groups. + ActionGroups *[]ActionGroup `json:"actionGroups,omitempty"` +} + +// ActivityLogAlertResource an Activity Log Alert rule resource. +type ActivityLogAlertResource struct { + autorest.Response `json:"-"` + // AlertRuleProperties - The Activity Log Alert rule properties of the resource. + *AlertRuleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ActivityLogAlertResource. +func (alar ActivityLogAlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if alar.AlertRuleProperties != nil { + objectMap["properties"] = alar.AlertRuleProperties + } + if alar.Location != nil { + objectMap["location"] = alar.Location + } + if alar.Tags != nil { + objectMap["tags"] = alar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ActivityLogAlertResource struct. +func (alar *ActivityLogAlertResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertRuleProperties AlertRuleProperties + err = json.Unmarshal(*v, &alertRuleProperties) + if err != nil { + return err + } + alar.AlertRuleProperties = &alertRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + alar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + alar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + alar.Type = &typeVar + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + alar.Kind = &kind + } + case "identity": + if v != nil { + var identity string + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + alar.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + alar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + alar.Tags = tags + } + } + } + + return nil +} + +// AlertingAction specify action need to be taken when rule type is Alert +type AlertingAction struct { + // Severity - Severity of the alert. Possible values include: 'AlertSeverityZero', 'AlertSeverityOne', 'AlertSeverityTwo', 'AlertSeverityThree', 'AlertSeverityFour' + Severity AlertSeverity `json:"severity,omitempty"` + // AznsAction - Azure action group reference. + AznsAction *AzNsActionGroup `json:"aznsAction,omitempty"` + // ThrottlingInMin - time (in minutes) for which Alerts should be throttled or suppressed. + ThrottlingInMin *int32 `json:"throttlingInMin,omitempty"` + // Trigger - The trigger condition that results in the alert rule being. + Trigger *TriggerCondition `json:"trigger,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' + OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertingAction. +func (aa AlertingAction) MarshalJSON() ([]byte, error) { + aa.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction + objectMap := make(map[string]interface{}) + if aa.Severity != "" { + objectMap["severity"] = aa.Severity + } + if aa.AznsAction != nil { + objectMap["aznsAction"] = aa.AznsAction + } + if aa.ThrottlingInMin != nil { + objectMap["throttlingInMin"] = aa.ThrottlingInMin + } + if aa.Trigger != nil { + objectMap["trigger"] = aa.Trigger + } + if aa.OdataType != "" { + objectMap["odata.type"] = aa.OdataType + } + return json.Marshal(objectMap) +} + +// AsAlertingAction is the BasicAction implementation for AlertingAction. +func (aa AlertingAction) AsAlertingAction() (*AlertingAction, bool) { + return &aa, true +} + +// AsLogToMetricAction is the BasicAction implementation for AlertingAction. +func (aa AlertingAction) AsLogToMetricAction() (*LogToMetricAction, bool) { + return nil, false +} + +// AsAction is the BasicAction implementation for AlertingAction. +func (aa AlertingAction) AsAction() (*Action, bool) { + return nil, false +} + +// AsBasicAction is the BasicAction implementation for AlertingAction. +func (aa AlertingAction) AsBasicAction() (BasicAction, bool) { + return &aa, true +} + +// AlertRule an alert rule. +type AlertRule struct { + // Name - the name of the alert rule. + Name *string `json:"name,omitempty"` + // Description - the description of the alert rule that will be included in the alert email. + Description *string `json:"description,omitempty"` + // ProvisioningState - the provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // IsEnabled - the flag that indicates whether the alert rule is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Condition - the condition that results in the alert rule being activated. + Condition BasicRuleCondition `json:"condition,omitempty"` + // Action - action that is performed when the alert rule becomes active, and when an alert condition is resolved. + Action BasicRuleAction `json:"action,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]BasicRuleAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRule. +func (ar AlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Name != nil { + objectMap["name"] = ar.Name + } + if ar.Description != nil { + objectMap["description"] = ar.Description + } + if ar.ProvisioningState != nil { + objectMap["provisioningState"] = ar.ProvisioningState + } + if ar.IsEnabled != nil { + objectMap["isEnabled"] = ar.IsEnabled + } + objectMap["condition"] = ar.Condition + objectMap["action"] = ar.Action + if ar.Actions != nil { + objectMap["actions"] = ar.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRule struct. +func (ar *AlertRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + ar.Description = &description + } + case "provisioningState": + if v != nil { + var provisioningState string + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + ar.ProvisioningState = &provisioningState + } + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + ar.IsEnabled = &isEnabled + } + case "condition": + if v != nil { + condition, err := unmarshalBasicRuleCondition(*v) + if err != nil { + return err + } + ar.Condition = condition + } + case "action": + if v != nil { + action, err := unmarshalBasicRuleAction(*v) + if err != nil { + return err + } + ar.Action = action + } + case "actions": + if v != nil { + actions, err := unmarshalBasicRuleActionArray(*v) + if err != nil { + return err + } + ar.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + ar.LastUpdatedTime = &lastUpdatedTime + } + } + } + + return nil +} + +// AlertRuleAllOfCondition an Activity Log Alert rule condition that is met when all its member conditions +// are met. +type AlertRuleAllOfCondition struct { + // AllOf - The list of Activity Log Alert rule conditions. + AllOf *[]AlertRuleAnyOfOrLeafCondition `json:"allOf,omitempty"` +} + +// AlertRuleAnyOfOrLeafCondition an Activity Log Alert rule condition that is met when all its member +// conditions are met. +// Each condition can be of one of the following types: +// __Important__: Each type has its unique subset of properties. Properties from different types CANNOT +// exist in one condition. +// * __Leaf Condition -__ must contain 'field' and either 'equals' or 'containsAny'. +// _Please note, 'anyOf' should __not__ be set in a Leaf Condition._ +// * __AnyOf Condition -__ must contain __only__ 'anyOf' (which is an array of Leaf Conditions). +// _Please note, 'field', 'equals' and 'containsAny' should __not__ be set in an AnyOf Condition._ +type AlertRuleAnyOfOrLeafCondition struct { + // AnyOf - An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. + AnyOf *[]AlertRuleLeafCondition `json:"anyOf,omitempty"` + // Field - The name of the Activity Log event's field that this condition will examine. + // The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. + Field *string `json:"field,omitempty"` + // Equals - The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. + Equals *string `json:"equals,omitempty"` + // ContainsAny - The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met. + ContainsAny *[]string `json:"containsAny,omitempty"` +} + +// AlertRuleLeafCondition an Activity Log Alert rule condition that is met by comparing the field and value +// of an Activity Log event. +// This condition must contain 'field' and either 'equals' or 'containsAny'. +type AlertRuleLeafCondition struct { + // Field - The name of the Activity Log event's field that this condition will examine. + // The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. + Field *string `json:"field,omitempty"` + // Equals - The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. + Equals *string `json:"equals,omitempty"` + // ContainsAny - The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met. + ContainsAny *[]string `json:"containsAny,omitempty"` +} + +// AlertRuleList a list of Activity Log Alert rules. +type AlertRuleList struct { + autorest.Response `json:"-"` + // Value - The list of Activity Log Alert rules. + Value *[]ActivityLogAlertResource `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of elements. + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertRuleListIterator provides access to a complete listing of ActivityLogAlertResource values. +type AlertRuleListIterator struct { + i int + page AlertRuleListPage +} + +// 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 *AlertRuleListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleListIterator.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 *AlertRuleListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AlertRuleListIterator) 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 AlertRuleListIterator) Response() AlertRuleList { + 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 AlertRuleListIterator) Value() ActivityLogAlertResource { + if !iter.page.NotDone() { + return ActivityLogAlertResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AlertRuleListIterator type. +func NewAlertRuleListIterator(page AlertRuleListPage) AlertRuleListIterator { + return AlertRuleListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arl AlertRuleList) IsEmpty() bool { + return arl.Value == nil || len(*arl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arl AlertRuleList) hasNextLink() bool { + return arl.NextLink != nil && len(*arl.NextLink) != 0 +} + +// alertRuleListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arl AlertRuleList) alertRuleListPreparer(ctx context.Context) (*http.Request, error) { + if !arl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arl.NextLink))) +} + +// AlertRuleListPage contains a page of ActivityLogAlertResource values. +type AlertRuleListPage struct { + fn func(context.Context, AlertRuleList) (AlertRuleList, error) + arl AlertRuleList +} + +// 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 *AlertRuleListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertRuleListPage.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.arl) + if err != nil { + return err + } + page.arl = 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 *AlertRuleListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AlertRuleListPage) NotDone() bool { + return !page.arl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AlertRuleListPage) Response() AlertRuleList { + return page.arl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AlertRuleListPage) Values() []ActivityLogAlertResource { + if page.arl.IsEmpty() { + return nil + } + return *page.arl.Value +} + +// Creates a new instance of the AlertRuleListPage type. +func NewAlertRuleListPage(cur AlertRuleList, getNextPage func(context.Context, AlertRuleList) (AlertRuleList, error)) AlertRuleListPage { + return AlertRuleListPage{ + fn: getNextPage, + arl: cur, + } +} + +// AlertRulePatchObject an Activity Log Alert rule object for the body of patch operations. +type AlertRulePatchObject struct { + // Tags - The resource tags + Tags map[string]*string `json:"tags"` + // AlertRulePatchProperties - The activity log alert settings for an update operation. + *AlertRulePatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRulePatchObject. +func (arpo AlertRulePatchObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arpo.Tags != nil { + objectMap["tags"] = arpo.Tags + } + if arpo.AlertRulePatchProperties != nil { + objectMap["properties"] = arpo.AlertRulePatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRulePatchObject struct. +func (arpo *AlertRulePatchObject) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arpo.Tags = tags + } + case "properties": + if v != nil { + var alertRulePatchProperties AlertRulePatchProperties + err = json.Unmarshal(*v, &alertRulePatchProperties) + if err != nil { + return err + } + arpo.AlertRulePatchProperties = &alertRulePatchProperties + } + } + } + + return nil +} + +// AlertRulePatchProperties an Activity Log Alert rule properties for patch operations. +type AlertRulePatchProperties struct { + // Enabled - Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` +} + +// AlertRuleProperties an Azure Activity Log Alert rule. +type AlertRuleProperties struct { + // Scopes - A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one item. + Scopes *[]string `json:"scopes,omitempty"` + // Condition - The condition that will cause this alert to activate. + Condition *AlertRuleAllOfCondition `json:"condition,omitempty"` + // Actions - The actions that will activate when the condition is met. + Actions *ActionList `json:"actions,omitempty"` + // Enabled - Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. + Enabled *bool `json:"enabled,omitempty"` + // Description - A description of this Activity Log Alert rule. + Description *string `json:"description,omitempty"` +} + +// AlertRuleResource the alert rule resource. +type AlertRuleResource struct { + autorest.Response `json:"-"` + // AlertRule - The alert rule properties of the resource. + *AlertRule `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleResource. +func (arr AlertRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.AlertRule != nil { + objectMap["properties"] = arr.AlertRule + } + if arr.Location != nil { + objectMap["location"] = arr.Location + } + if arr.Tags != nil { + objectMap["tags"] = arr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleResource struct. +func (arr *AlertRuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arr.AlertRule = &alertRule + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + arr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + arr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + arr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + arr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arr.Tags = tags + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + arr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + arr.Etag = &etag + } + } + } + + return nil +} + +// AlertRuleResourceCollection represents a collection of alert rule resources. +type AlertRuleResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]AlertRuleResource `json:"value,omitempty"` +} + +// AlertRuleResourcePatch the alert rule object for patch operations. +type AlertRuleResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AlertRule - The properties of an alert rule. + *AlertRule `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertRuleResourcePatch. +func (arrp AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arrp.Tags != nil { + objectMap["tags"] = arrp.Tags + } + if arrp.AlertRule != nil { + objectMap["properties"] = arrp.AlertRule + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertRuleResourcePatch struct. +func (arrp *AlertRuleResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + arrp.Tags = tags + } + case "properties": + if v != nil { + var alertRule AlertRule + err = json.Unmarshal(*v, &alertRule) + if err != nil { + return err + } + arrp.AlertRule = &alertRule + } + } + } + + return nil +} + +// ArmRoleReceiver an arm role receiver. +type ArmRoleReceiver struct { + // Name - The name of the arm role receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // RoleID - The arm role id. + RoleID *string `json:"roleId,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// AutomationRunbookReceiver the Azure Automation Runbook notification receiver. +type AutomationRunbookReceiver struct { + // AutomationAccountID - The Azure automation account Id which holds this runbook and authenticate to Azure resource. + AutomationAccountID *string `json:"automationAccountId,omitempty"` + // RunbookName - The name for this runbook. + RunbookName *string `json:"runbookName,omitempty"` + // WebhookResourceID - The resource id for webhook linked to this runbook. + WebhookResourceID *string `json:"webhookResourceId,omitempty"` + // IsGlobalRunbook - Indicates whether this instance is global runbook. + IsGlobalRunbook *bool `json:"isGlobalRunbook,omitempty"` + // Name - Indicates name of the webhook. + Name *string `json:"name,omitempty"` + // ServiceURI - The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// AutoscaleNotification autoscale notification. +type AutoscaleNotification struct { + // Operation - the operation associated with the notification and its value must be "scale" + Operation *string `json:"operation,omitempty"` + // Email - the email notification. + Email *EmailNotification `json:"email,omitempty"` + // Webhooks - the collection of webhook notifications. + Webhooks *[]WebhookNotification `json:"webhooks,omitempty"` +} + +// AutoscaleProfile autoscale profile. +type AutoscaleProfile struct { + // Name - the name of the profile. + Name *string `json:"name,omitempty"` + // Capacity - the number of instances that can be used during this profile. + Capacity *ScaleCapacity `json:"capacity,omitempty"` + // Rules - the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. + Rules *[]ScaleRule `json:"rules,omitempty"` + // FixedDate - the specific date-time for the profile. This element is not used if the Recurrence element is used. + FixedDate *TimeWindow `json:"fixedDate,omitempty"` + // Recurrence - the repeating times at which this profile begins. This element is not used if the FixedDate element is used. + Recurrence *Recurrence `json:"recurrence,omitempty"` +} + +// AutoscaleSetting a setting that contains all of the configuration for the automatic scaling of a +// resource. +type AutoscaleSetting struct { + // Profiles - the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + Profiles *[]AutoscaleProfile `json:"profiles,omitempty"` + // Notifications - the collection of notifications. + Notifications *[]AutoscaleNotification `json:"notifications,omitempty"` + // Enabled - the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + Enabled *bool `json:"enabled,omitempty"` + // Name - the name of the autoscale setting. + Name *string `json:"name,omitempty"` + // TargetResourceURI - the resource identifier of the resource that the autoscale setting should be added to. + TargetResourceURI *string `json:"targetResourceUri,omitempty"` + // TargetResourceLocation - the location of the resource that the autoscale setting should be added to. + TargetResourceLocation *string `json:"targetResourceLocation,omitempty"` +} + +// AutoscaleSettingResource the autoscale setting resource. +type AutoscaleSettingResource struct { + autorest.Response `json:"-"` + // AutoscaleSetting - The autoscale setting of the resource. + *AutoscaleSetting `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoscaleSettingResource. +func (asr AutoscaleSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asr.AutoscaleSetting != nil { + objectMap["properties"] = asr.AutoscaleSetting + } + if asr.Location != nil { + objectMap["location"] = asr.Location + } + if asr.Tags != nil { + objectMap["tags"] = asr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResource struct. +func (asr *AutoscaleSettingResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asr.AutoscaleSetting = &autoscaleSetting + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asr.Tags = tags + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asr.Etag = &etag + } + } + } + + return nil +} + +// AutoscaleSettingResourceCollection represents a collection of autoscale setting resources. +type AutoscaleSettingResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the autoscale setting resources. + Value *[]AutoscaleSettingResource `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AutoscaleSettingResourceCollectionIterator provides access to a complete listing of +// AutoscaleSettingResource values. +type AutoscaleSettingResourceCollectionIterator struct { + i int + page AutoscaleSettingResourceCollectionPage +} + +// 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 *AutoscaleSettingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionIterator.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 *AutoscaleSettingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AutoscaleSettingResourceCollectionIterator) 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 AutoscaleSettingResourceCollectionIterator) Response() AutoscaleSettingResourceCollection { + 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 AutoscaleSettingResourceCollectionIterator) Value() AutoscaleSettingResource { + if !iter.page.NotDone() { + return AutoscaleSettingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AutoscaleSettingResourceCollectionIterator type. +func NewAutoscaleSettingResourceCollectionIterator(page AutoscaleSettingResourceCollectionPage) AutoscaleSettingResourceCollectionIterator { + return AutoscaleSettingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asrc AutoscaleSettingResourceCollection) IsEmpty() bool { + return asrc.Value == nil || len(*asrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asrc AutoscaleSettingResourceCollection) hasNextLink() bool { + return asrc.NextLink != nil && len(*asrc.NextLink) != 0 +} + +// autoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asrc AutoscaleSettingResourceCollection) autoscaleSettingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !asrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asrc.NextLink))) +} + +// AutoscaleSettingResourceCollectionPage contains a page of AutoscaleSettingResource values. +type AutoscaleSettingResourceCollectionPage struct { + fn func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error) + asrc AutoscaleSettingResourceCollection +} + +// 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 *AutoscaleSettingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoscaleSettingResourceCollectionPage.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.asrc) + if err != nil { + return err + } + page.asrc = 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 *AutoscaleSettingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AutoscaleSettingResourceCollectionPage) NotDone() bool { + return !page.asrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AutoscaleSettingResourceCollectionPage) Response() AutoscaleSettingResourceCollection { + return page.asrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AutoscaleSettingResourceCollectionPage) Values() []AutoscaleSettingResource { + if page.asrc.IsEmpty() { + return nil + } + return *page.asrc.Value +} + +// Creates a new instance of the AutoscaleSettingResourceCollectionPage type. +func NewAutoscaleSettingResourceCollectionPage(cur AutoscaleSettingResourceCollection, getNextPage func(context.Context, AutoscaleSettingResourceCollection) (AutoscaleSettingResourceCollection, error)) AutoscaleSettingResourceCollectionPage { + return AutoscaleSettingResourceCollectionPage{ + fn: getNextPage, + asrc: cur, + } +} + +// AutoscaleSettingResourcePatch the autoscale setting object for patch operations. +type AutoscaleSettingResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // AutoscaleSetting - The autoscale setting properties of the update operation. + *AutoscaleSetting `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoscaleSettingResourcePatch. +func (asrp AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asrp.Tags != nil { + objectMap["tags"] = asrp.Tags + } + if asrp.AutoscaleSetting != nil { + objectMap["properties"] = asrp.AutoscaleSetting + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AutoscaleSettingResourcePatch struct. +func (asrp *AutoscaleSettingResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asrp.Tags = tags + } + case "properties": + if v != nil { + var autoscaleSetting AutoscaleSetting + err = json.Unmarshal(*v, &autoscaleSetting) + if err != nil { + return err + } + asrp.AutoscaleSetting = &autoscaleSetting + } + } + } + + return nil +} + +// AzNsActionGroup azure action group +type AzNsActionGroup struct { + // ActionGroup - Azure Action Group reference. + ActionGroup *[]string `json:"actionGroup,omitempty"` + // EmailSubject - Custom subject override for all email ids in Azure action group + EmailSubject *string `json:"emailSubject,omitempty"` + // CustomWebhookPayload - Custom payload to be sent for all webhook URI in Azure action group + CustomWebhookPayload *string `json:"customWebhookPayload,omitempty"` +} + +// AzureAppPushReceiver the Azure mobile App push notification receiver. +type AzureAppPushReceiver struct { + // Name - The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EmailAddress - The email address registered for the Azure mobile app. + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// AzureFunctionReceiver an azure function receiver. +type AzureFunctionReceiver struct { + // Name - The name of the azure function receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // FunctionAppResourceID - The azure resource id of the function app. + FunctionAppResourceID *string `json:"functionAppResourceId,omitempty"` + // FunctionName - The function name in the function app. + FunctionName *string `json:"functionName,omitempty"` + // HTTPTriggerURL - The http trigger url where http request sent to. + HTTPTriggerURL *string `json:"httpTriggerUrl,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// AzureMonitorMetricsDestination azure Monitor Metrics destination. +type AzureMonitorMetricsDestination struct { + // Name - A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// AzureMonitorPrivateLinkScope an Azure Monitor PrivateLinkScope definition. +type AzureMonitorPrivateLinkScope struct { + autorest.Response `json:"-"` + // AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. + *AzureMonitorPrivateLinkScopeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScope. +func (ampls AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ampls.AzureMonitorPrivateLinkScopeProperties != nil { + objectMap["properties"] = ampls.AzureMonitorPrivateLinkScopeProperties + } + if ampls.Location != nil { + objectMap["location"] = ampls.Location + } + if ampls.Tags != nil { + objectMap["tags"] = ampls.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureMonitorPrivateLinkScope struct. +func (ampls *AzureMonitorPrivateLinkScope) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureMonitorPrivateLinkScopeProperties AzureMonitorPrivateLinkScopeProperties + err = json.Unmarshal(*v, &azureMonitorPrivateLinkScopeProperties) + if err != nil { + return err + } + ampls.AzureMonitorPrivateLinkScopeProperties = &azureMonitorPrivateLinkScopeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ampls.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ampls.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ampls.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ampls.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ampls.Tags = tags + } + } + } + + return nil +} + +// AzureMonitorPrivateLinkScopeListResult describes the list of Azure Monitor PrivateLinkScope resources. +type AzureMonitorPrivateLinkScopeListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Monitor PrivateLinkScope definitions. + Value *[]AzureMonitorPrivateLinkScope `json:"value,omitempty"` + // NextLink - The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned in the result set. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureMonitorPrivateLinkScopeListResultIterator provides access to a complete listing of +// AzureMonitorPrivateLinkScope values. +type AzureMonitorPrivateLinkScopeListResultIterator struct { + i int + page AzureMonitorPrivateLinkScopeListResultPage +} + +// 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 *AzureMonitorPrivateLinkScopeListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultIterator.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 *AzureMonitorPrivateLinkScopeListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureMonitorPrivateLinkScopeListResultIterator) 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 AzureMonitorPrivateLinkScopeListResultIterator) Response() AzureMonitorPrivateLinkScopeListResult { + 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 AzureMonitorPrivateLinkScopeListResultIterator) Value() AzureMonitorPrivateLinkScope { + if !iter.page.NotDone() { + return AzureMonitorPrivateLinkScope{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultIterator type. +func NewAzureMonitorPrivateLinkScopeListResultIterator(page AzureMonitorPrivateLinkScopeListResultPage) AzureMonitorPrivateLinkScopeListResultIterator { + return AzureMonitorPrivateLinkScopeListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (amplslr AzureMonitorPrivateLinkScopeListResult) IsEmpty() bool { + return amplslr.Value == nil || len(*amplslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (amplslr AzureMonitorPrivateLinkScopeListResult) hasNextLink() bool { + return amplslr.NextLink != nil && len(*amplslr.NextLink) != 0 +} + +// azureMonitorPrivateLinkScopeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (amplslr AzureMonitorPrivateLinkScopeListResult) azureMonitorPrivateLinkScopeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !amplslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(amplslr.NextLink))) +} + +// AzureMonitorPrivateLinkScopeListResultPage contains a page of AzureMonitorPrivateLinkScope values. +type AzureMonitorPrivateLinkScopeListResultPage struct { + fn func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error) + amplslr AzureMonitorPrivateLinkScopeListResult +} + +// 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 *AzureMonitorPrivateLinkScopeListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureMonitorPrivateLinkScopeListResultPage.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.amplslr) + if err != nil { + return err + } + page.amplslr = 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 *AzureMonitorPrivateLinkScopeListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureMonitorPrivateLinkScopeListResultPage) NotDone() bool { + return !page.amplslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureMonitorPrivateLinkScopeListResultPage) Response() AzureMonitorPrivateLinkScopeListResult { + return page.amplslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureMonitorPrivateLinkScopeListResultPage) Values() []AzureMonitorPrivateLinkScope { + if page.amplslr.IsEmpty() { + return nil + } + return *page.amplslr.Value +} + +// Creates a new instance of the AzureMonitorPrivateLinkScopeListResultPage type. +func NewAzureMonitorPrivateLinkScopeListResultPage(cur AzureMonitorPrivateLinkScopeListResult, getNextPage func(context.Context, AzureMonitorPrivateLinkScopeListResult) (AzureMonitorPrivateLinkScopeListResult, error)) AzureMonitorPrivateLinkScopeListResultPage { + return AzureMonitorPrivateLinkScopeListResultPage{ + fn: getNextPage, + amplslr: cur, + } +} + +// AzureMonitorPrivateLinkScopeProperties properties that define a Azure Monitor PrivateLinkScope resource. +type AzureMonitorPrivateLinkScopeProperties struct { + // ProvisioningState - READ-ONLY; Current state of this PrivateLinkScope: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureMonitorPrivateLinkScopeProperties. +func (amplsp AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureResource an azure resource object +type AzureResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Kind - READ-ONLY; Azure resource kind + Kind *string `json:"kind,omitempty"` + // Identity - READ-ONLY; Azure resource identity + Identity *string `json:"identity,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureResource. +func (ar AzureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.Tags != nil { + objectMap["tags"] = ar.Tags + } + return json.Marshal(objectMap) +} + +// BaselineMetadata represents a baseline metadata value. +type BaselineMetadata struct { + // Name - Name of the baseline metadata. + Name *string `json:"name,omitempty"` + // Value - Value of the baseline metadata. + Value *string `json:"value,omitempty"` +} + +// ConfigurationAccessEndpointSpec definition of the endpoint used for accessing configuration. +type ConfigurationAccessEndpointSpec struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationAccessEndpointSpec. +func (caes ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Context the context info +type Context struct { + // NotificationSource - The source of the notification request + NotificationSource *string `json:"NotificationSource,omitempty"` + // ContextType - The context id type + ContextType *string `json:"ContextType,omitempty"` +} + +// Criteria specifies the criteria for converting log to metric. +type Criteria struct { + // MetricName - Name of the metric + MetricName *string `json:"metricName,omitempty"` + // Dimensions - List of Dimensions for creating metric + Dimensions *[]Dimension `json:"dimensions,omitempty"` +} + +// DataCollectionEndpoint definition of data collection endpoint. +type DataCollectionEndpoint struct { + // Description - Description of the data collection endpoint. + Description *string `json:"description,omitempty"` + // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // ConfigurationAccess - The endpoint used by agents to access their configuration. + ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` + // LogsIngestion - The endpoint used by clients to ingest logs. + LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` + // NetworkAcls - Network access control rules for the endpoints. + NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' + ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionEndpoint. +func (dce DataCollectionEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dce.Description != nil { + objectMap["description"] = dce.Description + } + if dce.ImmutableID != nil { + objectMap["immutableId"] = dce.ImmutableID + } + if dce.ConfigurationAccess != nil { + objectMap["configurationAccess"] = dce.ConfigurationAccess + } + if dce.LogsIngestion != nil { + objectMap["logsIngestion"] = dce.LogsIngestion + } + if dce.NetworkAcls != nil { + objectMap["networkAcls"] = dce.NetworkAcls + } + return json.Marshal(objectMap) +} + +// DataCollectionEndpointConfigurationAccess the endpoint used by agents to access their configuration. +type DataCollectionEndpointConfigurationAccess struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionEndpointConfigurationAccess. +func (dceA DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DataCollectionEndpointLogsIngestion the endpoint used by clients to ingest logs. +type DataCollectionEndpointLogsIngestion struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionEndpointLogsIngestion. +func (dceI DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DataCollectionEndpointNetworkAcls network access control rules for the endpoints. +type DataCollectionEndpointNetworkAcls struct { + // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' + PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` +} + +// DataCollectionEndpointResource definition of ARM tracked top level resource. +type DataCollectionEndpointResource struct { + autorest.Response `json:"-"` + // DataCollectionEndpointResourceProperties - Resource properties. + *DataCollectionEndpointResourceProperties `json:"properties,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionEndpointResourceKindLinux', 'KnownDataCollectionEndpointResourceKindWindows' + Kind KnownDataCollectionEndpointResourceKind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; Resource entity tag (ETag). + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *DataCollectionEndpointResourceSystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionEndpointResource. +func (dcer DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcer.DataCollectionEndpointResourceProperties != nil { + objectMap["properties"] = dcer.DataCollectionEndpointResourceProperties + } + if dcer.Location != nil { + objectMap["location"] = dcer.Location + } + if dcer.Tags != nil { + objectMap["tags"] = dcer.Tags + } + if dcer.Kind != "" { + objectMap["kind"] = dcer.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataCollectionEndpointResource struct. +func (dcer *DataCollectionEndpointResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dataCollectionEndpointResourceProperties DataCollectionEndpointResourceProperties + err = json.Unmarshal(*v, &dataCollectionEndpointResourceProperties) + if err != nil { + return err + } + dcer.DataCollectionEndpointResourceProperties = &dataCollectionEndpointResourceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcer.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dcer.Tags = tags + } + case "kind": + if v != nil { + var kind KnownDataCollectionEndpointResourceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dcer.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcer.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcer.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcer.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dcer.Etag = &etag + } + case "systemData": + if v != nil { + var systemData DataCollectionEndpointResourceSystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dcer.SystemData = &systemData + } + } + } + + return nil +} + +// DataCollectionEndpointResourceListResult a pageable list of resources. +type DataCollectionEndpointResourceListResult struct { + autorest.Response `json:"-"` + // Value - A list of resources. + Value *[]DataCollectionEndpointResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataCollectionEndpointResourceListResultIterator provides access to a complete listing of +// DataCollectionEndpointResource values. +type DataCollectionEndpointResourceListResultIterator struct { + i int + page DataCollectionEndpointResourceListResultPage +} + +// 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 *DataCollectionEndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultIterator.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 *DataCollectionEndpointResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataCollectionEndpointResourceListResultIterator) 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 DataCollectionEndpointResourceListResultIterator) Response() DataCollectionEndpointResourceListResult { + 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 DataCollectionEndpointResourceListResultIterator) Value() DataCollectionEndpointResource { + if !iter.page.NotDone() { + return DataCollectionEndpointResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataCollectionEndpointResourceListResultIterator type. +func NewDataCollectionEndpointResourceListResultIterator(page DataCollectionEndpointResourceListResultPage) DataCollectionEndpointResourceListResultIterator { + return DataCollectionEndpointResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcerlr DataCollectionEndpointResourceListResult) IsEmpty() bool { + return dcerlr.Value == nil || len(*dcerlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dcerlr DataCollectionEndpointResourceListResult) hasNextLink() bool { + return dcerlr.NextLink != nil && len(*dcerlr.NextLink) != 0 +} + +// dataCollectionEndpointResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcerlr DataCollectionEndpointResourceListResult) dataCollectionEndpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dcerlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcerlr.NextLink))) +} + +// DataCollectionEndpointResourceListResultPage contains a page of DataCollectionEndpointResource values. +type DataCollectionEndpointResourceListResultPage struct { + fn func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error) + dcerlr DataCollectionEndpointResourceListResult +} + +// 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 *DataCollectionEndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionEndpointResourceListResultPage.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.dcerlr) + if err != nil { + return err + } + page.dcerlr = 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 *DataCollectionEndpointResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataCollectionEndpointResourceListResultPage) NotDone() bool { + return !page.dcerlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataCollectionEndpointResourceListResultPage) Response() DataCollectionEndpointResourceListResult { + return page.dcerlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataCollectionEndpointResourceListResultPage) Values() []DataCollectionEndpointResource { + if page.dcerlr.IsEmpty() { + return nil + } + return *page.dcerlr.Value +} + +// Creates a new instance of the DataCollectionEndpointResourceListResultPage type. +func NewDataCollectionEndpointResourceListResultPage(cur DataCollectionEndpointResourceListResult, getNextPage func(context.Context, DataCollectionEndpointResourceListResult) (DataCollectionEndpointResourceListResult, error)) DataCollectionEndpointResourceListResultPage { + return DataCollectionEndpointResourceListResultPage{ + fn: getNextPage, + dcerlr: cur, + } +} + +// DataCollectionEndpointResourceProperties resource properties. +type DataCollectionEndpointResourceProperties struct { + // Description - Description of the data collection endpoint. + Description *string `json:"description,omitempty"` + // ImmutableID - The immutable ID of this data collection endpoint resource. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // ConfigurationAccess - The endpoint used by agents to access their configuration. + ConfigurationAccess *DataCollectionEndpointConfigurationAccess `json:"configurationAccess,omitempty"` + // LogsIngestion - The endpoint used by clients to ingest logs. + LogsIngestion *DataCollectionEndpointLogsIngestion `json:"logsIngestion,omitempty"` + // NetworkAcls - Network access control rules for the endpoints. + NetworkAcls *DataCollectionEndpointNetworkAcls `json:"networkAcls,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. This property is READ-ONLY. Possible values include: 'KnownDataCollectionEndpointProvisioningStateCreating', 'KnownDataCollectionEndpointProvisioningStateUpdating', 'KnownDataCollectionEndpointProvisioningStateDeleting', 'KnownDataCollectionEndpointProvisioningStateSucceeded', 'KnownDataCollectionEndpointProvisioningStateFailed' + ProvisioningState KnownDataCollectionEndpointProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionEndpointResourceProperties. +func (dcer DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcer.Description != nil { + objectMap["description"] = dcer.Description + } + if dcer.ImmutableID != nil { + objectMap["immutableId"] = dcer.ImmutableID + } + if dcer.ConfigurationAccess != nil { + objectMap["configurationAccess"] = dcer.ConfigurationAccess + } + if dcer.LogsIngestion != nil { + objectMap["logsIngestion"] = dcer.LogsIngestion + } + if dcer.NetworkAcls != nil { + objectMap["networkAcls"] = dcer.NetworkAcls + } + return json.Marshal(objectMap) +} + +// DataCollectionEndpointResourceSystemData metadata pertaining to creation and last modification of the +// resource. +type DataCollectionEndpointResourceSystemData 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// DataCollectionRule definition of what monitoring data to collect and where that data should be sent. +type DataCollectionRule struct { + // Description - Description of the data collection rule. + Description *string `json:"description,omitempty"` + // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // DataSources - The specification of data sources. + // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` + // Destinations - The specification of destinations. + Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` + // DataFlows - The specification of data flows. + DataFlows *[]DataFlow `json:"dataFlows,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionRule. +func (dcr DataCollectionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcr.Description != nil { + objectMap["description"] = dcr.Description + } + if dcr.DataSources != nil { + objectMap["dataSources"] = dcr.DataSources + } + if dcr.Destinations != nil { + objectMap["destinations"] = dcr.Destinations + } + if dcr.DataFlows != nil { + objectMap["dataFlows"] = dcr.DataFlows + } + return json.Marshal(objectMap) +} + +// DataCollectionRuleAssociation definition of association of a data collection rule with a monitored Azure +// resource. +type DataCollectionRuleAssociation struct { + // Description - Description of the association. + Description *string `json:"description,omitempty"` + // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. + DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` + // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. + DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionRuleAssociation. +func (dcra DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcra.Description != nil { + objectMap["description"] = dcra.Description + } + if dcra.DataCollectionRuleID != nil { + objectMap["dataCollectionRuleId"] = dcra.DataCollectionRuleID + } + if dcra.DataCollectionEndpointID != nil { + objectMap["dataCollectionEndpointId"] = dcra.DataCollectionEndpointID + } + return json.Marshal(objectMap) +} + +// DataCollectionRuleAssociationProxyOnlyResource definition of generic ARM proxy resource. +type DataCollectionRuleAssociationProxyOnlyResource struct { + autorest.Response `json:"-"` + // DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. + *DataCollectionRuleAssociationProxyOnlyResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; Resource entity tag (ETag). + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResource. +func (dcrapor DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties != nil { + objectMap["properties"] = dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleAssociationProxyOnlyResource struct. +func (dcrapor *DataCollectionRuleAssociationProxyOnlyResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dataCollectionRuleAssociationProxyOnlyResourceProperties DataCollectionRuleAssociationProxyOnlyResourceProperties + err = json.Unmarshal(*v, &dataCollectionRuleAssociationProxyOnlyResourceProperties) + if err != nil { + return err + } + dcrapor.DataCollectionRuleAssociationProxyOnlyResourceProperties = &dataCollectionRuleAssociationProxyOnlyResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcrapor.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcrapor.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcrapor.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dcrapor.Etag = &etag + } + case "systemData": + if v != nil { + var systemData DataCollectionRuleAssociationProxyOnlyResourceSystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dcrapor.SystemData = &systemData + } + } + } + + return nil +} + +// DataCollectionRuleAssociationProxyOnlyResourceListResult a pageable list of resources. +type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { + autorest.Response `json:"-"` + // Value - A list of resources. + Value *[]DataCollectionRuleAssociationProxyOnlyResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataCollectionRuleAssociationProxyOnlyResourceListResultIterator provides access to a complete listing +// of DataCollectionRuleAssociationProxyOnlyResource values. +type DataCollectionRuleAssociationProxyOnlyResourceListResultIterator struct { + i int + page DataCollectionRuleAssociationProxyOnlyResourceListResultPage +} + +// 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 *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultIterator.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 *DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) 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 DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { + 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 DataCollectionRuleAssociationProxyOnlyResourceListResultIterator) Value() DataCollectionRuleAssociationProxyOnlyResource { + if !iter.page.NotDone() { + return DataCollectionRuleAssociationProxyOnlyResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultIterator type. +func NewDataCollectionRuleAssociationProxyOnlyResourceListResultIterator(page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) DataCollectionRuleAssociationProxyOnlyResourceListResultIterator { + return DataCollectionRuleAssociationProxyOnlyResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) IsEmpty() bool { + return dcraporlr.Value == nil || len(*dcraporlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) hasNextLink() bool { + return dcraporlr.NextLink != nil && len(*dcraporlr.NextLink) != 0 +} + +// dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult) dataCollectionRuleAssociationProxyOnlyResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dcraporlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcraporlr.NextLink))) +} + +// DataCollectionRuleAssociationProxyOnlyResourceListResultPage contains a page of +// DataCollectionRuleAssociationProxyOnlyResource values. +type DataCollectionRuleAssociationProxyOnlyResourceListResultPage struct { + fn func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error) + dcraporlr DataCollectionRuleAssociationProxyOnlyResourceListResult +} + +// 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 *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleAssociationProxyOnlyResourceListResultPage.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.dcraporlr) + if err != nil { + return err + } + page.dcraporlr = 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 *DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) NotDone() bool { + return !page.dcraporlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Response() DataCollectionRuleAssociationProxyOnlyResourceListResult { + return page.dcraporlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataCollectionRuleAssociationProxyOnlyResourceListResultPage) Values() []DataCollectionRuleAssociationProxyOnlyResource { + if page.dcraporlr.IsEmpty() { + return nil + } + return *page.dcraporlr.Value +} + +// Creates a new instance of the DataCollectionRuleAssociationProxyOnlyResourceListResultPage type. +func NewDataCollectionRuleAssociationProxyOnlyResourceListResultPage(cur DataCollectionRuleAssociationProxyOnlyResourceListResult, getNextPage func(context.Context, DataCollectionRuleAssociationProxyOnlyResourceListResult) (DataCollectionRuleAssociationProxyOnlyResourceListResult, error)) DataCollectionRuleAssociationProxyOnlyResourceListResultPage { + return DataCollectionRuleAssociationProxyOnlyResourceListResultPage{ + fn: getNextPage, + dcraporlr: cur, + } +} + +// DataCollectionRuleAssociationProxyOnlyResourceProperties resource properties. +type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { + // Description - Description of the association. + Description *string `json:"description,omitempty"` + // DataCollectionRuleID - The resource ID of the data collection rule that is to be associated. + DataCollectionRuleID *string `json:"dataCollectionRuleId,omitempty"` + // DataCollectionEndpointID - The resource ID of the data collection endpoint that is to be associated. + DataCollectionEndpointID *string `json:"dataCollectionEndpointId,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleAssociationProvisioningStateCreating', 'KnownDataCollectionRuleAssociationProvisioningStateUpdating', 'KnownDataCollectionRuleAssociationProvisioningStateDeleting', 'KnownDataCollectionRuleAssociationProvisioningStateSucceeded', 'KnownDataCollectionRuleAssociationProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleAssociationProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionRuleAssociationProxyOnlyResourceProperties. +func (dcrapor DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcrapor.Description != nil { + objectMap["description"] = dcrapor.Description + } + if dcrapor.DataCollectionRuleID != nil { + objectMap["dataCollectionRuleId"] = dcrapor.DataCollectionRuleID + } + if dcrapor.DataCollectionEndpointID != nil { + objectMap["dataCollectionEndpointId"] = dcrapor.DataCollectionEndpointID + } + return json.Marshal(objectMap) +} + +// DataCollectionRuleAssociationProxyOnlyResourceSystemData metadata pertaining to creation and last +// modification of the resource. +type DataCollectionRuleAssociationProxyOnlyResourceSystemData 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// DataCollectionRuleDataSources the specification of data sources. +// This property is optional and can be omitted if the rule is meant to be used via direct calls to the +// provisioned endpoint. +type DataCollectionRuleDataSources struct { + // PerformanceCounters - The list of performance counter data source configurations. + PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` + // WindowsEventLogs - The list of Windows Event Log data source configurations. + WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` + // Syslog - The list of Syslog data source configurations. + Syslog *[]SyslogDataSource `json:"syslog,omitempty"` + // Extensions - The list of Azure VM extension data source configurations. + Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` +} + +// DataCollectionRuleDestinations the specification of destinations. +type DataCollectionRuleDestinations struct { + // LogAnalytics - List of Log Analytics destinations. + LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` + // AzureMonitorMetrics - Azure Monitor Metrics destination. + AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` +} + +// DataCollectionRuleResource definition of ARM tracked top level resource. +type DataCollectionRuleResource struct { + autorest.Response `json:"-"` + // DataCollectionRuleResourceProperties - Resource properties. + *DataCollectionRuleResourceProperties `json:"properties,omitempty"` + // Location - The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Kind - The kind of the resource. Possible values include: 'KnownDataCollectionRuleResourceKindLinux', 'KnownDataCollectionRuleResourceKindWindows' + Kind KnownDataCollectionRuleResourceKind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified ID of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; Resource entity tag (ETag). + Etag *string `json:"etag,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *DataCollectionRuleResourceSystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionRuleResource. +func (dcrr DataCollectionRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcrr.DataCollectionRuleResourceProperties != nil { + objectMap["properties"] = dcrr.DataCollectionRuleResourceProperties + } + if dcrr.Location != nil { + objectMap["location"] = dcrr.Location + } + if dcrr.Tags != nil { + objectMap["tags"] = dcrr.Tags + } + if dcrr.Kind != "" { + objectMap["kind"] = dcrr.Kind + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataCollectionRuleResource struct. +func (dcrr *DataCollectionRuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dataCollectionRuleResourceProperties DataCollectionRuleResourceProperties + err = json.Unmarshal(*v, &dataCollectionRuleResourceProperties) + if err != nil { + return err + } + dcrr.DataCollectionRuleResourceProperties = &dataCollectionRuleResourceProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcrr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dcrr.Tags = tags + } + case "kind": + if v != nil { + var kind KnownDataCollectionRuleResourceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + dcrr.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcrr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcrr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcrr.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dcrr.Etag = &etag + } + case "systemData": + if v != nil { + var systemData DataCollectionRuleResourceSystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dcrr.SystemData = &systemData + } + } + } + + return nil +} + +// DataCollectionRuleResourceListResult a pageable list of resources. +type DataCollectionRuleResourceListResult struct { + autorest.Response `json:"-"` + // Value - A list of resources. + Value *[]DataCollectionRuleResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DataCollectionRuleResourceListResultIterator provides access to a complete listing of +// DataCollectionRuleResource values. +type DataCollectionRuleResourceListResultIterator struct { + i int + page DataCollectionRuleResourceListResultPage +} + +// 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 *DataCollectionRuleResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultIterator.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 *DataCollectionRuleResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataCollectionRuleResourceListResultIterator) 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 DataCollectionRuleResourceListResultIterator) Response() DataCollectionRuleResourceListResult { + 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 DataCollectionRuleResourceListResultIterator) Value() DataCollectionRuleResource { + if !iter.page.NotDone() { + return DataCollectionRuleResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataCollectionRuleResourceListResultIterator type. +func NewDataCollectionRuleResourceListResultIterator(page DataCollectionRuleResourceListResultPage) DataCollectionRuleResourceListResultIterator { + return DataCollectionRuleResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dcrrlr DataCollectionRuleResourceListResult) IsEmpty() bool { + return dcrrlr.Value == nil || len(*dcrrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dcrrlr DataCollectionRuleResourceListResult) hasNextLink() bool { + return dcrrlr.NextLink != nil && len(*dcrrlr.NextLink) != 0 +} + +// dataCollectionRuleResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dcrrlr DataCollectionRuleResourceListResult) dataCollectionRuleResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dcrrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dcrrlr.NextLink))) +} + +// DataCollectionRuleResourceListResultPage contains a page of DataCollectionRuleResource values. +type DataCollectionRuleResourceListResultPage struct { + fn func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error) + dcrrlr DataCollectionRuleResourceListResult +} + +// 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 *DataCollectionRuleResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataCollectionRuleResourceListResultPage.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.dcrrlr) + if err != nil { + return err + } + page.dcrrlr = 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 *DataCollectionRuleResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataCollectionRuleResourceListResultPage) NotDone() bool { + return !page.dcrrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataCollectionRuleResourceListResultPage) Response() DataCollectionRuleResourceListResult { + return page.dcrrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataCollectionRuleResourceListResultPage) Values() []DataCollectionRuleResource { + if page.dcrrlr.IsEmpty() { + return nil + } + return *page.dcrrlr.Value +} + +// Creates a new instance of the DataCollectionRuleResourceListResultPage type. +func NewDataCollectionRuleResourceListResultPage(cur DataCollectionRuleResourceListResult, getNextPage func(context.Context, DataCollectionRuleResourceListResult) (DataCollectionRuleResourceListResult, error)) DataCollectionRuleResourceListResultPage { + return DataCollectionRuleResourceListResultPage{ + fn: getNextPage, + dcrrlr: cur, + } +} + +// DataCollectionRuleResourceProperties resource properties. +type DataCollectionRuleResourceProperties struct { + // Description - Description of the data collection rule. + Description *string `json:"description,omitempty"` + // ImmutableID - READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. + ImmutableID *string `json:"immutableId,omitempty"` + // DataSources - The specification of data sources. + // This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned endpoint. + DataSources *DataCollectionRuleDataSources `json:"dataSources,omitempty"` + // Destinations - The specification of destinations. + Destinations *DataCollectionRuleDestinations `json:"destinations,omitempty"` + // DataFlows - The specification of data flows. + DataFlows *[]DataFlow `json:"dataFlows,omitempty"` + // ProvisioningState - READ-ONLY; The resource provisioning state. Possible values include: 'KnownDataCollectionRuleProvisioningStateCreating', 'KnownDataCollectionRuleProvisioningStateUpdating', 'KnownDataCollectionRuleProvisioningStateDeleting', 'KnownDataCollectionRuleProvisioningStateSucceeded', 'KnownDataCollectionRuleProvisioningStateFailed' + ProvisioningState KnownDataCollectionRuleProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataCollectionRuleResourceProperties. +func (dcrr DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcrr.Description != nil { + objectMap["description"] = dcrr.Description + } + if dcrr.DataSources != nil { + objectMap["dataSources"] = dcrr.DataSources + } + if dcrr.Destinations != nil { + objectMap["destinations"] = dcrr.Destinations + } + if dcrr.DataFlows != nil { + objectMap["dataFlows"] = dcrr.DataFlows + } + return json.Marshal(objectMap) +} + +// DataCollectionRuleResourceSystemData metadata pertaining to creation and last modification of the +// resource. +type DataCollectionRuleResourceSystemData 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// DataContainer information about a container with data for a given resource. +type DataContainer struct { + // Workspace - Log Analytics workspace information. + Workspace *WorkspaceInfo `json:"workspace,omitempty"` +} + +// DataFlow definition of which streams are sent to which destinations. +type DataFlow struct { + // Streams - List of streams for this data flow. + Streams *[]KnownDataFlowStreams `json:"streams,omitempty"` + // Destinations - List of destinations for this data flow. + Destinations *[]string `json:"destinations,omitempty"` +} + +// DataSourcesSpec specification of data sources that will be collected. +type DataSourcesSpec struct { + // PerformanceCounters - The list of performance counter data source configurations. + PerformanceCounters *[]PerfCounterDataSource `json:"performanceCounters,omitempty"` + // WindowsEventLogs - The list of Windows Event Log data source configurations. + WindowsEventLogs *[]WindowsEventLogDataSource `json:"windowsEventLogs,omitempty"` + // Syslog - The list of Syslog data source configurations. + Syslog *[]SyslogDataSource `json:"syslog,omitempty"` + // Extensions - The list of Azure VM extension data source configurations. + Extensions *[]ExtensionDataSource `json:"extensions,omitempty"` +} + +// DestinationsSpec specification of destinations that can be used in data flows. +type DestinationsSpec struct { + // LogAnalytics - List of Log Analytics destinations. + LogAnalytics *[]LogAnalyticsDestination `json:"logAnalytics,omitempty"` + // AzureMonitorMetrics - Azure Monitor Metrics destination. + AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics `json:"azureMonitorMetrics,omitempty"` +} + +// DestinationsSpecAzureMonitorMetrics azure Monitor Metrics destination. +type DestinationsSpecAzureMonitorMetrics struct { + // Name - A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// DiagnosticSettings the diagnostic settings. +type DiagnosticSettings struct { + // StorageAccountID - The resource ID of the storage account to which you would like to send Diagnostic Logs. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // EventHubAuthorizationRuleID - The resource Id for the event hub authorization rule. + EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"` + // EventHubName - The name of the event hub. If none is specified, the default event hub will be selected. + EventHubName *string `json:"eventHubName,omitempty"` + // Metrics - The list of metric settings. + Metrics *[]MetricSettings `json:"metrics,omitempty"` + // Logs - The list of logs settings. + Logs *[]LogSettings `json:"logs,omitempty"` + // WorkspaceID - The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 + WorkspaceID *string `json:"workspaceId,omitempty"` + // LogAnalyticsDestinationType - A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.) + LogAnalyticsDestinationType *string `json:"logAnalyticsDestinationType,omitempty"` +} + +// DiagnosticSettingsCategory the diagnostic settings Category. +type DiagnosticSettingsCategory struct { + // CategoryType - The type of the diagnostic settings category. Possible values include: 'CategoryTypeMetrics', 'CategoryTypeLogs' + CategoryType CategoryType `json:"categoryType,omitempty"` +} + +// DiagnosticSettingsCategoryResource the diagnostic settings category resource. +type DiagnosticSettingsCategoryResource struct { + autorest.Response `json:"-"` + // DiagnosticSettingsCategory - The properties of a Diagnostic Settings Category. + *DiagnosticSettingsCategory `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticSettingsCategoryResource. +func (dscr DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dscr.DiagnosticSettingsCategory != nil { + objectMap["properties"] = dscr.DiagnosticSettingsCategory + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsCategoryResource struct. +func (dscr *DiagnosticSettingsCategoryResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettingsCategory DiagnosticSettingsCategory + err = json.Unmarshal(*v, &diagnosticSettingsCategory) + if err != nil { + return err + } + dscr.DiagnosticSettingsCategory = &diagnosticSettingsCategory + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dscr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dscr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dscr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticSettingsCategoryResourceCollection represents a collection of diagnostic setting category +// resources. +type DiagnosticSettingsCategoryResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings category resources. + Value *[]DiagnosticSettingsCategoryResource `json:"value,omitempty"` +} + +// DiagnosticSettingsResource the diagnostic setting resource. +type DiagnosticSettingsResource struct { + autorest.Response `json:"-"` + // DiagnosticSettings - Properties of a Diagnostic Settings Resource. + *DiagnosticSettings `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticSettingsResource. +func (dsr DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dsr.DiagnosticSettings != nil { + objectMap["properties"] = dsr.DiagnosticSettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiagnosticSettingsResource struct. +func (dsr *DiagnosticSettingsResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var diagnosticSettings DiagnosticSettings + err = json.Unmarshal(*v, &diagnosticSettings) + if err != nil { + return err + } + dsr.DiagnosticSettings = &diagnosticSettings + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dsr.Type = &typeVar + } + } + } + + return nil +} + +// DiagnosticSettingsResourceCollection represents a collection of alert rule resources. +type DiagnosticSettingsResourceCollection struct { + autorest.Response `json:"-"` + // Value - The collection of diagnostic settings resources;. + Value *[]DiagnosticSettingsResource `json:"value,omitempty"` +} + +// Dimension specifies the criteria for converting log to metric. +type Dimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // Operator - Operator for dimension values + Operator *string `json:"operator,omitempty"` + // Values - List of dimension values + Values *[]string `json:"values,omitempty"` +} + +// DynamicMetricCriteria criterion for dynamic threshold. +type DynamicMetricCriteria struct { + // Operator - The operator used to compare the metric value against the threshold. Possible values include: 'DynamicThresholdOperatorGreaterThan', 'DynamicThresholdOperatorLessThan', 'DynamicThresholdOperatorGreaterOrLessThan' + Operator DynamicThresholdOperator `json:"operator,omitempty"` + // AlertSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. Possible values include: 'DynamicThresholdSensitivityLow', 'DynamicThresholdSensitivityMedium', 'DynamicThresholdSensitivityHigh' + AlertSensitivity DynamicThresholdSensitivity `json:"alertSensitivity,omitempty"` + // FailingPeriods - The minimum number of violations required within the selected lookback time window required to raise an alert. + FailingPeriods *DynamicThresholdFailingPeriods `json:"failingPeriods,omitempty"` + // IgnoreDataBefore - Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format) + IgnoreDataBefore *date.Time `json:"ignoreDataBefore,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - Name of the criteria. + Name *string `json:"name,omitempty"` + // MetricName - Name of the metric. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - Namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` + // Dimensions - List of dimension conditions. + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. + SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` + // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' + CriterionType CriterionType `json:"criterionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) MarshalJSON() ([]byte, error) { + dmc.CriterionType = CriterionTypeDynamicThresholdCriterion + objectMap := make(map[string]interface{}) + if dmc.Operator != "" { + objectMap["operator"] = dmc.Operator + } + if dmc.AlertSensitivity != "" { + objectMap["alertSensitivity"] = dmc.AlertSensitivity + } + if dmc.FailingPeriods != nil { + objectMap["failingPeriods"] = dmc.FailingPeriods + } + if dmc.IgnoreDataBefore != nil { + objectMap["ignoreDataBefore"] = dmc.IgnoreDataBefore + } + if dmc.Name != nil { + objectMap["name"] = dmc.Name + } + if dmc.MetricName != nil { + objectMap["metricName"] = dmc.MetricName + } + if dmc.MetricNamespace != nil { + objectMap["metricNamespace"] = dmc.MetricNamespace + } + if dmc.TimeAggregation != "" { + objectMap["timeAggregation"] = dmc.TimeAggregation + } + if dmc.Dimensions != nil { + objectMap["dimensions"] = dmc.Dimensions + } + if dmc.SkipMetricValidation != nil { + objectMap["skipMetricValidation"] = dmc.SkipMetricValidation + } + if dmc.CriterionType != "" { + objectMap["criterionType"] = dmc.CriterionType + } + for k, v := range dmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { + return nil, false +} + +// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { + return &dmc, true +} + +// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { + return nil, false +} + +// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for DynamicMetricCriteria. +func (dmc DynamicMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { + return &dmc, true +} + +// UnmarshalJSON is the custom unmarshaler for DynamicMetricCriteria struct. +func (dmc *DynamicMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator DynamicThresholdOperator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + dmc.Operator = operator + } + case "alertSensitivity": + if v != nil { + var alertSensitivity DynamicThresholdSensitivity + err = json.Unmarshal(*v, &alertSensitivity) + if err != nil { + return err + } + dmc.AlertSensitivity = alertSensitivity + } + case "failingPeriods": + if v != nil { + var failingPeriods DynamicThresholdFailingPeriods + err = json.Unmarshal(*v, &failingPeriods) + if err != nil { + return err + } + dmc.FailingPeriods = &failingPeriods + } + case "ignoreDataBefore": + if v != nil { + var ignoreDataBefore date.Time + err = json.Unmarshal(*v, &ignoreDataBefore) + if err != nil { + return err + } + dmc.IgnoreDataBefore = &ignoreDataBefore + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if dmc.AdditionalProperties == nil { + dmc.AdditionalProperties = make(map[string]interface{}) + } + dmc.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dmc.Name = &name + } + case "metricName": + if v != nil { + var metricName string + err = json.Unmarshal(*v, &metricName) + if err != nil { + return err + } + dmc.MetricName = &metricName + } + case "metricNamespace": + if v != nil { + var metricNamespace string + err = json.Unmarshal(*v, &metricNamespace) + if err != nil { + return err + } + dmc.MetricNamespace = &metricNamespace + } + case "timeAggregation": + if v != nil { + var timeAggregation AggregationTypeEnum + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + dmc.TimeAggregation = timeAggregation + } + case "dimensions": + if v != nil { + var dimensions []MetricDimension + err = json.Unmarshal(*v, &dimensions) + if err != nil { + return err + } + dmc.Dimensions = &dimensions + } + case "skipMetricValidation": + if v != nil { + var skipMetricValidation bool + err = json.Unmarshal(*v, &skipMetricValidation) + if err != nil { + return err + } + dmc.SkipMetricValidation = &skipMetricValidation + } + case "criterionType": + if v != nil { + var criterionType CriterionType + err = json.Unmarshal(*v, &criterionType) + if err != nil { + return err + } + dmc.CriterionType = criterionType + } + } + } + + return nil +} + +// DynamicThresholdFailingPeriods the minimum number of violations required within the selected lookback +// time window required to raise an alert. +type DynamicThresholdFailingPeriods struct { + // NumberOfEvaluationPeriods - The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. + NumberOfEvaluationPeriods *float64 `json:"numberOfEvaluationPeriods,omitempty"` + // MinFailingPeriodsToAlert - The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + MinFailingPeriodsToAlert *float64 `json:"minFailingPeriodsToAlert,omitempty"` +} + +// EmailNotification email notification of an autoscale event. +type EmailNotification struct { + // SendToSubscriptionAdministrator - a value indicating whether to send email to subscription administrator. + SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"` + // SendToSubscriptionCoAdministrators - a value indicating whether to send email to subscription co-administrators. + SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"` + // CustomEmails - the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. + CustomEmails *[]string `json:"customEmails,omitempty"` +} + +// EmailReceiver an email receiver. +type EmailReceiver struct { + // Name - The name of the email receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EmailAddress - The email address of this receiver. + EmailAddress *string `json:"emailAddress,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + // Status - READ-ONLY; The receiver status of the e-mail. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' + Status ReceiverStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for EmailReceiver. +func (er EmailReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if er.Name != nil { + objectMap["name"] = er.Name + } + if er.EmailAddress != nil { + objectMap["emailAddress"] = er.EmailAddress + } + if er.UseCommonAlertSchema != nil { + objectMap["useCommonAlertSchema"] = er.UseCommonAlertSchema + } + return json.Marshal(objectMap) +} + +// EnableRequest describes a receiver that should be resubscribed. +type EnableRequest struct { + // ReceiverName - The name of the receiver to resubscribe. + ReceiverName *string `json:"receiverName,omitempty"` +} + +// Error error details. +type Error struct { + // Code - Error code identifying the specific error. + Code *string `json:"code,omitempty"` + // Message - Error message in the caller's locale. + Message *string `json:"message,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorContract describes the format of Error response. +type ErrorContract struct { + // Error - The error details. + Error *ErrorResponse `json:"error,omitempty"` +} + +// 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 describes the format of Error response. +type ErrorResponse struct { + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// ErrorResponseCommon the resource management error response. +type ErrorResponseCommon struct { + // Details - READ-ONLY; The error details. + Details *[]ErrorResponseCommon `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + // Code - Error code + Code *string `json:"code,omitempty"` + // Message - Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponseCommon. +func (erc ErrorResponseCommon) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erc.Code != nil { + objectMap["code"] = erc.Code + } + if erc.Message != nil { + objectMap["message"] = erc.Message + } + return json.Marshal(objectMap) +} + +// ErrorResponseCommonV2 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 ErrorResponseCommonV2 struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// EventCategoryCollection a collection of event categories. Currently possible values are: Administrative, +// Security, ServiceHealth, Alert, Recommendation, Policy. +type EventCategoryCollection struct { + autorest.Response `json:"-"` + // Value - the list that includes the Azure event categories. + Value *[]LocalizableString `json:"value,omitempty"` +} + +// EventData the Azure event log entries are of type EventData +type EventData struct { + // Authorization - READ-ONLY; The sender authorization information. + Authorization *SenderAuthorization `json:"authorization,omitempty"` + // Claims - READ-ONLY; key value pairs to identify ARM permissions. + Claims map[string]*string `json:"claims"` + // Caller - READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. + Caller *string `json:"caller,omitempty"` + // Description - READ-ONLY; the description of the event. + Description *string `json:"description,omitempty"` + // ID - READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. + ID *string `json:"id,omitempty"` + // EventDataID - READ-ONLY; the event data Id. This is a unique identifier for an event. + EventDataID *string `json:"eventDataId,omitempty"` + // CorrelationID - READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. + CorrelationID *string `json:"correlationId,omitempty"` + // EventName - READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. + EventName *LocalizableString `json:"eventName,omitempty"` + // Category - READ-ONLY; the event category. + Category *LocalizableString `json:"category,omitempty"` + // HTTPRequest - READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). + HTTPRequest *HTTPRequestInfo `json:"httpRequest,omitempty"` + // Level - READ-ONLY; the event level. Possible values include: 'EventLevelCritical', 'EventLevelError', 'EventLevelWarning', 'EventLevelInformational', 'EventLevelVerbose' + Level EventLevel `json:"level,omitempty"` + // ResourceGroupName - READ-ONLY; the resource group name of the impacted resource. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - READ-ONLY; the resource provider name of the impacted resource. + ResourceProviderName *LocalizableString `json:"resourceProviderName,omitempty"` + // ResourceID - READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. + ResourceID *string `json:"resourceId,omitempty"` + // ResourceType - READ-ONLY; the resource type + ResourceType *LocalizableString `json:"resourceType,omitempty"` + // OperationID - READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. + OperationID *string `json:"operationId,omitempty"` + // OperationName - READ-ONLY; the operation name. + OperationName *LocalizableString `json:"operationName,omitempty"` + // Properties - READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. + Properties map[string]*string `json:"properties"` + // Status - READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + Status *LocalizableString `json:"status,omitempty"` + // SubStatus - READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) + SubStatus *LocalizableString `json:"subStatus,omitempty"` + // EventTimestamp - READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. + EventTimestamp *date.Time `json:"eventTimestamp,omitempty"` + // SubmissionTimestamp - READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. + SubmissionTimestamp *date.Time `json:"submissionTimestamp,omitempty"` + // SubscriptionID - READ-ONLY; the Azure subscription Id usually a GUID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // TenantID - READ-ONLY; the Azure tenant Id + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventData. +func (ed EventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EventDataCollection represents collection of events. +type EventDataCollection struct { + autorest.Response `json:"-"` + // Value - this list that includes the Azure audit logs. + Value *[]EventData `json:"value,omitempty"` + // NextLink - Provides the link to retrieve the next set of events. + NextLink *string `json:"nextLink,omitempty"` +} + +// EventDataCollectionIterator provides access to a complete listing of EventData values. +type EventDataCollectionIterator struct { + i int + page EventDataCollectionPage +} + +// 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 *EventDataCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionIterator.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 *EventDataCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventDataCollectionIterator) 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 EventDataCollectionIterator) Response() EventDataCollection { + 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 EventDataCollectionIterator) Value() EventData { + if !iter.page.NotDone() { + return EventData{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventDataCollectionIterator type. +func NewEventDataCollectionIterator(page EventDataCollectionPage) EventDataCollectionIterator { + return EventDataCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (edc EventDataCollection) IsEmpty() bool { + return edc.Value == nil || len(*edc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (edc EventDataCollection) hasNextLink() bool { + return edc.NextLink != nil && len(*edc.NextLink) != 0 +} + +// eventDataCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (edc EventDataCollection) eventDataCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !edc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(edc.NextLink))) +} + +// EventDataCollectionPage contains a page of EventData values. +type EventDataCollectionPage struct { + fn func(context.Context, EventDataCollection) (EventDataCollection, error) + edc EventDataCollection +} + +// 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 *EventDataCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventDataCollectionPage.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.edc) + if err != nil { + return err + } + page.edc = 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 *EventDataCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventDataCollectionPage) NotDone() bool { + return !page.edc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventDataCollectionPage) Response() EventDataCollection { + return page.edc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventDataCollectionPage) Values() []EventData { + if page.edc.IsEmpty() { + return nil + } + return *page.edc.Value +} + +// Creates a new instance of the EventDataCollectionPage type. +func NewEventDataCollectionPage(cur EventDataCollection, getNextPage func(context.Context, EventDataCollection) (EventDataCollection, error)) EventDataCollectionPage { + return EventDataCollectionPage{ + fn: getNextPage, + edc: cur, + } +} + +// EventHubReceiver an Event hub receiver. +type EventHubReceiver struct { + // Name - The name of the Event hub receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // EventHubNameSpace - The Event Hub namespace + EventHubNameSpace *string `json:"eventHubNameSpace,omitempty"` + // EventHubName - The name of the specific Event Hub queue + EventHubName *string `json:"eventHubName,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + // TenantID - The tenant Id for the subscription containing this event hub + TenantID *string `json:"tenantId,omitempty"` + // SubscriptionID - The Id for the subscription containing this event hub + SubscriptionID *string `json:"subscriptionId,omitempty"` +} + +// ExtensionDataSource definition of which data will be collected from a separate VM extension that +// integrates with the Azure Monitor Agent. +// Collected from either Windows and Linux machines, depending on which extension is defined. +type ExtensionDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownExtensionDataSourceStreams `json:"streams,omitempty"` + // ExtensionName - The name of the VM extension. + ExtensionName *string `json:"extensionName,omitempty"` + // ExtensionSettings - The extension settings. The format is specific for particular extension. + ExtensionSettings interface{} `json:"extensionSettings,omitempty"` + // InputDataSources - The list of data sources this extension needs data from. + InputDataSources *[]string `json:"inputDataSources,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// HTTPRequestInfo the Http request info. +type HTTPRequestInfo struct { + // ClientRequestID - the client request id. + ClientRequestID *string `json:"clientRequestId,omitempty"` + // ClientIPAddress - the client Ip Address + ClientIPAddress *string `json:"clientIpAddress,omitempty"` + // Method - the Http request method. + Method *string `json:"method,omitempty"` + // URI - the Uri. + URI *string `json:"uri,omitempty"` +} + +// Incident an alert incident indicates the activation status of an alert rule. +type Incident struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Incident name. + Name *string `json:"name,omitempty"` + // RuleName - READ-ONLY; Rule name that is associated with the incident. + RuleName *string `json:"ruleName,omitempty"` + // IsActive - READ-ONLY; A boolean to indicate whether the incident is active or resolved. + IsActive *bool `json:"isActive,omitempty"` + // ActivatedTime - READ-ONLY; The time at which the incident was activated in ISO8601 format. + ActivatedTime *date.Time `json:"activatedTime,omitempty"` + // ResolvedTime - READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. + ResolvedTime *date.Time `json:"resolvedTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for Incident. +func (i Incident) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IncidentListResult the List incidents operation response. +type IncidentListResult struct { + autorest.Response `json:"-"` + // Value - the incident collection. + Value *[]Incident `json:"value,omitempty"` +} + +// ItsmReceiver an Itsm receiver. +type ItsmReceiver struct { + // Name - The name of the Itsm receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // WorkspaceID - OMS LA instance identifier. + WorkspaceID *string `json:"workspaceId,omitempty"` + // ConnectionID - Unique identification of ITSM connection among multiple defined in above workspace. + ConnectionID *string `json:"connectionId,omitempty"` + // TicketConfiguration - JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + TicketConfiguration *string `json:"ticketConfiguration,omitempty"` + // Region - Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + Region *string `json:"region,omitempty"` +} + +// LocalizableString the localizable string class. +type LocalizableString struct { + // Value - the invariant value. + Value *string `json:"value,omitempty"` + // LocalizedValue - the locale specific value. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// LocationThresholdRuleCondition a rule condition based on a certain number of locations failing. +type LocationThresholdRuleCondition struct { + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + WindowSize *string `json:"windowSize,omitempty"` + // FailedLocationCount - the number of locations that must fail to activate the alert. + FailedLocationCount *int32 `json:"failedLocationCount,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { + ltrc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition + objectMap := make(map[string]interface{}) + if ltrc.WindowSize != nil { + objectMap["windowSize"] = ltrc.WindowSize + } + if ltrc.FailedLocationCount != nil { + objectMap["failedLocationCount"] = ltrc.FailedLocationCount + } + objectMap["dataSource"] = ltrc.DataSource + if ltrc.OdataType != "" { + objectMap["odata.type"] = ltrc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return <rc, true +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for LocationThresholdRuleCondition. +func (ltrc LocationThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return <rc, true +} + +// UnmarshalJSON is the custom unmarshaler for LocationThresholdRuleCondition struct. +func (ltrc *LocationThresholdRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + ltrc.WindowSize = &windowSize + } + case "failedLocationCount": + if v != nil { + var failedLocationCount int32 + err = json.Unmarshal(*v, &failedLocationCount) + if err != nil { + return err + } + ltrc.FailedLocationCount = &failedLocationCount + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + ltrc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + ltrc.OdataType = odataType + } + } + } + + return nil +} + +// LogAnalyticsDestination log Analytics destination. +type LogAnalyticsDestination struct { + // WorkspaceResourceID - The resource ID of the Log Analytics workspace. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // WorkspaceID - READ-ONLY; The Customer ID of the Log Analytics workspace. + WorkspaceID *string `json:"workspaceId,omitempty"` + // Name - A friendly name for the destination. + // This name should be unique across all destinations (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogAnalyticsDestination. +func (lad LogAnalyticsDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lad.WorkspaceResourceID != nil { + objectMap["workspaceResourceId"] = lad.WorkspaceResourceID + } + if lad.Name != nil { + objectMap["name"] = lad.Name + } + return json.Marshal(objectMap) +} + +// LogicAppReceiver a logic app receiver. +type LogicAppReceiver struct { + // Name - The name of the logic app receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ResourceID - The azure resource id of the logic app receiver. + ResourceID *string `json:"resourceId,omitempty"` + // CallbackURL - The callback url where http request sent to. + CallbackURL *string `json:"callbackUrl,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` +} + +// LogMetricTrigger a log metrics trigger descriptor. +type LogMetricTrigger struct { + // ThresholdOperator - Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` + // Threshold - The threshold of the metric trigger. + Threshold *float64 `json:"threshold,omitempty"` + // MetricTriggerType - Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'MetricTriggerTypeConsecutive', 'MetricTriggerTypeTotal' + MetricTriggerType MetricTriggerType `json:"metricTriggerType,omitempty"` + // MetricColumn - Evaluation of metric on a particular column + MetricColumn *string `json:"metricColumn,omitempty"` +} + +// LogProfileCollection represents a collection of log profiles. +type LogProfileCollection struct { + autorest.Response `json:"-"` + // Value - the values of the log profiles. + Value *[]LogProfileResource `json:"value,omitempty"` +} + +// LogProfileProperties the log profile properties. +type LogProfileProperties struct { + // StorageAccountID - the resource id of the storage account to which you would like to send the Activity Log. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // ServiceBusRuleID - The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"` + // Locations - List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + Locations *[]string `json:"locations,omitempty"` + // Categories - the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + Categories *[]string `json:"categories,omitempty"` + // RetentionPolicy - the retention policy for the events in the log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// LogProfileResource the log profile resource. +type LogProfileResource struct { + autorest.Response `json:"-"` + // LogProfileProperties - The log profile properties of the resource. + *LogProfileProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogProfileResource. +func (lpr LogProfileResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lpr.LogProfileProperties != nil { + objectMap["properties"] = lpr.LogProfileProperties + } + if lpr.Location != nil { + objectMap["location"] = lpr.Location + } + if lpr.Tags != nil { + objectMap["tags"] = lpr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogProfileResource struct. +func (lpr *LogProfileResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lpr.LogProfileProperties = &logProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lpr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lpr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lpr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lpr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lpr.Tags = tags + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lpr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lpr.Etag = &etag + } + } + } + + return nil +} + +// LogProfileResourcePatch the log profile resource for patch operations. +type LogProfileResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // LogProfileProperties - The log profile properties for an update operation. + *LogProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogProfileResourcePatch. +func (lprp LogProfileResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lprp.Tags != nil { + objectMap["tags"] = lprp.Tags + } + if lprp.LogProfileProperties != nil { + objectMap["properties"] = lprp.LogProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogProfileResourcePatch struct. +func (lprp *LogProfileResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lprp.Tags = tags + } + case "properties": + if v != nil { + var logProfileProperties LogProfileProperties + err = json.Unmarshal(*v, &logProfileProperties) + if err != nil { + return err + } + lprp.LogProfileProperties = &logProfileProperties + } + } + } + + return nil +} + +// LogSearchRule log Search Rule Definition +type LogSearchRule struct { + // CreatedWithAPIVersion - READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string `json:"createdWithApiVersion,omitempty"` + // IsLegacyLogAnalyticsRule - READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool `json:"isLegacyLogAnalyticsRule,omitempty"` + // Description - The description of the Log Search rule. + Description *string `json:"description,omitempty"` + // DisplayName - The display name of the alert rule + DisplayName *string `json:"displayName,omitempty"` + // AutoMitigate - The flag that indicates whether the alert should be automatically resolved or not. The default is false. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' + Enabled Enabled `json:"enabled,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in IS08601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the scheduled query rule. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateDeploying', 'ProvisioningStateCanceled', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Source - Data Source against which rule will Query Data + Source *Source `json:"source,omitempty"` + // Schedule - Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction + Schedule *Schedule `json:"schedule,omitempty"` + // Action - Action needs to be taken on rule execution. + Action BasicAction `json:"action,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogSearchRule. +func (lsr LogSearchRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lsr.Description != nil { + objectMap["description"] = lsr.Description + } + if lsr.DisplayName != nil { + objectMap["displayName"] = lsr.DisplayName + } + if lsr.AutoMitigate != nil { + objectMap["autoMitigate"] = lsr.AutoMitigate + } + if lsr.Enabled != "" { + objectMap["enabled"] = lsr.Enabled + } + if lsr.Source != nil { + objectMap["source"] = lsr.Source + } + if lsr.Schedule != nil { + objectMap["schedule"] = lsr.Schedule + } + objectMap["action"] = lsr.Action + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogSearchRule struct. +func (lsr *LogSearchRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "createdWithApiVersion": + if v != nil { + var createdWithAPIVersion string + err = json.Unmarshal(*v, &createdWithAPIVersion) + if err != nil { + return err + } + lsr.CreatedWithAPIVersion = &createdWithAPIVersion + } + case "isLegacyLogAnalyticsRule": + if v != nil { + var isLegacyLogAnalyticsRule bool + err = json.Unmarshal(*v, &isLegacyLogAnalyticsRule) + if err != nil { + return err + } + lsr.IsLegacyLogAnalyticsRule = &isLegacyLogAnalyticsRule + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + lsr.Description = &description + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + lsr.DisplayName = &displayName + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + lsr.AutoMitigate = &autoMitigate + } + case "enabled": + if v != nil { + var enabled Enabled + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + lsr.Enabled = enabled + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + lsr.LastUpdatedTime = &lastUpdatedTime + } + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + lsr.ProvisioningState = provisioningState + } + case "source": + if v != nil { + var source Source + err = json.Unmarshal(*v, &source) + if err != nil { + return err + } + lsr.Source = &source + } + case "schedule": + if v != nil { + var schedule Schedule + err = json.Unmarshal(*v, &schedule) + if err != nil { + return err + } + lsr.Schedule = &schedule + } + case "action": + if v != nil { + action, err := unmarshalBasicAction(*v) + if err != nil { + return err + } + lsr.Action = action + } + } + } + + return nil +} + +// LogSearchRulePatch log Search Rule Definition for Patching +type LogSearchRulePatch struct { + // Enabled - The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'EnabledTrue', 'EnabledFalse' + Enabled Enabled `json:"enabled,omitempty"` +} + +// LogSearchRuleResource the Log Search Rule resource. +type LogSearchRuleResource struct { + autorest.Response `json:"-"` + // LogSearchRule - The rule properties of the resource. + *LogSearchRule `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogSearchRuleResource. +func (lsrr LogSearchRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lsrr.LogSearchRule != nil { + objectMap["properties"] = lsrr.LogSearchRule + } + if lsrr.Location != nil { + objectMap["location"] = lsrr.Location + } + if lsrr.Tags != nil { + objectMap["tags"] = lsrr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResource struct. +func (lsrr *LogSearchRuleResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var logSearchRule LogSearchRule + err = json.Unmarshal(*v, &logSearchRule) + if err != nil { + return err + } + lsrr.LogSearchRule = &logSearchRule + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lsrr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lsrr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lsrr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lsrr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lsrr.Tags = tags + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + lsrr.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lsrr.Etag = &etag + } + } + } + + return nil +} + +// LogSearchRuleResourceCollection represents a collection of Log Search rule resources. +type LogSearchRuleResourceCollection struct { + autorest.Response `json:"-"` + // Value - The values for the Log Search Rule resources. + Value *[]LogSearchRuleResource `json:"value,omitempty"` +} + +// LogSearchRuleResourcePatch the log search rule resource for patch operations. +type LogSearchRuleResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // LogSearchRulePatch - The log search rule properties of the resource. + *LogSearchRulePatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogSearchRuleResourcePatch. +func (lsrrp LogSearchRuleResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lsrrp.Tags != nil { + objectMap["tags"] = lsrrp.Tags + } + if lsrrp.LogSearchRulePatch != nil { + objectMap["properties"] = lsrrp.LogSearchRulePatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LogSearchRuleResourcePatch struct. +func (lsrrp *LogSearchRuleResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lsrrp.Tags = tags + } + case "properties": + if v != nil { + var logSearchRulePatch LogSearchRulePatch + err = json.Unmarshal(*v, &logSearchRulePatch) + if err != nil { + return err + } + lsrrp.LogSearchRulePatch = &logSearchRulePatch + } + } + } + + return nil +} + +// LogSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. +type LogSettings struct { + // Category - Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. + Category *string `json:"category,omitempty"` + // Enabled - a value indicating whether this log is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - the retention policy for this log. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// LogsIngestionEndpointSpec definition of the endpoint used for ingesting logs. +type LogsIngestionEndpointSpec struct { + // Endpoint - READ-ONLY; The endpoint. This property is READ-ONLY. + Endpoint *string `json:"endpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogsIngestionEndpointSpec. +func (lies LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// LogToMetricAction specify action need to be taken when rule type is converting log to metric +type LogToMetricAction struct { + // Criteria - Criteria of Metric + Criteria *[]Criteria `json:"criteria,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicActionOdataTypeAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesAlertingAction', 'OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction' + OdataType OdataTypeBasicAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LogToMetricAction. +func (ltma LogToMetricAction) MarshalJSON() ([]byte, error) { + ltma.OdataType = OdataTypeBasicActionOdataTypeMicrosoftWindowsAzureManagementMonitoringAlertsModelsMicrosoftAppInsightsNexusDataContractsResourcesScheduledQueryRulesLogToMetricAction + objectMap := make(map[string]interface{}) + if ltma.Criteria != nil { + objectMap["criteria"] = ltma.Criteria + } + if ltma.OdataType != "" { + objectMap["odata.type"] = ltma.OdataType + } + return json.Marshal(objectMap) +} + +// AsAlertingAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsAlertingAction() (*AlertingAction, bool) { + return nil, false +} + +// AsLogToMetricAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsLogToMetricAction() (*LogToMetricAction, bool) { + return <ma, true +} + +// AsAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsAction() (*Action, bool) { + return nil, false +} + +// AsBasicAction is the BasicAction implementation for LogToMetricAction. +func (ltma LogToMetricAction) AsBasicAction() (BasicAction, bool) { + return <ma, true +} + +// ManagementEventAggregationCondition how the data that is collected should be combined over time. +type ManagementEventAggregationCondition struct { + // Operator - the condition operator. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - The threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + WindowSize *string `json:"windowSize,omitempty"` +} + +// ManagementEventRuleCondition a management event rule condition. +type ManagementEventRuleCondition struct { + // Aggregation - How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { + merc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition + objectMap := make(map[string]interface{}) + if merc.Aggregation != nil { + objectMap["aggregation"] = merc.Aggregation + } + objectMap["dataSource"] = merc.DataSource + if merc.OdataType != "" { + objectMap["odata.type"] = merc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return &merc, true +} + +// AsRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for ManagementEventRuleCondition. +func (merc ManagementEventRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &merc, true +} + +// UnmarshalJSON is the custom unmarshaler for ManagementEventRuleCondition struct. +func (merc *ManagementEventRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "aggregation": + if v != nil { + var aggregation ManagementEventAggregationCondition + err = json.Unmarshal(*v, &aggregation) + if err != nil { + return err + } + merc.Aggregation = &aggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + merc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + merc.OdataType = odataType + } + } + } + + return nil +} + +// MetadataValue represents a metric metadata value. +type MetadataValue struct { + // Name - the name of the metadata. + Name *LocalizableString `json:"name,omitempty"` + // Value - the value of the metadata. + Value *string `json:"value,omitempty"` +} + +// Metric the result data of a query. +type Metric struct { + // ID - the metric Id. + ID *string `json:"id,omitempty"` + // Type - the resource type of the metric resource. + Type *string `json:"type,omitempty"` + // Name - the name and the display name of the metric, i.e. it is localizable string. + Name *LocalizableString `json:"name,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // ErrorCode - 'Success' or the error details on query failures for this metric. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - Error message encountered querying this specific metric. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` + // Timeseries - the time series returned when a data query is performed. + Timeseries *[]TimeSeriesElement `json:"timeseries,omitempty"` +} + +// MetricAlertAction an alert action. +type MetricAlertAction struct { + // ActionGroupID - the id of the action group to use. + ActionGroupID *string `json:"actionGroupId,omitempty"` + // WebHookProperties - This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. + WebHookProperties map[string]*string `json:"webHookProperties"` +} + +// MarshalJSON is the custom marshaler for MetricAlertAction. +func (maa MetricAlertAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if maa.ActionGroupID != nil { + objectMap["actionGroupId"] = maa.ActionGroupID + } + if maa.WebHookProperties != nil { + objectMap["webHookProperties"] = maa.WebHookProperties + } + return json.Marshal(objectMap) +} + +// BasicMetricAlertCriteria the rule criteria that defines the conditions of the alert rule. +type BasicMetricAlertCriteria interface { + AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) + AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) + AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) + AsMetricAlertCriteria() (*MetricAlertCriteria, bool) +} + +// MetricAlertCriteria the rule criteria that defines the conditions of the alert rule. +type MetricAlertCriteria struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` +} + +func unmarshalBasicMetricAlertCriteria(body []byte) (BasicMetricAlertCriteria, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): + var masrmmc MetricAlertSingleResourceMultipleMetricCriteria + err := json.Unmarshal(body, &masrmmc) + return masrmmc, err + case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): + var wlac WebtestLocationAvailabilityCriteria + err := json.Unmarshal(body, &wlac) + return wlac, err + case string(OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): + var mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria + err := json.Unmarshal(body, &mamrmmc) + return mamrmmc, err + default: + var mac MetricAlertCriteria + err := json.Unmarshal(body, &mac) + return mac, err + } +} +func unmarshalBasicMetricAlertCriteriaArray(body []byte) ([]BasicMetricAlertCriteria, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + macArray := make([]BasicMetricAlertCriteria, len(rawMessages)) + + for index, rawMessage := range rawMessages { + mac, err := unmarshalBasicMetricAlertCriteria(*rawMessage) + if err != nil { + return nil, err + } + macArray[index] = mac + } + return macArray, nil +} + +// MarshalJSON is the custom marshaler for MetricAlertCriteria. +func (mac MetricAlertCriteria) MarshalJSON() ([]byte, error) { + mac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria + objectMap := make(map[string]interface{}) + if mac.OdataType != "" { + objectMap["odata.type"] = mac.OdataType + } + for k, v := range mac.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. +func (mac MetricAlertCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. +func (mac MetricAlertCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return nil, false +} + +// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. +func (mac MetricAlertCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. +func (mac MetricAlertCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { + return &mac, true +} + +// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertCriteria. +func (mac MetricAlertCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { + return &mac, true +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertCriteria struct. +func (mac *MetricAlertCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if mac.AdditionalProperties == nil { + mac.AdditionalProperties = make(map[string]interface{}) + } + mac.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicMetricAlertCriteria + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + mac.OdataType = odataType + } + } + } + + return nil +} + +// MetricAlertMultipleResourceMultipleMetricCriteria specifies the metric alert criteria for multiple +// resource that has multiple metric criteria. +type MetricAlertMultipleResourceMultipleMetricCriteria struct { + // AllOf - the list of multiple metric criteria for this 'all of' operation. + AllOf *[]BasicMultiMetricCriteria `json:"allOf,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertMultipleResourceMultipleMetricCriteria. +func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { + mamrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria + objectMap := make(map[string]interface{}) + if mamrmmc.AllOf != nil { + objectMap["allOf"] = mamrmmc.AllOf + } + if mamrmmc.OdataType != "" { + objectMap["odata.type"] = mamrmmc.OdataType + } + for k, v := range mamrmmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. +func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. +func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return nil, false +} + +// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. +func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { + return &mamrmmc, true +} + +// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. +func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { + return nil, false +} + +// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertMultipleResourceMultipleMetricCriteria. +func (mamrmmc MetricAlertMultipleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { + return &mamrmmc, true +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertMultipleResourceMultipleMetricCriteria struct. +func (mamrmmc *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "allOf": + if v != nil { + allOf, err := unmarshalBasicMultiMetricCriteriaArray(*v) + if err != nil { + return err + } + mamrmmc.AllOf = &allOf + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if mamrmmc.AdditionalProperties == nil { + mamrmmc.AdditionalProperties = make(map[string]interface{}) + } + mamrmmc.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicMetricAlertCriteria + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + mamrmmc.OdataType = odataType + } + } + } + + return nil +} + +// MetricAlertProperties an alert rule. +type MetricAlertProperties struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertProperties. +func (mapVar MetricAlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapVar.Description != nil { + objectMap["description"] = mapVar.Description + } + if mapVar.Severity != nil { + objectMap["severity"] = mapVar.Severity + } + if mapVar.Enabled != nil { + objectMap["enabled"] = mapVar.Enabled + } + if mapVar.Scopes != nil { + objectMap["scopes"] = mapVar.Scopes + } + if mapVar.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapVar.EvaluationFrequency + } + if mapVar.WindowSize != nil { + objectMap["windowSize"] = mapVar.WindowSize + } + if mapVar.TargetResourceType != nil { + objectMap["targetResourceType"] = mapVar.TargetResourceType + } + if mapVar.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapVar.TargetResourceRegion + } + objectMap["criteria"] = mapVar.Criteria + if mapVar.AutoMitigate != nil { + objectMap["autoMitigate"] = mapVar.AutoMitigate + } + if mapVar.Actions != nil { + objectMap["actions"] = mapVar.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertProperties struct. +func (mapVar *MetricAlertProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapVar.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapVar.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapVar.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapVar.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapVar.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapVar.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapVar.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapVar.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapVar.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapVar.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapVar.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapVar.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapVar.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertPropertiesPatch an alert rule properties for patch. +type MetricAlertPropertiesPatch struct { + // Description - the description of the metric alert that will be included in the alert email. + Description *string `json:"description,omitempty"` + // Severity - Alert severity {0, 1, 2, 3, 4} + Severity *int32 `json:"severity,omitempty"` + // Enabled - the flag that indicates whether the metric alert is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Scopes - the list of resource id's that this metric alert is scoped to. + Scopes *[]string `json:"scopes,omitempty"` + // EvaluationFrequency - how often the metric alert is evaluated represented in ISO 8601 duration format. + EvaluationFrequency *string `json:"evaluationFrequency,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + WindowSize *string `json:"windowSize,omitempty"` + // TargetResourceType - the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceType *string `json:"targetResourceType,omitempty"` + // TargetResourceRegion - the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + TargetResourceRegion *string `json:"targetResourceRegion,omitempty"` + // Criteria - defines the specific alert criteria information. + Criteria BasicMetricAlertCriteria `json:"criteria,omitempty"` + // AutoMitigate - the flag that indicates whether the alert should be auto resolved or not. The default is true. + AutoMitigate *bool `json:"autoMitigate,omitempty"` + // Actions - the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + Actions *[]MetricAlertAction `json:"actions,omitempty"` + // LastUpdatedTime - READ-ONLY; Last time the rule was updated in ISO8601 format. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // IsMigrated - READ-ONLY; the value indicating whether this alert rule is migrated. + IsMigrated *bool `json:"isMigrated,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertPropertiesPatch. +func (mapp MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mapp.Description != nil { + objectMap["description"] = mapp.Description + } + if mapp.Severity != nil { + objectMap["severity"] = mapp.Severity + } + if mapp.Enabled != nil { + objectMap["enabled"] = mapp.Enabled + } + if mapp.Scopes != nil { + objectMap["scopes"] = mapp.Scopes + } + if mapp.EvaluationFrequency != nil { + objectMap["evaluationFrequency"] = mapp.EvaluationFrequency + } + if mapp.WindowSize != nil { + objectMap["windowSize"] = mapp.WindowSize + } + if mapp.TargetResourceType != nil { + objectMap["targetResourceType"] = mapp.TargetResourceType + } + if mapp.TargetResourceRegion != nil { + objectMap["targetResourceRegion"] = mapp.TargetResourceRegion + } + objectMap["criteria"] = mapp.Criteria + if mapp.AutoMitigate != nil { + objectMap["autoMitigate"] = mapp.AutoMitigate + } + if mapp.Actions != nil { + objectMap["actions"] = mapp.Actions + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertPropertiesPatch struct. +func (mapp *MetricAlertPropertiesPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + mapp.Description = &description + } + case "severity": + if v != nil { + var severity int32 + err = json.Unmarshal(*v, &severity) + if err != nil { + return err + } + mapp.Severity = &severity + } + case "enabled": + if v != nil { + var enabled bool + err = json.Unmarshal(*v, &enabled) + if err != nil { + return err + } + mapp.Enabled = &enabled + } + case "scopes": + if v != nil { + var scopes []string + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + mapp.Scopes = &scopes + } + case "evaluationFrequency": + if v != nil { + var evaluationFrequency string + err = json.Unmarshal(*v, &evaluationFrequency) + if err != nil { + return err + } + mapp.EvaluationFrequency = &evaluationFrequency + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + mapp.WindowSize = &windowSize + } + case "targetResourceType": + if v != nil { + var targetResourceType string + err = json.Unmarshal(*v, &targetResourceType) + if err != nil { + return err + } + mapp.TargetResourceType = &targetResourceType + } + case "targetResourceRegion": + if v != nil { + var targetResourceRegion string + err = json.Unmarshal(*v, &targetResourceRegion) + if err != nil { + return err + } + mapp.TargetResourceRegion = &targetResourceRegion + } + case "criteria": + if v != nil { + criteria, err := unmarshalBasicMetricAlertCriteria(*v) + if err != nil { + return err + } + mapp.Criteria = criteria + } + case "autoMitigate": + if v != nil { + var autoMitigate bool + err = json.Unmarshal(*v, &autoMitigate) + if err != nil { + return err + } + mapp.AutoMitigate = &autoMitigate + } + case "actions": + if v != nil { + var actions []MetricAlertAction + err = json.Unmarshal(*v, &actions) + if err != nil { + return err + } + mapp.Actions = &actions + } + case "lastUpdatedTime": + if v != nil { + var lastUpdatedTime date.Time + err = json.Unmarshal(*v, &lastUpdatedTime) + if err != nil { + return err + } + mapp.LastUpdatedTime = &lastUpdatedTime + } + case "isMigrated": + if v != nil { + var isMigrated bool + err = json.Unmarshal(*v, &isMigrated) + if err != nil { + return err + } + mapp.IsMigrated = &isMigrated + } + } + } + + return nil +} + +// MetricAlertResource the metric alert resource. +type MetricAlertResource struct { + autorest.Response `json:"-"` + // MetricAlertProperties - The alert rule properties of the resource. + *MetricAlertProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertResource. +func (mar MetricAlertResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mar.MetricAlertProperties != nil { + objectMap["properties"] = mar.MetricAlertProperties + } + if mar.Location != nil { + objectMap["location"] = mar.Location + } + if mar.Tags != nil { + objectMap["tags"] = mar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertResource struct. +func (mar *MetricAlertResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var metricAlertProperties MetricAlertProperties + err = json.Unmarshal(*v, &metricAlertProperties) + if err != nil { + return err + } + mar.MetricAlertProperties = &metricAlertProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mar.Tags = tags + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mar.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mar.Etag = &etag + } + } + } + + return nil +} + +// MetricAlertResourceCollection represents a collection of alert rule resources. +type MetricAlertResourceCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]MetricAlertResource `json:"value,omitempty"` +} + +// MetricAlertResourcePatch the metric alert resource for patch operations. +type MetricAlertResourcePatch struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // MetricAlertPropertiesPatch - The alert rule properties of the resource. + *MetricAlertPropertiesPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertResourcePatch. +func (marp MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if marp.Tags != nil { + objectMap["tags"] = marp.Tags + } + if marp.MetricAlertPropertiesPatch != nil { + objectMap["properties"] = marp.MetricAlertPropertiesPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertResourcePatch struct. +func (marp *MetricAlertResourcePatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + marp.Tags = tags + } + case "properties": + if v != nil { + var metricAlertPropertiesPatch MetricAlertPropertiesPatch + err = json.Unmarshal(*v, &metricAlertPropertiesPatch) + if err != nil { + return err + } + marp.MetricAlertPropertiesPatch = &metricAlertPropertiesPatch + } + } + } + + return nil +} + +// MetricAlertSingleResourceMultipleMetricCriteria specifies the metric alert criteria for a single +// resource that has multiple metric criteria. +type MetricAlertSingleResourceMultipleMetricCriteria struct { + // AllOf - The list of metric criteria for this 'all of' operation. + AllOf *[]MetricCriteria `json:"allOf,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertSingleResourceMultipleMetricCriteria. +func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { + masrmmc.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria + objectMap := make(map[string]interface{}) + if masrmmc.AllOf != nil { + objectMap["allOf"] = masrmmc.AllOf + } + if masrmmc.OdataType != "" { + objectMap["odata.type"] = masrmmc.OdataType + } + for k, v := range masrmmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. +func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { + return &masrmmc, true +} + +// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. +func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return nil, false +} + +// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. +func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. +func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { + return nil, false +} + +// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for MetricAlertSingleResourceMultipleMetricCriteria. +func (masrmmc MetricAlertSingleResourceMultipleMetricCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { + return &masrmmc, true +} + +// UnmarshalJSON is the custom unmarshaler for MetricAlertSingleResourceMultipleMetricCriteria struct. +func (masrmmc *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "allOf": + if v != nil { + var allOf []MetricCriteria + err = json.Unmarshal(*v, &allOf) + if err != nil { + return err + } + masrmmc.AllOf = &allOf + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if masrmmc.AdditionalProperties == nil { + masrmmc.AdditionalProperties = make(map[string]interface{}) + } + masrmmc.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicMetricAlertCriteria + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + masrmmc.OdataType = odataType + } + } + } + + return nil +} + +// MetricAlertStatus an alert status. +type MetricAlertStatus struct { + // Name - The status name. + Name *string `json:"name,omitempty"` + // ID - The alert rule arm id. + ID *string `json:"id,omitempty"` + // Type - The extended resource type name. + Type *string `json:"type,omitempty"` + // Properties - The alert status properties of the metric alert status. + Properties *MetricAlertStatusProperties `json:"properties,omitempty"` +} + +// MetricAlertStatusCollection represents a collection of alert rule resources. +type MetricAlertStatusCollection struct { + autorest.Response `json:"-"` + // Value - the values for the alert rule resources. + Value *[]MetricAlertStatus `json:"value,omitempty"` +} + +// MetricAlertStatusProperties an alert status properties. +type MetricAlertStatusProperties struct { + // Dimensions - An object describing the type of the dimensions. + Dimensions map[string]*string `json:"dimensions"` + // Status - status value + Status *string `json:"status,omitempty"` + // Timestamp - UTC time when the status was checked. + Timestamp *date.Time `json:"timestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricAlertStatusProperties. +func (masp MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if masp.Dimensions != nil { + objectMap["dimensions"] = masp.Dimensions + } + if masp.Status != nil { + objectMap["status"] = masp.Status + } + if masp.Timestamp != nil { + objectMap["timestamp"] = masp.Timestamp + } + return json.Marshal(objectMap) +} + +// MetricAvailability metric availability specifies the time grain (aggregation interval or frequency) and +// the retention period for that time grain. +type MetricAvailability struct { + // TimeGrain - the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + Retention *string `json:"retention,omitempty"` +} + +// MetricBaselinesProperties the response to a metric baselines query. +type MetricBaselinesProperties struct { + // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + Interval *string `json:"interval,omitempty"` + // Namespace - The namespace of the metrics been queried. + Namespace *string `json:"namespace,omitempty"` + // Baselines - The baseline for each time series that was queried. + Baselines *[]TimeSeriesBaseline `json:"baselines,omitempty"` +} + +// MetricBaselinesResponse a list of metric baselines. +type MetricBaselinesResponse struct { + autorest.Response `json:"-"` + // Value - The list of metric baselines. + Value *[]SingleMetricBaseline `json:"value,omitempty"` +} + +// MetricCriteria criterion to filter metrics. +type MetricCriteria struct { + // Operator - the criteria operator. Possible values include: 'OperatorEquals', 'OperatorGreaterThan', 'OperatorGreaterThanOrEqual', 'OperatorLessThan', 'OperatorLessThanOrEqual' + Operator Operator `json:"operator,omitempty"` + // Threshold - the criteria threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - Name of the criteria. + Name *string `json:"name,omitempty"` + // MetricName - Name of the metric. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - Namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` + // Dimensions - List of dimension conditions. + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. + SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` + // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' + CriterionType CriterionType `json:"criterionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MetricCriteria. +func (mc MetricCriteria) MarshalJSON() ([]byte, error) { + mc.CriterionType = CriterionTypeStaticThresholdCriterion + objectMap := make(map[string]interface{}) + if mc.Operator != "" { + objectMap["operator"] = mc.Operator + } + if mc.Threshold != nil { + objectMap["threshold"] = mc.Threshold + } + if mc.Name != nil { + objectMap["name"] = mc.Name + } + if mc.MetricName != nil { + objectMap["metricName"] = mc.MetricName + } + if mc.MetricNamespace != nil { + objectMap["metricNamespace"] = mc.MetricNamespace + } + if mc.TimeAggregation != "" { + objectMap["timeAggregation"] = mc.TimeAggregation + } + if mc.Dimensions != nil { + objectMap["dimensions"] = mc.Dimensions + } + if mc.SkipMetricValidation != nil { + objectMap["skipMetricValidation"] = mc.SkipMetricValidation + } + if mc.CriterionType != "" { + objectMap["criterionType"] = mc.CriterionType + } + for k, v := range mc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. +func (mc MetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { + return &mc, true +} + +// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. +func (mc MetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { + return nil, false +} + +// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. +func (mc MetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { + return nil, false +} + +// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MetricCriteria. +func (mc MetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { + return &mc, true +} + +// UnmarshalJSON is the custom unmarshaler for MetricCriteria struct. +func (mc *MetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator Operator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + mc.Operator = operator + } + case "threshold": + if v != nil { + var threshold float64 + err = json.Unmarshal(*v, &threshold) + if err != nil { + return err + } + mc.Threshold = &threshold + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if mc.AdditionalProperties == nil { + mc.AdditionalProperties = make(map[string]interface{}) + } + mc.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "metricName": + if v != nil { + var metricName string + err = json.Unmarshal(*v, &metricName) + if err != nil { + return err + } + mc.MetricName = &metricName + } + case "metricNamespace": + if v != nil { + var metricNamespace string + err = json.Unmarshal(*v, &metricNamespace) + if err != nil { + return err + } + mc.MetricNamespace = &metricNamespace + } + case "timeAggregation": + if v != nil { + var timeAggregation AggregationTypeEnum + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + mc.TimeAggregation = timeAggregation + } + case "dimensions": + if v != nil { + var dimensions []MetricDimension + err = json.Unmarshal(*v, &dimensions) + if err != nil { + return err + } + mc.Dimensions = &dimensions + } + case "skipMetricValidation": + if v != nil { + var skipMetricValidation bool + err = json.Unmarshal(*v, &skipMetricValidation) + if err != nil { + return err + } + mc.SkipMetricValidation = &skipMetricValidation + } + case "criterionType": + if v != nil { + var criterionType CriterionType + err = json.Unmarshal(*v, &criterionType) + if err != nil { + return err + } + mc.CriterionType = criterionType + } + } + } + + return nil +} + +// MetricDefinition metric definition class specifies the metadata for a metric. +type MetricDefinition struct { + // IsDimensionRequired - Flag to indicate whether the dimension is required. + IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` + // ResourceID - the resource identifier of the resource that emitted the metric. + ResourceID *string `json:"resourceId,omitempty"` + // Namespace - the namespace the metric belongs to. + Namespace *string `json:"namespace,omitempty"` + // Name - the name and the display name of the metric, i.e. it is a localizable string. + Name *LocalizableString `json:"name,omitempty"` + // DisplayDescription - Detailed description of this metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Category - Custom category name for this metric. + Category *string `json:"category,omitempty"` + // MetricClass - The class of the metric. Possible values include: 'MetricClassAvailability', 'MetricClassTransactions', 'MetricClassErrors', 'MetricClassLatency', 'MetricClassSaturation' + MetricClass MetricClass `json:"metricClass,omitempty"` + // Unit - The unit of the metric. Possible values include: 'MetricUnitCount', 'MetricUnitBytes', 'MetricUnitSeconds', 'MetricUnitCountPerSecond', 'MetricUnitBytesPerSecond', 'MetricUnitPercent', 'MetricUnitMilliSeconds', 'MetricUnitByteSeconds', 'MetricUnitUnspecified', 'MetricUnitCores', 'MetricUnitMilliCores', 'MetricUnitNanoCores', 'MetricUnitBitsPerSecond' + Unit MetricUnit `json:"unit,omitempty"` + // PrimaryAggregationType - the primary aggregation type value defining how to use the values for display. Possible values include: 'AggregationTypeNone', 'AggregationTypeAverage', 'AggregationTypeCount', 'AggregationTypeMinimum', 'AggregationTypeMaximum', 'AggregationTypeTotal' + PrimaryAggregationType AggregationType `json:"primaryAggregationType,omitempty"` + // SupportedAggregationTypes - the collection of what aggregation types are supported. + SupportedAggregationTypes *[]AggregationType `json:"supportedAggregationTypes,omitempty"` + // MetricAvailabilities - the collection of what aggregation intervals are available to be queried. + MetricAvailabilities *[]MetricAvailability `json:"metricAvailabilities,omitempty"` + // ID - the resource identifier of the metric definition. + ID *string `json:"id,omitempty"` + // Dimensions - the name and the display name of the dimension, i.e. it is a localizable string. + Dimensions *[]LocalizableString `json:"dimensions,omitempty"` +} + +// MetricDefinitionCollection represents collection of metric definitions. +type MetricDefinitionCollection struct { + autorest.Response `json:"-"` + // Value - the values for the metric definitions. + Value *[]MetricDefinition `json:"value,omitempty"` +} + +// MetricDimension specifies a metric dimension. +type MetricDimension struct { + // Name - Name of the dimension. + Name *string `json:"name,omitempty"` + // Operator - the dimension operator. Only 'Include' and 'Exclude' are supported + Operator *string `json:"operator,omitempty"` + // Values - list of dimension values. + Values *[]string `json:"values,omitempty"` +} + +// MetricNamespace metric namespace class specifies the metadata for a metric namespace. +type MetricNamespace struct { + // ID - The ID of the metric namespace. + ID *string `json:"id,omitempty"` + // Type - The type of the namespace. + Type *string `json:"type,omitempty"` + // Name - The escaped name of the namespace. + Name *string `json:"name,omitempty"` + // Classification - Kind of namespace. Possible values include: 'NamespaceClassificationPlatform', 'NamespaceClassificationCustom', 'NamespaceClassificationQos' + Classification NamespaceClassification `json:"classification,omitempty"` + // Properties - Properties which include the fully qualified namespace name. + Properties *MetricNamespaceName `json:"properties,omitempty"` +} + +// MetricNamespaceCollection represents collection of metric namespaces. +type MetricNamespaceCollection struct { + autorest.Response `json:"-"` + // Value - The values for the metric namespaces. + Value *[]MetricNamespace `json:"value,omitempty"` +} + +// MetricNamespaceName the fully qualified metric namespace name. +type MetricNamespaceName struct { + // MetricNamespaceName - The metric namespace name. + MetricNamespaceName *string `json:"metricNamespaceName,omitempty"` +} + +// MetricSettings part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. +type MetricSettings struct { + // TimeGrain - the timegrain of the metric in ISO8601 format. + TimeGrain *string `json:"timeGrain,omitempty"` + // Category - Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. + Category *string `json:"category,omitempty"` + // Enabled - a value indicating whether this category is enabled. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - the retention policy for this category. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` +} + +// MetricSingleDimension the metric dimension name and value. +type MetricSingleDimension struct { + // Name - Name of the dimension. + Name *string `json:"name,omitempty"` + // Value - Value of the dimension. + Value *string `json:"value,omitempty"` +} + +// MetricTrigger the trigger that results in a scaling action. +type MetricTrigger struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - the namespace of the metric that defines what the rule monitors. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // MetricResourceURI - the resource identifier of the resource the rule monitors. + MetricResourceURI *string `json:"metricResourceUri,omitempty"` + // MetricResourceLocation - the location of the resource the rule monitors. + MetricResourceLocation *string `json:"metricResourceLocation,omitempty"` + // TimeGrain - the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. + TimeGrain *string `json:"timeGrain,omitempty"` + // Statistic - the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'MetricStatisticTypeAverage', 'MetricStatisticTypeMin', 'MetricStatisticTypeMax', 'MetricStatisticTypeSum', 'MetricStatisticTypeCount' + Statistic MetricStatisticType `json:"statistic,omitempty"` + // TimeWindow - the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. + TimeWindow *string `json:"timeWindow,omitempty"` + // TimeAggregation - time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'TimeAggregationTypeAverage', 'TimeAggregationTypeMinimum', 'TimeAggregationTypeMaximum', 'TimeAggregationTypeTotal', 'TimeAggregationTypeCount', 'TimeAggregationTypeLast' + TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"` + // Operator - the operator that is used to compare the metric data and the threshold. Possible values include: 'ComparisonOperationTypeEquals', 'ComparisonOperationTypeNotEquals', 'ComparisonOperationTypeGreaterThan', 'ComparisonOperationTypeGreaterThanOrEqual', 'ComparisonOperationTypeLessThan', 'ComparisonOperationTypeLessThanOrEqual' + Operator ComparisonOperationType `json:"operator,omitempty"` + // Threshold - the threshold of the metric that triggers the scale action. + Threshold *float64 `json:"threshold,omitempty"` + // Dimensions - List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. + Dimensions *[]ScaleRuleMetricDimension `json:"dimensions,omitempty"` + // DividePerInstance - a value indicating whether metric should divide per instance. + DividePerInstance *bool `json:"dividePerInstance,omitempty"` +} + +// MetricValue represents a metric value. +type MetricValue struct { + // TimeStamp - the timestamp for the metric value in ISO 8601 format. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Average - the average value in the time range. + Average *float64 `json:"average,omitempty"` + // Minimum - the least value in the time range. + Minimum *float64 `json:"minimum,omitempty"` + // Maximum - the greatest value in the time range. + Maximum *float64 `json:"maximum,omitempty"` + // Total - the sum of all of the values in the time range. + Total *float64 `json:"total,omitempty"` + // Count - the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. + Count *float64 `json:"count,omitempty"` +} + +// BasicMultiMetricCriteria the types of conditions for a multi resource alert. +type BasicMultiMetricCriteria interface { + AsMetricCriteria() (*MetricCriteria, bool) + AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) + AsMultiMetricCriteria() (*MultiMetricCriteria, bool) +} + +// MultiMetricCriteria the types of conditions for a multi resource alert. +type MultiMetricCriteria struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Name - Name of the criteria. + Name *string `json:"name,omitempty"` + // MetricName - Name of the metric. + MetricName *string `json:"metricName,omitempty"` + // MetricNamespace - Namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // TimeAggregation - the criteria time aggregation types. Possible values include: 'AggregationTypeEnumAverage', 'AggregationTypeEnumCount', 'AggregationTypeEnumMinimum', 'AggregationTypeEnumMaximum', 'AggregationTypeEnumTotal' + TimeAggregation AggregationTypeEnum `json:"timeAggregation,omitempty"` + // Dimensions - List of dimension conditions. + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SkipMetricValidation - Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. + SkipMetricValidation *bool `json:"skipMetricValidation,omitempty"` + // CriterionType - Possible values include: 'CriterionTypeMultiMetricCriteria', 'CriterionTypeStaticThresholdCriterion', 'CriterionTypeDynamicThresholdCriterion' + CriterionType CriterionType `json:"criterionType,omitempty"` +} + +func unmarshalBasicMultiMetricCriteria(body []byte) (BasicMultiMetricCriteria, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["criterionType"] { + case string(CriterionTypeStaticThresholdCriterion): + var mc MetricCriteria + err := json.Unmarshal(body, &mc) + return mc, err + case string(CriterionTypeDynamicThresholdCriterion): + var dmc DynamicMetricCriteria + err := json.Unmarshal(body, &dmc) + return dmc, err + default: + var mmc MultiMetricCriteria + err := json.Unmarshal(body, &mmc) + return mmc, err + } +} +func unmarshalBasicMultiMetricCriteriaArray(body []byte) ([]BasicMultiMetricCriteria, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + mmcArray := make([]BasicMultiMetricCriteria, len(rawMessages)) + + for index, rawMessage := range rawMessages { + mmc, err := unmarshalBasicMultiMetricCriteria(*rawMessage) + if err != nil { + return nil, err + } + mmcArray[index] = mmc + } + return mmcArray, nil +} + +// MarshalJSON is the custom marshaler for MultiMetricCriteria. +func (mmc MultiMetricCriteria) MarshalJSON() ([]byte, error) { + mmc.CriterionType = CriterionTypeMultiMetricCriteria + objectMap := make(map[string]interface{}) + if mmc.Name != nil { + objectMap["name"] = mmc.Name + } + if mmc.MetricName != nil { + objectMap["metricName"] = mmc.MetricName + } + if mmc.MetricNamespace != nil { + objectMap["metricNamespace"] = mmc.MetricNamespace + } + if mmc.TimeAggregation != "" { + objectMap["timeAggregation"] = mmc.TimeAggregation + } + if mmc.Dimensions != nil { + objectMap["dimensions"] = mmc.Dimensions + } + if mmc.SkipMetricValidation != nil { + objectMap["skipMetricValidation"] = mmc.SkipMetricValidation + } + if mmc.CriterionType != "" { + objectMap["criterionType"] = mmc.CriterionType + } + for k, v := range mmc.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsMetricCriteria() (*MetricCriteria, bool) { + return nil, false +} + +// AsDynamicMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsDynamicMetricCriteria() (*DynamicMetricCriteria, bool) { + return nil, false +} + +// AsMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsMultiMetricCriteria() (*MultiMetricCriteria, bool) { + return &mmc, true +} + +// AsBasicMultiMetricCriteria is the BasicMultiMetricCriteria implementation for MultiMetricCriteria. +func (mmc MultiMetricCriteria) AsBasicMultiMetricCriteria() (BasicMultiMetricCriteria, bool) { + return &mmc, true +} + +// UnmarshalJSON is the custom unmarshaler for MultiMetricCriteria struct. +func (mmc *MultiMetricCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if mmc.AdditionalProperties == nil { + mmc.AdditionalProperties = make(map[string]interface{}) + } + mmc.AdditionalProperties[k] = additionalProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mmc.Name = &name + } + case "metricName": + if v != nil { + var metricName string + err = json.Unmarshal(*v, &metricName) + if err != nil { + return err + } + mmc.MetricName = &metricName + } + case "metricNamespace": + if v != nil { + var metricNamespace string + err = json.Unmarshal(*v, &metricNamespace) + if err != nil { + return err + } + mmc.MetricNamespace = &metricNamespace + } + case "timeAggregation": + if v != nil { + var timeAggregation AggregationTypeEnum + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + mmc.TimeAggregation = timeAggregation + } + case "dimensions": + if v != nil { + var dimensions []MetricDimension + err = json.Unmarshal(*v, &dimensions) + if err != nil { + return err + } + mmc.Dimensions = &dimensions + } + case "skipMetricValidation": + if v != nil { + var skipMetricValidation bool + err = json.Unmarshal(*v, &skipMetricValidation) + if err != nil { + return err + } + mmc.SkipMetricValidation = &skipMetricValidation + } + case "criterionType": + if v != nil { + var criterionType CriterionType + err = json.Unmarshal(*v, &criterionType) + if err != nil { + return err + } + mmc.CriterionType = criterionType + } + } + } + + return nil +} + +// NetworkRuleSet definition of the network rules. +type NetworkRuleSet struct { + // PublicNetworkAccess - The configuration to set whether network access from public internet to the endpoints are allowed. Possible values include: 'KnownPublicNetworkAccessOptionsEnabled', 'KnownPublicNetworkAccessOptionsDisabled' + PublicNetworkAccess KnownPublicNetworkAccessOptions `json:"publicNetworkAccess,omitempty"` +} + +// NotificationRequestBody the request body which contain contact detail metadata +type NotificationRequestBody struct { + // AlertType - The name of the supported alert type. + AlertType *string `json:"alertType,omitempty"` + // EmailReceivers - The list of email receivers that are part of this action group. + EmailReceivers *[]EmailReceiver `json:"emailReceivers,omitempty"` + // SmsReceivers - The list of SMS receivers that are part of this action group. + SmsReceivers *[]SmsReceiver `json:"smsReceivers,omitempty"` + // WebhookReceivers - The list of webhook receivers that are part of this action group. + WebhookReceivers *[]WebhookReceiver `json:"webhookReceivers,omitempty"` + // ItsmReceivers - The list of ITSM receivers that are part of this action group. + ItsmReceivers *[]ItsmReceiver `json:"itsmReceivers,omitempty"` + // AzureAppPushReceivers - The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers *[]AzureAppPushReceiver `json:"azureAppPushReceivers,omitempty"` + // AutomationRunbookReceivers - The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers *[]AutomationRunbookReceiver `json:"automationRunbookReceivers,omitempty"` + // VoiceReceivers - The list of voice receivers that are part of this action group. + VoiceReceivers *[]VoiceReceiver `json:"voiceReceivers,omitempty"` + // LogicAppReceivers - The list of logic app receivers that are part of this action group. + LogicAppReceivers *[]LogicAppReceiver `json:"logicAppReceivers,omitempty"` + // AzureFunctionReceivers - The list of azure function receivers that are part of this action group. + AzureFunctionReceivers *[]AzureFunctionReceiver `json:"azureFunctionReceivers,omitempty"` + // ArmRoleReceivers - The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. + ArmRoleReceivers *[]ArmRoleReceiver `json:"armRoleReceivers,omitempty"` + // EventHubReceivers - The list of event hub receivers that are part of this action group. + EventHubReceivers *[]EventHubReceiver `json:"eventHubReceivers,omitempty"` +} + +// Operation microsoft Insights API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.Insights + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed: AlertRules, Autoscale, etc. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list Microsoft.Insights operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the Microsoft.Insights provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationStatus the status of operation. +type OperationStatus struct { + autorest.Response `json:"-"` + // ID - The operation Id. + ID *string `json:"id,omitempty"` + // Name - The operation name. + Name *string `json:"name,omitempty"` + // StartTime - Start time of the job in standard ISO8601 format. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the job in standard ISO8601 format. + EndTime *date.Time `json:"endTime,omitempty"` + // Status - The status of the operation. + Status *string `json:"status,omitempty"` + // Error - The error detail of the operation if any. + Error *ErrorResponseCommon `json:"error,omitempty"` +} + +// PerfCounterDataSource definition of which performance counters will be collected and how they will be +// collected by this data collection rule. +// Collected from both Windows and Linux machines where the counter is present. +type PerfCounterDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownPerfCounterDataSourceStreams `json:"streams,omitempty"` + // SamplingFrequencyInSeconds - The number of seconds between consecutive counter measurements (samples). + SamplingFrequencyInSeconds *int32 `json:"samplingFrequencyInSeconds,omitempty"` + // CounterSpecifiers - A list of specifier names of the performance counters you want to collect. + // Use a wildcard (*) to collect a counter for all instances. + // To get a list of performance counters on Windows, run the command 'typeperf'. + CounterSpecifiers *[]string `json:"counterSpecifiers,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. +func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionListResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultIterator struct { + i int + page PrivateEndpointConnectionListResultPage +} + +// 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 *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.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 *PrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListResultIterator) 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 PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { + 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 PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. +func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { + return PrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { + return peclr.Value == nil || len(*peclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { + return peclr.NextLink != nil && len(*peclr.NextLink) != 0 +} + +// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !peclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(peclr.NextLink))) +} + +// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultPage struct { + fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) + peclr PrivateEndpointConnectionListResult +} + +// 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 *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.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.peclr) + if err != nil { + return err + } + page.peclr = 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 *PrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.peclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { + return page.peclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { + if page.peclr.IsEmpty() { + return nil + } + return *page.peclr.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListResultPage type. +func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { + return PrivateEndpointConnectionListResultPage{ + fn: getNextPage, + peclr: cur, + } +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; State of the private endpoint connection. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) 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 PrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateOrUpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) 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 PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("insights.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateEndpointProperty private endpoint which the connection belongs to. +type PrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + } + } + + return nil +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceListResult. +func (plrlr PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource +// values. +type PrivateLinkResourceListResultIterator struct { + i int + page PrivateLinkResourceListResultPage +} + +// 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 *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.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 *PrivateLinkResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourceListResultIterator) 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 PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { + 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 PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourceListResultIterator type. +func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { + return PrivateLinkResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { + return plrlr.Value == nil || len(*plrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { + return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 +} + +// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plrlr.NextLink))) +} + +// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. +type PrivateLinkResourceListResultPage struct { + fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) + plrlr PrivateLinkResourceListResult +} + +// 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 *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.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.plrlr) + if err != nil { + return err + } + page.plrlr = 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 *PrivateLinkResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourceListResultPage) NotDone() bool { + return !page.plrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { + return page.plrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { + if page.plrlr.IsEmpty() { + return nil + } + return *page.plrlr.Value +} + +// Creates a new instance of the PrivateLinkResourceListResultPage type. +func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { + return PrivateLinkResourceListResultPage{ + fn: getNextPage, + plrlr: cur, + } +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkScopedResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateLinkScopedResourcesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkScopedResourcesClient) (ScopedResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) 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 PrivateLinkScopedResourcesCreateOrUpdateFuture.Result. +func (future *PrivateLinkScopedResourcesCreateOrUpdateFuture) result(client PrivateLinkScopedResourcesClient) (sr ScopedResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkScopedResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateLinkScopedResourcesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkScopedResourcesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkScopedResourcesDeleteFuture) 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 PrivateLinkScopedResourcesDeleteFuture.Result. +func (future *PrivateLinkScopedResourcesDeleteFuture) result(client PrivateLinkScopedResourcesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopedResourcesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkScopesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PrivateLinkScopesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkScopesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkScopesDeleteFuture) 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 PrivateLinkScopesDeleteFuture.Result. +func (future *PrivateLinkScopesDeleteFuture) result(client PrivateLinkScopesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("insights.PrivateLinkScopesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkScopesResource an azure resource object +type PrivateLinkScopesResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkScopesResource. +func (plsr PrivateLinkScopesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsr.Location != nil { + objectMap["location"] = plsr.Location + } + if plsr.Tags != nil { + objectMap["tags"] = plsr.Tags + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionStateProperty state of the private endpoint connection. +type PrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; The actions required for private link service connection. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. +func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscsp.Status != nil { + objectMap["status"] = plscsp.Status + } + if plscsp.Description != nil { + objectMap["description"] = plscsp.Description + } + return json.Marshal(objectMap) +} + +// ProxyOnlyResource a proxy only azure resource object +type ProxyOnlyResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyOnlyResource. +func (por ProxyOnlyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ProxyResource an azure resource object +type ProxyResource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Recurrence the repeating times at which this profile begins. This element is not used if the FixedDate +// element is used. +type Recurrence struct { + // Frequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'RecurrenceFrequencyNone', 'RecurrenceFrequencySecond', 'RecurrenceFrequencyMinute', 'RecurrenceFrequencyHour', 'RecurrenceFrequencyDay', 'RecurrenceFrequencyWeek', 'RecurrenceFrequencyMonth', 'RecurrenceFrequencyYear' + Frequency RecurrenceFrequency `json:"frequency,omitempty"` + // Schedule - the scheduling constraints for when the profile begins. + Schedule *RecurrentSchedule `json:"schedule,omitempty"` +} + +// RecurrentSchedule the scheduling constraints for when the profile begins. +type RecurrentSchedule struct { + // TimeZone - the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time + TimeZone *string `json:"timeZone,omitempty"` + // Days - the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. + Days *[]string `json:"days,omitempty"` + // Hours - A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). + Hours *[]int32 `json:"hours,omitempty"` + // Minutes - A collection of minutes at which the profile takes effect at. + Minutes *[]int32 `json:"minutes,omitempty"` +} + +// Resource an azure resource object +type Resource struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Kind - READ-ONLY; Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceForUpdate definition of ARM tracked top level resource properties for update operation. +type ResourceForUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ResourceForUpdate. +func (rfu ResourceForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfu.Tags != nil { + objectMap["tags"] = rfu.Tags + } + return json.Marshal(objectMap) +} + +// Response the response to a metrics query. +type Response struct { + autorest.Response `json:"-"` + // Cost - The integer value representing the relative cost of the query. + Cost *float64 `json:"cost,omitempty"` + // Timespan - The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + Timespan *string `json:"timespan,omitempty"` + // Interval - The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + Interval *string `json:"interval,omitempty"` + // Namespace - The namespace of the metrics being queried + Namespace *string `json:"namespace,omitempty"` + // Resourceregion - The region of the resource being queried for metrics. + Resourceregion *string `json:"resourceregion,omitempty"` + // Value - the value of the collection. + Value *[]Metric `json:"value,omitempty"` +} + +// ResponseWithError an error response from the API. +type ResponseWithError struct { + // Error - Error information. + Error *Error `json:"error,omitempty"` +} + +// RetentionPolicy specifies the retention policy for the log. +type RetentionPolicy struct { + // Enabled - a value indicating whether the retention policy is enabled. + Enabled *bool `json:"enabled,omitempty"` + // Days - the number of days for the retention in days. A value of 0 will retain the events indefinitely. + Days *int32 `json:"days,omitempty"` +} + +// BasicRuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. +type BasicRuleAction interface { + AsRuleEmailAction() (*RuleEmailAction, bool) + AsRuleWebhookAction() (*RuleWebhookAction, bool) + AsRuleAction() (*RuleAction, bool) +} + +// RuleAction the action that is performed when the alert rule becomes active, and when an alert condition is +// resolved. +type RuleAction struct { + // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleAction(body []byte) (BasicRuleAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction): + var rea RuleEmailAction + err := json.Unmarshal(body, &rea) + return rea, err + case string(OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction): + var rwa RuleWebhookAction + err := json.Unmarshal(body, &rwa) + return rwa, err + default: + var ra RuleAction + err := json.Unmarshal(body, &ra) + return ra, err + } +} +func unmarshalBasicRuleActionArray(body []byte) ([]BasicRuleAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + raArray := make([]BasicRuleAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ra, err := unmarshalBasicRuleAction(*rawMessage) + if err != nil { + return nil, err + } + raArray[index] = ra + } + return raArray, nil +} + +// MarshalJSON is the custom marshaler for RuleAction. +func (ra RuleAction) MarshalJSON() ([]byte, error) { + ra.OdataType = OdataTypeBasicRuleActionOdataTypeRuleAction + objectMap := make(map[string]interface{}) + if ra.OdataType != "" { + objectMap["odata.type"] = ra.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return nil, false +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return nil, false +} + +// AsRuleAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsRuleAction() (*RuleAction, bool) { + return &ra, true +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleAction. +func (ra RuleAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &ra, true +} + +// BasicRuleCondition the condition that results in the alert rule being activated. +type BasicRuleCondition interface { + AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) + AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) + AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) + AsRuleCondition() (*RuleCondition, bool) +} + +// RuleCondition the condition that results in the alert rule being activated. +type RuleCondition struct { + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleCondition(body []byte) (BasicRuleCondition, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition): + var trc ThresholdRuleCondition + err := json.Unmarshal(body, &trc) + return trc, err + case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition): + var ltrc LocationThresholdRuleCondition + err := json.Unmarshal(body, <rc) + return ltrc, err + case string(OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition): + var merc ManagementEventRuleCondition + err := json.Unmarshal(body, &merc) + return merc, err + default: + var rc RuleCondition + err := json.Unmarshal(body, &rc) + return rc, err + } +} +func unmarshalBasicRuleConditionArray(body []byte) ([]BasicRuleCondition, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rcArray := make([]BasicRuleCondition, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rc, err := unmarshalBasicRuleCondition(*rawMessage) + if err != nil { + return nil, err + } + rcArray[index] = rc + } + return rcArray, nil +} + +// MarshalJSON is the custom marshaler for RuleCondition. +func (rc RuleCondition) MarshalJSON() ([]byte, error) { + rc.OdataType = OdataTypeBasicRuleConditionOdataTypeRuleCondition + objectMap := make(map[string]interface{}) + objectMap["dataSource"] = rc.DataSource + if rc.OdataType != "" { + objectMap["odata.type"] = rc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return nil, false +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return &rc, true +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for RuleCondition. +func (rc RuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &rc, true +} + +// UnmarshalJSON is the custom unmarshaler for RuleCondition struct. +func (rc *RuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + rc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + rc.OdataType = odataType + } + } + } + + return nil +} + +// BasicRuleDataSource the resource from which the rule collects its data. +type BasicRuleDataSource interface { + AsRuleMetricDataSource() (*RuleMetricDataSource, bool) + AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) + AsRuleDataSource() (*RuleDataSource, bool) +} + +// RuleDataSource the resource from which the rule collects its data. +type RuleDataSource struct { + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +func unmarshalBasicRuleDataSource(body []byte) (BasicRuleDataSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["odata.type"] { + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource): + var rmds RuleMetricDataSource + err := json.Unmarshal(body, &rmds) + return rmds, err + case string(OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource): + var rmeds RuleManagementEventDataSource + err := json.Unmarshal(body, &rmeds) + return rmeds, err + default: + var rds RuleDataSource + err := json.Unmarshal(body, &rds) + return rds, err + } +} +func unmarshalBasicRuleDataSourceArray(body []byte) ([]BasicRuleDataSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rdsArray := make([]BasicRuleDataSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rds, err := unmarshalBasicRuleDataSource(*rawMessage) + if err != nil { + return nil, err + } + rdsArray[index] = rds + } + return rdsArray, nil +} + +// MarshalJSON is the custom marshaler for RuleDataSource. +func (rds RuleDataSource) MarshalJSON() ([]byte, error) { + rds.OdataType = OdataTypeRuleDataSource + objectMap := make(map[string]interface{}) + if rds.ResourceURI != nil { + objectMap["resourceUri"] = rds.ResourceURI + } + if rds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rds.LegacyResourceID + } + if rds.ResourceLocation != nil { + objectMap["resourceLocation"] = rds.ResourceLocation + } + if rds.MetricNamespace != nil { + objectMap["metricNamespace"] = rds.MetricNamespace + } + if rds.OdataType != "" { + objectMap["odata.type"] = rds.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return nil, false +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return nil, false +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return &rds, true +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleDataSource. +func (rds RuleDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rds, true +} + +// RuleEmailAction specifies the action to send email when the rule condition is evaluated. The +// discriminator is always RuleEmailAction in this case. +type RuleEmailAction struct { + // SendToServiceOwners - Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"` + // CustomEmails - the list of administrator's custom email addresses to notify of the activation of the alert. + CustomEmails *[]string `json:"customEmails,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleEmailAction. +func (rea RuleEmailAction) MarshalJSON() ([]byte, error) { + rea.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction + objectMap := make(map[string]interface{}) + if rea.SendToServiceOwners != nil { + objectMap["sendToServiceOwners"] = rea.SendToServiceOwners + } + if rea.CustomEmails != nil { + objectMap["customEmails"] = rea.CustomEmails + } + if rea.OdataType != "" { + objectMap["odata.type"] = rea.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return &rea, true +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return nil, false +} + +// AsRuleAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsRuleAction() (*RuleAction, bool) { + return nil, false +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleEmailAction. +func (rea RuleEmailAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &rea, true +} + +// RuleManagementEventClaimsDataSource the claims for a rule management event data source. +type RuleManagementEventClaimsDataSource struct { + // EmailAddress - the email address. + EmailAddress *string `json:"emailAddress,omitempty"` +} + +// RuleManagementEventDataSource a rule management event data source. The discriminator fields is always +// RuleManagementEventDataSource in this case. +type RuleManagementEventDataSource struct { + // EventName - the event name. + EventName *string `json:"eventName,omitempty"` + // EventSource - the event source. + EventSource *string `json:"eventSource,omitempty"` + // Level - the level. + Level *string `json:"level,omitempty"` + // OperationName - The name of the operation that should be checked for. If no name is provided, any operation will match. + OperationName *string `json:"operationName,omitempty"` + // ResourceGroupName - the resource group name. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceProviderName - the resource provider name. + ResourceProviderName *string `json:"resourceProviderName,omitempty"` + // Status - The status of the operation that should be checked for. If no status is provided, any status will match. + Status *string `json:"status,omitempty"` + // SubStatus - the substatus. + SubStatus *string `json:"subStatus,omitempty"` + // Claims - the claims. + Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { + rmeds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource + objectMap := make(map[string]interface{}) + if rmeds.EventName != nil { + objectMap["eventName"] = rmeds.EventName + } + if rmeds.EventSource != nil { + objectMap["eventSource"] = rmeds.EventSource + } + if rmeds.Level != nil { + objectMap["level"] = rmeds.Level + } + if rmeds.OperationName != nil { + objectMap["operationName"] = rmeds.OperationName + } + if rmeds.ResourceGroupName != nil { + objectMap["resourceGroupName"] = rmeds.ResourceGroupName + } + if rmeds.ResourceProviderName != nil { + objectMap["resourceProviderName"] = rmeds.ResourceProviderName + } + if rmeds.Status != nil { + objectMap["status"] = rmeds.Status + } + if rmeds.SubStatus != nil { + objectMap["subStatus"] = rmeds.SubStatus + } + if rmeds.Claims != nil { + objectMap["claims"] = rmeds.Claims + } + if rmeds.ResourceURI != nil { + objectMap["resourceUri"] = rmeds.ResourceURI + } + if rmeds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmeds.LegacyResourceID + } + if rmeds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmeds.ResourceLocation + } + if rmeds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmeds.MetricNamespace + } + if rmeds.OdataType != "" { + objectMap["odata.type"] = rmeds.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return nil, false +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return &rmeds, true +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return nil, false +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleManagementEventDataSource. +func (rmeds RuleManagementEventDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rmeds, true +} + +// RuleMetricDataSource a rule metric data source. The discriminator value is always RuleMetricDataSource +// in this case. +type RuleMetricDataSource struct { + // MetricName - the name of the metric that defines what the rule monitors. + MetricName *string `json:"metricName,omitempty"` + // ResourceURI - the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + ResourceURI *string `json:"resourceUri,omitempty"` + // LegacyResourceID - the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + LegacyResourceID *string `json:"legacyResourceId,omitempty"` + // ResourceLocation - the location of the resource. + ResourceLocation *string `json:"resourceLocation,omitempty"` + // MetricNamespace - the namespace of the metric. + MetricNamespace *string `json:"metricNamespace,omitempty"` + // OdataType - Possible values include: 'OdataTypeRuleDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource', 'OdataTypeMicrosoftAzureManagementInsightsModelsRuleManagementEventDataSource' + OdataType OdataType `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleMetricDataSource. +func (rmds RuleMetricDataSource) MarshalJSON() ([]byte, error) { + rmds.OdataType = OdataTypeMicrosoftAzureManagementInsightsModelsRuleMetricDataSource + objectMap := make(map[string]interface{}) + if rmds.MetricName != nil { + objectMap["metricName"] = rmds.MetricName + } + if rmds.ResourceURI != nil { + objectMap["resourceUri"] = rmds.ResourceURI + } + if rmds.LegacyResourceID != nil { + objectMap["legacyResourceId"] = rmds.LegacyResourceID + } + if rmds.ResourceLocation != nil { + objectMap["resourceLocation"] = rmds.ResourceLocation + } + if rmds.MetricNamespace != nil { + objectMap["metricNamespace"] = rmds.MetricNamespace + } + if rmds.OdataType != "" { + objectMap["odata.type"] = rmds.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleMetricDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleMetricDataSource() (*RuleMetricDataSource, bool) { + return &rmds, true +} + +// AsRuleManagementEventDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleManagementEventDataSource() (*RuleManagementEventDataSource, bool) { + return nil, false +} + +// AsRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsRuleDataSource() (*RuleDataSource, bool) { + return nil, false +} + +// AsBasicRuleDataSource is the BasicRuleDataSource implementation for RuleMetricDataSource. +func (rmds RuleMetricDataSource) AsBasicRuleDataSource() (BasicRuleDataSource, bool) { + return &rmds, true +} + +// RuleWebhookAction specifies the action to post to service when the rule condition is evaluated. The +// discriminator is always RuleWebhookAction in this case. +type RuleWebhookAction struct { + // ServiceURI - the service uri to Post the notification when the alert activates or resolves. + ServiceURI *string `json:"serviceUri,omitempty"` + // Properties - the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + Properties map[string]*string `json:"properties"` + // OdataType - Possible values include: 'OdataTypeBasicRuleActionOdataTypeRuleAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleEmailAction', 'OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction' + OdataType OdataTypeBasicRuleAction `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RuleWebhookAction. +func (rwa RuleWebhookAction) MarshalJSON() ([]byte, error) { + rwa.OdataType = OdataTypeBasicRuleActionOdataTypeMicrosoftAzureManagementInsightsModelsRuleWebhookAction + objectMap := make(map[string]interface{}) + if rwa.ServiceURI != nil { + objectMap["serviceUri"] = rwa.ServiceURI + } + if rwa.Properties != nil { + objectMap["properties"] = rwa.Properties + } + if rwa.OdataType != "" { + objectMap["odata.type"] = rwa.OdataType + } + return json.Marshal(objectMap) +} + +// AsRuleEmailAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleEmailAction() (*RuleEmailAction, bool) { + return nil, false +} + +// AsRuleWebhookAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleWebhookAction() (*RuleWebhookAction, bool) { + return &rwa, true +} + +// AsRuleAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsRuleAction() (*RuleAction, bool) { + return nil, false +} + +// AsBasicRuleAction is the BasicRuleAction implementation for RuleWebhookAction. +func (rwa RuleWebhookAction) AsBasicRuleAction() (BasicRuleAction, bool) { + return &rwa, true +} + +// ScaleAction the parameters for the scaling action. +type ScaleAction struct { + // Direction - the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'ScaleDirectionNone', 'ScaleDirectionIncrease', 'ScaleDirectionDecrease' + Direction ScaleDirection `json:"direction,omitempty"` + // Type - the type of action that should occur when the scale rule fires. Possible values include: 'ScaleTypeChangeCount', 'ScaleTypePercentChangeCount', 'ScaleTypeExactCount', 'ScaleTypeServiceAllowedNextValue' + Type ScaleType `json:"type,omitempty"` + // Value - the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. + Value *string `json:"value,omitempty"` + // Cooldown - the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. + Cooldown *string `json:"cooldown,omitempty"` +} + +// ScaleCapacity the number of instances that can be used during this profile. +type ScaleCapacity struct { + // Minimum - the minimum number of instances for the resource. + Minimum *string `json:"minimum,omitempty"` + // Maximum - the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. + Maximum *string `json:"maximum,omitempty"` + // Default - the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. + Default *string `json:"default,omitempty"` +} + +// ScaleRule a rule that provide the triggers and parameters for the scaling action. +type ScaleRule struct { + // MetricTrigger - the trigger that results in a scaling action. + MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"` + // ScaleAction - the parameters for the scaling action. + ScaleAction *ScaleAction `json:"scaleAction,omitempty"` +} + +// ScaleRuleMetricDimension specifies an auto scale rule metric dimension. +type ScaleRuleMetricDimension struct { + // DimensionName - Name of the dimension. + DimensionName *string `json:"DimensionName,omitempty"` + // Operator - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. 'NotEquals' being not equal to all of the values. Possible values include: 'ScaleRuleMetricDimensionOperationTypeEquals', 'ScaleRuleMetricDimensionOperationTypeNotEquals' + Operator ScaleRuleMetricDimensionOperationType `json:"Operator,omitempty"` + // Values - list of dimension values. For example: ["App1","App2"]. + Values *[]string `json:"Values,omitempty"` +} + +// Schedule defines how often to run the search and the time interval. +type Schedule struct { + // FrequencyInMinutes - frequency (in minutes) at which rule condition should be evaluated. + FrequencyInMinutes *int32 `json:"frequencyInMinutes,omitempty"` + // TimeWindowInMinutes - Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). + TimeWindowInMinutes *int32 `json:"timeWindowInMinutes,omitempty"` +} + +// ScopedResource a private link scoped resource +type ScopedResource struct { + autorest.Response `json:"-"` + // ScopedResourceProperties - Resource properties. + *ScopedResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopedResource. +func (sr ScopedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.ScopedResourceProperties != nil { + objectMap["properties"] = sr.ScopedResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScopedResource struct. +func (sr *ScopedResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scopedResourceProperties ScopedResourceProperties + err = json.Unmarshal(*v, &scopedResourceProperties) + if err != nil { + return err + } + sr.ScopedResourceProperties = &scopedResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + } + } + + return nil +} + +// ScopedResourceListResult a list of scoped resources in a private link scope. +type ScopedResourceListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]ScopedResource `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopedResourceListResult. +func (srlr ScopedResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ScopedResourceListResultIterator provides access to a complete listing of ScopedResource values. +type ScopedResourceListResultIterator struct { + i int + page ScopedResourceListResultPage +} + +// 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 *ScopedResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultIterator.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 *ScopedResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScopedResourceListResultIterator) 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 ScopedResourceListResultIterator) Response() ScopedResourceListResult { + 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 ScopedResourceListResultIterator) Value() ScopedResource { + if !iter.page.NotDone() { + return ScopedResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ScopedResourceListResultIterator type. +func NewScopedResourceListResultIterator(page ScopedResourceListResultPage) ScopedResourceListResultIterator { + return ScopedResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srlr ScopedResourceListResult) IsEmpty() bool { + return srlr.Value == nil || len(*srlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srlr ScopedResourceListResult) hasNextLink() bool { + return srlr.NextLink != nil && len(*srlr.NextLink) != 0 +} + +// scopedResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srlr ScopedResourceListResult) scopedResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !srlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srlr.NextLink))) +} + +// ScopedResourceListResultPage contains a page of ScopedResource values. +type ScopedResourceListResultPage struct { + fn func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error) + srlr ScopedResourceListResult +} + +// 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 *ScopedResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopedResourceListResultPage.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.srlr) + if err != nil { + return err + } + page.srlr = 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 *ScopedResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScopedResourceListResultPage) NotDone() bool { + return !page.srlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScopedResourceListResultPage) Response() ScopedResourceListResult { + return page.srlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScopedResourceListResultPage) Values() []ScopedResource { + if page.srlr.IsEmpty() { + return nil + } + return *page.srlr.Value +} + +// Creates a new instance of the ScopedResourceListResultPage type. +func NewScopedResourceListResultPage(cur ScopedResourceListResult, getNextPage func(context.Context, ScopedResourceListResult) (ScopedResourceListResult, error)) ScopedResourceListResultPage { + return ScopedResourceListResultPage{ + fn: getNextPage, + srlr: cur, + } +} + +// ScopedResourceProperties properties of a private link scoped resource. +type ScopedResourceProperties struct { + // LinkedResourceID - The resource id of the scoped Azure monitor resource. + LinkedResourceID *string `json:"linkedResourceId,omitempty"` + // ProvisioningState - READ-ONLY; State of the private endpoint connection. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopedResourceProperties. +func (srp ScopedResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srp.LinkedResourceID != nil { + objectMap["linkedResourceId"] = srp.LinkedResourceID + } + return json.Marshal(objectMap) +} + +// SenderAuthorization the authorization used by the user who has performed the operation that led to this +// event. This captures the RBAC properties of the event. These usually include the 'action', 'role' and +// the 'scope' +type SenderAuthorization struct { + // Action - the permissible actions. For instance: microsoft.support/supporttickets/write + Action *string `json:"action,omitempty"` + // Role - the role of the user. For instance: Subscription Admin + Role *string `json:"role,omitempty"` + // Scope - the scope. + Scope *string `json:"scope,omitempty"` +} + +// SingleBaseline the baseline values for a single sensitivity value. +type SingleBaseline struct { + // Sensitivity - the sensitivity of the baseline. Possible values include: 'BaselineSensitivityLow', 'BaselineSensitivityMedium', 'BaselineSensitivityHigh' + Sensitivity BaselineSensitivity `json:"sensitivity,omitempty"` + // LowThresholds - The low thresholds of the baseline. + LowThresholds *[]float64 `json:"lowThresholds,omitempty"` + // HighThresholds - The high thresholds of the baseline. + HighThresholds *[]float64 `json:"highThresholds,omitempty"` +} + +// SingleMetricBaseline the baseline results of a single metric. +type SingleMetricBaseline struct { + // ID - The metric baseline Id. + ID *string `json:"id,omitempty"` + // Type - The resource type of the metric baseline resource. + Type *string `json:"type,omitempty"` + // Name - The name of the metric for which the baselines were retrieved. + Name *string `json:"name,omitempty"` + // MetricBaselinesProperties - The metric baseline properties of the metric. + *MetricBaselinesProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SingleMetricBaseline. +func (smb SingleMetricBaseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smb.ID != nil { + objectMap["id"] = smb.ID + } + if smb.Type != nil { + objectMap["type"] = smb.Type + } + if smb.Name != nil { + objectMap["name"] = smb.Name + } + if smb.MetricBaselinesProperties != nil { + objectMap["properties"] = smb.MetricBaselinesProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SingleMetricBaseline struct. +func (smb *SingleMetricBaseline) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + smb.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + smb.Type = &typeVar + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + smb.Name = &name + } + case "properties": + if v != nil { + var metricBaselinesProperties MetricBaselinesProperties + err = json.Unmarshal(*v, &metricBaselinesProperties) + if err != nil { + return err + } + smb.MetricBaselinesProperties = &metricBaselinesProperties + } + } + } + + return nil +} + +// SmsReceiver an SMS receiver. +type SmsReceiver struct { + // Name - The name of the SMS receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the SMS receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the SMS receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` + // Status - READ-ONLY; The status of the receiver. Possible values include: 'ReceiverStatusNotSpecified', 'ReceiverStatusEnabled', 'ReceiverStatusDisabled' + Status ReceiverStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for SmsReceiver. +func (sr SmsReceiver) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Name != nil { + objectMap["name"] = sr.Name + } + if sr.CountryCode != nil { + objectMap["countryCode"] = sr.CountryCode + } + if sr.PhoneNumber != nil { + objectMap["phoneNumber"] = sr.PhoneNumber + } + return json.Marshal(objectMap) +} + +// Source specifies the log search query. +type Source struct { + // Query - Log search query. Required for action type - AlertingAction + Query *string `json:"query,omitempty"` + // AuthorizedResources - List of Resource referred into query + AuthorizedResources *[]string `json:"authorizedResources,omitempty"` + // DataSourceID - The resource uri over which log search query is to be run. + DataSourceID *string `json:"dataSourceId,omitempty"` + // QueryType - Set value to 'ResultCount'. Possible values include: 'QueryTypeResultCount' + QueryType QueryType `json:"queryType,omitempty"` +} + +// SyslogDataSource definition of which syslog data will be collected and how it will be collected. +// Only collected from Linux machines. +type SyslogDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownSyslogDataSourceStreams `json:"streams,omitempty"` + // FacilityNames - The list of facility names. + FacilityNames *[]KnownSyslogDataSourceFacilityNames `json:"facilityNames,omitempty"` + // LogLevels - The log levels to collect. + LogLevels *[]KnownSyslogDataSourceLogLevels `json:"logLevels,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a +// PrivateLinkScope instance. +type TagsResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// TestNotificationDetailsResponse the details of the test notification results. +type TestNotificationDetailsResponse struct { + autorest.Response `json:"-"` + Context *Context `json:"Context,omitempty"` + // State - The overall state + State *string `json:"State,omitempty"` + // CompletedTime - The completed time + CompletedTime *string `json:"CompletedTime,omitempty"` + // CreatedTime - The created time + CreatedTime *string `json:"CreatedTime,omitempty"` + // ActionDetails - The list of action detail + ActionDetails *[]ActionDetail `json:"ActionDetails,omitempty"` +} + +// TestNotificationResponse the response when test notification succeeded +type TestNotificationResponse struct { + autorest.Response `json:"-"` + // NotificationID - The notification id + NotificationID *string `json:"notificationId,omitempty"` + // CorrelationID - The correlation id + CorrelationID *string `json:"correlationId,omitempty"` + // CreatedTime - The created time + CreatedTime *string `json:"createdTime,omitempty"` +} + +// ThresholdRuleCondition a rule condition based on a metric crossing a threshold. +type ThresholdRuleCondition struct { + // Operator - the operator used to compare the data and the threshold. Possible values include: 'ConditionOperatorGreaterThan', 'ConditionOperatorGreaterThanOrEqual', 'ConditionOperatorLessThan', 'ConditionOperatorLessThanOrEqual' + Operator ConditionOperator `json:"operator,omitempty"` + // Threshold - the threshold value that activates the alert. + Threshold *float64 `json:"threshold,omitempty"` + // WindowSize - the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + WindowSize *string `json:"windowSize,omitempty"` + // TimeAggregation - the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'TimeAggregationOperatorAverage', 'TimeAggregationOperatorMinimum', 'TimeAggregationOperatorMaximum', 'TimeAggregationOperatorTotal', 'TimeAggregationOperatorLast' + TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"` + // DataSource - the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + DataSource BasicRuleDataSource `json:"dataSource,omitempty"` + // OdataType - Possible values include: 'OdataTypeBasicRuleConditionOdataTypeRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsLocationThresholdRuleCondition', 'OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsManagementEventRuleCondition' + OdataType OdataTypeBasicRuleCondition `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) MarshalJSON() ([]byte, error) { + trc.OdataType = OdataTypeBasicRuleConditionOdataTypeMicrosoftAzureManagementInsightsModelsThresholdRuleCondition + objectMap := make(map[string]interface{}) + if trc.Operator != "" { + objectMap["operator"] = trc.Operator + } + if trc.Threshold != nil { + objectMap["threshold"] = trc.Threshold + } + if trc.WindowSize != nil { + objectMap["windowSize"] = trc.WindowSize + } + if trc.TimeAggregation != "" { + objectMap["timeAggregation"] = trc.TimeAggregation + } + objectMap["dataSource"] = trc.DataSource + if trc.OdataType != "" { + objectMap["odata.type"] = trc.OdataType + } + return json.Marshal(objectMap) +} + +// AsThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsThresholdRuleCondition() (*ThresholdRuleCondition, bool) { + return &trc, true +} + +// AsLocationThresholdRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsLocationThresholdRuleCondition() (*LocationThresholdRuleCondition, bool) { + return nil, false +} + +// AsManagementEventRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsManagementEventRuleCondition() (*ManagementEventRuleCondition, bool) { + return nil, false +} + +// AsRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsRuleCondition() (*RuleCondition, bool) { + return nil, false +} + +// AsBasicRuleCondition is the BasicRuleCondition implementation for ThresholdRuleCondition. +func (trc ThresholdRuleCondition) AsBasicRuleCondition() (BasicRuleCondition, bool) { + return &trc, true +} + +// UnmarshalJSON is the custom unmarshaler for ThresholdRuleCondition struct. +func (trc *ThresholdRuleCondition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "operator": + if v != nil { + var operator ConditionOperator + err = json.Unmarshal(*v, &operator) + if err != nil { + return err + } + trc.Operator = operator + } + case "threshold": + if v != nil { + var threshold float64 + err = json.Unmarshal(*v, &threshold) + if err != nil { + return err + } + trc.Threshold = &threshold + } + case "windowSize": + if v != nil { + var windowSize string + err = json.Unmarshal(*v, &windowSize) + if err != nil { + return err + } + trc.WindowSize = &windowSize + } + case "timeAggregation": + if v != nil { + var timeAggregation TimeAggregationOperator + err = json.Unmarshal(*v, &timeAggregation) + if err != nil { + return err + } + trc.TimeAggregation = timeAggregation + } + case "dataSource": + if v != nil { + dataSource, err := unmarshalBasicRuleDataSource(*v) + if err != nil { + return err + } + trc.DataSource = dataSource + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicRuleCondition + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + trc.OdataType = odataType + } + } + } + + return nil +} + +// TimeSeriesBaseline the baseline values for a single time series. +type TimeSeriesBaseline struct { + // Aggregation - The aggregation type of the metric. + Aggregation *string `json:"aggregation,omitempty"` + // Dimensions - The dimensions of this time series. + Dimensions *[]MetricSingleDimension `json:"dimensions,omitempty"` + // Timestamps - The list of timestamps of the baselines. + Timestamps *[]date.Time `json:"timestamps,omitempty"` + // Data - The baseline values for each sensitivity. + Data *[]SingleBaseline `json:"data,omitempty"` + // MetadataValues - The baseline metadata values. + MetadataValues *[]BaselineMetadata `json:"metadataValues,omitempty"` +} + +// TimeSeriesElement a time series result type. The discriminator value is always TimeSeries in this case. +type TimeSeriesElement struct { + // Metadatavalues - the metadata values returned if $filter was specified in the call. + Metadatavalues *[]MetadataValue `json:"metadatavalues,omitempty"` + // Data - An array of data points representing the metric values. This is only returned if a result type of data is specified. + Data *[]MetricValue `json:"data,omitempty"` +} + +// TimeWindow a specific date-time for the profile. +type TimeWindow struct { + // TimeZone - the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time + TimeZone *string `json:"timeZone,omitempty"` + // Start - the start time for the profile in ISO 8601 format. + Start *date.Time `json:"start,omitempty"` + // End - the end time for the profile in ISO 8601 format. + End *date.Time `json:"end,omitempty"` +} + +// TriggerCondition the condition that results in the Log Search rule. +type TriggerCondition struct { + // ThresholdOperator - Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'ConditionalOperatorGreaterThanOrEqual', 'ConditionalOperatorLessThanOrEqual', 'ConditionalOperatorGreaterThan', 'ConditionalOperatorLessThan', 'ConditionalOperatorEqual' + ThresholdOperator ConditionalOperator `json:"thresholdOperator,omitempty"` + // Threshold - Result or count threshold based on which rule should be triggered. + Threshold *float64 `json:"threshold,omitempty"` + // MetricTrigger - Trigger condition for metric query rule + MetricTrigger *LogMetricTrigger `json:"metricTrigger,omitempty"` +} + +// VMInsightsOnboardingStatus VM Insights onboarding status for a resource. +type VMInsightsOnboardingStatus struct { + autorest.Response `json:"-"` + // VMInsightsOnboardingStatusProperties - Resource properties. + *VMInsightsOnboardingStatusProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Azure resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Azure resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMInsightsOnboardingStatus. +func (vios VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vios.VMInsightsOnboardingStatusProperties != nil { + objectMap["properties"] = vios.VMInsightsOnboardingStatusProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VMInsightsOnboardingStatus struct. +func (vios *VMInsightsOnboardingStatus) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var VMInsightsOnboardingStatusProperties VMInsightsOnboardingStatusProperties + err = json.Unmarshal(*v, &VMInsightsOnboardingStatusProperties) + if err != nil { + return err + } + vios.VMInsightsOnboardingStatusProperties = &VMInsightsOnboardingStatusProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vios.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vios.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vios.Type = &typeVar + } + } + } + + return nil +} + +// VMInsightsOnboardingStatusProperties resource properties. +type VMInsightsOnboardingStatusProperties struct { + // ResourceID - Azure Resource Manager identifier of the resource whose onboarding status is being represented. + ResourceID *string `json:"resourceId,omitempty"` + // OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'OnboardingStatusOnboarded', 'OnboardingStatusNotOnboarded', 'OnboardingStatusUnknown' + OnboardingStatus OnboardingStatus `json:"onboardingStatus,omitempty"` + // DataStatus - The status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'DataStatusPresent', 'DataStatusNotPresent' + DataStatus DataStatus `json:"dataStatus,omitempty"` + // Data - Containers that currently store VM Insights data for the specified resource. + Data *[]DataContainer `json:"data,omitempty"` +} + +// VoiceReceiver a voice receiver. +type VoiceReceiver struct { + // Name - The name of the voice receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // CountryCode - The country code of the voice receiver. + CountryCode *string `json:"countryCode,omitempty"` + // PhoneNumber - The phone number of the voice receiver. + PhoneNumber *string `json:"phoneNumber,omitempty"` +} + +// WebhookNotification webhook notification of an autoscale event. +type WebhookNotification struct { + // ServiceURI - the service address to receive the notification. + ServiceURI *string `json:"serviceUri,omitempty"` + // Properties - a property bag of settings. This value can be empty. + Properties map[string]*string `json:"properties"` +} + +// MarshalJSON is the custom marshaler for WebhookNotification. +func (wn WebhookNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wn.ServiceURI != nil { + objectMap["serviceUri"] = wn.ServiceURI + } + if wn.Properties != nil { + objectMap["properties"] = wn.Properties + } + return json.Marshal(objectMap) +} + +// WebhookReceiver a webhook receiver. +type WebhookReceiver struct { + // Name - The name of the webhook receiver. Names must be unique across all receivers within an action group. + Name *string `json:"name,omitempty"` + // ServiceURI - The URI where webhooks should be sent. + ServiceURI *string `json:"serviceUri,omitempty"` + // UseCommonAlertSchema - Indicates whether to use common alert schema. + UseCommonAlertSchema *bool `json:"useCommonAlertSchema,omitempty"` + // UseAadAuth - Indicates whether or not use AAD authentication. + UseAadAuth *bool `json:"useAadAuth,omitempty"` + // ObjectID - Indicates the webhook app object Id for aad auth. + ObjectID *string `json:"objectId,omitempty"` + // IdentifierURI - Indicates the identifier uri for aad auth. + IdentifierURI *string `json:"identifierUri,omitempty"` + // TenantID - Indicates the tenant id for aad auth. + TenantID *string `json:"tenantId,omitempty"` +} + +// WebtestLocationAvailabilityCriteria specifies the metric alert rule criteria for a web test resource. +type WebtestLocationAvailabilityCriteria struct { + // WebTestID - The Application Insights web test Id. + WebTestID *string `json:"webTestId,omitempty"` + // ComponentID - The Application Insights resource Id. + ComponentID *string `json:"componentId,omitempty"` + // FailedLocationCount - The number of failed locations. + FailedLocationCount *float64 `json:"failedLocationCount,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // OdataType - Possible values include: 'OdataTypeBasicMetricAlertCriteriaOdataTypeMetricAlertCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria', 'OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria' + OdataType OdataTypeBasicMetricAlertCriteria `json:"odata.type,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { + wlac.OdataType = OdataTypeBasicMetricAlertCriteriaOdataTypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria + objectMap := make(map[string]interface{}) + if wlac.WebTestID != nil { + objectMap["webTestId"] = wlac.WebTestID + } + if wlac.ComponentID != nil { + objectMap["componentId"] = wlac.ComponentID + } + if wlac.FailedLocationCount != nil { + objectMap["failedLocationCount"] = wlac.FailedLocationCount + } + if wlac.OdataType != "" { + objectMap["odata.type"] = wlac.OdataType + } + for k, v := range wlac.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsMetricAlertSingleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertSingleResourceMultipleMetricCriteria() (*MetricAlertSingleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsWebtestLocationAvailabilityCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsWebtestLocationAvailabilityCriteria() (*WebtestLocationAvailabilityCriteria, bool) { + return &wlac, true +} + +// AsMetricAlertMultipleResourceMultipleMetricCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertMultipleResourceMultipleMetricCriteria() (*MetricAlertMultipleResourceMultipleMetricCriteria, bool) { + return nil, false +} + +// AsMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsMetricAlertCriteria() (*MetricAlertCriteria, bool) { + return nil, false +} + +// AsBasicMetricAlertCriteria is the BasicMetricAlertCriteria implementation for WebtestLocationAvailabilityCriteria. +func (wlac WebtestLocationAvailabilityCriteria) AsBasicMetricAlertCriteria() (BasicMetricAlertCriteria, bool) { + return &wlac, true +} + +// UnmarshalJSON is the custom unmarshaler for WebtestLocationAvailabilityCriteria struct. +func (wlac *WebtestLocationAvailabilityCriteria) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "webTestId": + if v != nil { + var webTestID string + err = json.Unmarshal(*v, &webTestID) + if err != nil { + return err + } + wlac.WebTestID = &webTestID + } + case "componentId": + if v != nil { + var componentID string + err = json.Unmarshal(*v, &componentID) + if err != nil { + return err + } + wlac.ComponentID = &componentID + } + case "failedLocationCount": + if v != nil { + var failedLocationCount float64 + err = json.Unmarshal(*v, &failedLocationCount) + if err != nil { + return err + } + wlac.FailedLocationCount = &failedLocationCount + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if wlac.AdditionalProperties == nil { + wlac.AdditionalProperties = make(map[string]interface{}) + } + wlac.AdditionalProperties[k] = additionalProperties + } + case "odata.type": + if v != nil { + var odataType OdataTypeBasicMetricAlertCriteria + err = json.Unmarshal(*v, &odataType) + if err != nil { + return err + } + wlac.OdataType = odataType + } + } + } + + return nil +} + +// WindowsEventLogDataSource definition of which Windows Event Log events will be collected and how they +// will be collected. +// Only collected from Windows machines. +type WindowsEventLogDataSource struct { + // Streams - List of streams that this data source will be sent to. + // A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will be sent to. + Streams *[]KnownWindowsEventLogDataSourceStreams `json:"streams,omitempty"` + // XPathQueries - A list of Windows Event Log queries in XPATH format. + XPathQueries *[]string `json:"xPathQueries,omitempty"` + // Name - A friendly name for the data source. + // This name should be unique across all data sources (regardless of type) within the data collection rule. + Name *string `json:"name,omitempty"` +} + +// WorkspaceInfo information about a Log Analytics Workspace. +type WorkspaceInfo struct { + // ID - Azure Resource Manager identifier of the Log Analytics Workspace. + ID *string `json:"id,omitempty"` + // Location - Location of the Log Analytics workspace. + Location *string `json:"location,omitempty"` + // WorkspaceInfoProperties - Resource properties. + *WorkspaceInfoProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceInfo. +func (wi WorkspaceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wi.ID != nil { + objectMap["id"] = wi.ID + } + if wi.Location != nil { + objectMap["location"] = wi.Location + } + if wi.WorkspaceInfoProperties != nil { + objectMap["properties"] = wi.WorkspaceInfoProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WorkspaceInfo struct. +func (wi *WorkspaceInfo) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wi.ID = &ID + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wi.Location = &location + } + case "properties": + if v != nil { + var workspaceInfoProperties WorkspaceInfoProperties + err = json.Unmarshal(*v, &workspaceInfoProperties) + if err != nil { + return err + } + wi.WorkspaceInfoProperties = &workspaceInfoProperties + } + } + } + + return nil +} + +// WorkspaceInfoProperties resource properties. +type WorkspaceInfoProperties struct { + // CustomerID - Log Analytics workspace identifier. + CustomerID *string `json:"customerId,omitempty"` +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/operations.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/operations.go new file mode 100644 index 000000000000..afb74dc9248f --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/operations.go @@ -0,0 +1,98 @@ +package insights + +// 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 monitor Management Client +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 lists all of the available operations from Microsoft.Insights provider. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Insights/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/privateendpointconnections.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privateendpointconnections.go new file mode 100644 index 000000000000..c8bc7078ed76 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privateendpointconnections.go @@ -0,0 +1,435 @@ +package insights + +// 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" +) + +// PrivateEndpointConnectionsClient is the monitor Management Client +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate approve or reject a private endpoint connection with a given name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Status", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState.Description", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a private endpoint connection with a given name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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("insights.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a private endpoint connection. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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("insights.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") + defer func() { + sc := -1 + if result.peclr.Response.Response != nil { + sc = result.peclr.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("insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", err.Error()) + } + + result.fn = client.listByPrivateLinkScopeNextResults + req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListByPrivateLinkScopeSender(req) + if err != nil { + result.peclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure sending request") + return + } + + result.peclr, err = client.ListByPrivateLinkScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "ListByPrivateLinkScope", resp, "Failure responding to request") + return + } + if result.peclr.hasNextLink() && result.peclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. +func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionsClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { + req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByPrivateLinkScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByPrivateLinkScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateEndpointConnectionsClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateEndpointConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByPrivateLinkScope") + 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkresources.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkresources.go new file mode 100644 index 000000000000..02157f85d6c4 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkresources.go @@ -0,0 +1,247 @@ +package insights + +// 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" +) + +// PrivateLinkResourcesClient is the monitor Management Client +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// groupName - the name of the private link resource. +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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("insights.PrivateLinkResourcesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, groupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByPrivateLinkScope gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +func (client PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") + defer func() { + sc := -1 + if result.plrlr.Response.Response != nil { + sc = result.plrlr.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("insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", err.Error()) + } + + result.fn = client.listByPrivateLinkScopeNextResults + req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListByPrivateLinkScopeSender(req) + if err != nil { + result.plrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") + return + } + + result.plrlr, err = client.ListByPrivateLinkScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") + return + } + if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. +func (client PrivateLinkResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. +func (client PrivateLinkResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { + req, err := lastResults.privateLinkResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByPrivateLinkScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByPrivateLinkScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByPrivateLinkScope") + 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopedresources.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopedresources.go new file mode 100644 index 000000000000..87ad66e22a67 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopedresources.go @@ -0,0 +1,428 @@ +package insights + +// 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" +) + +// PrivateLinkScopedResourcesClient is the monitor Management Client +type PrivateLinkScopedResourcesClient struct { + BaseClient +} + +// NewPrivateLinkScopedResourcesClient creates an instance of the PrivateLinkScopedResourcesClient client. +func NewPrivateLinkScopedResourcesClient(subscriptionID string) PrivateLinkScopedResourcesClient { + return NewPrivateLinkScopedResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkScopedResourcesClientWithBaseURI creates an instance of the PrivateLinkScopedResourcesClient 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 NewPrivateLinkScopedResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopedResourcesClient { + return PrivateLinkScopedResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate approve or reject a private endpoint connection with a given name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// name - the name of the scoped resource object. +func (client PrivateLinkScopedResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (result PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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("insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateLinkScopedResourcesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkScopedResourcesClient) CreateOrUpdateSender(req *http.Request) (future PrivateLinkScopedResourcesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateLinkScopedResourcesClient) CreateOrUpdateResponder(resp *http.Response) (result ScopedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a private endpoint connection with a given name. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// name - the name of the scoped resource object. +func (client PrivateLinkScopedResourcesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string, name string) (result PrivateLinkScopedResourcesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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("insights.PrivateLinkScopedResourcesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateLinkScopedResourcesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}", 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 PrivateLinkScopedResourcesClient) DeleteSender(req *http.Request) (future PrivateLinkScopedResourcesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateLinkScopedResourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a scoped resource in a private link scope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// name - the name of the scoped resource object. +func (client PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string) (result ScopedResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.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("insights.PrivateLinkScopedResourcesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, scopeName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkScopedResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}", 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 PrivateLinkScopedResourcesClient) 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 PrivateLinkScopedResourcesClient) GetResponder(resp *http.Response) (result ScopedResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByPrivateLinkScope gets all private endpoint connections on a private link scope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") + defer func() { + sc := -1 + if result.srlr.Response.Response != nil { + sc = result.srlr.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("insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", err.Error()) + } + + result.fn = client.listByPrivateLinkScopeNextResults + req, err := client.ListByPrivateLinkScopePreparer(ctx, resourceGroupName, scopeName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListByPrivateLinkScopeSender(req) + if err != nil { + result.srlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure sending request") + return + } + + result.srlr, err = client.ListByPrivateLinkScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "ListByPrivateLinkScope", resp, "Failure responding to request") + return + } + if result.srlr.hasNextLink() && result.srlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByPrivateLinkScopePreparer prepares the ListByPrivateLinkScope request. +func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByPrivateLinkScopeSender sends the ListByPrivateLinkScope request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByPrivateLinkScopeResponder handles the response to the ListByPrivateLinkScope request. The method always +// closes the http.Response Body. +func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeResponder(resp *http.Response) (result ScopedResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByPrivateLinkScopeNextResults retrieves the next set of results, if any. +func (client PrivateLinkScopedResourcesClient) listByPrivateLinkScopeNextResults(ctx context.Context, lastResults ScopedResourceListResult) (result ScopedResourceListResult, err error) { + req, err := lastResults.scopedResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByPrivateLinkScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByPrivateLinkScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopedResourcesClient", "listByPrivateLinkScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByPrivateLinkScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkScopedResourcesClient) ListByPrivateLinkScopeComplete(ctx context.Context, resourceGroupName string, scopeName string) (result ScopedResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopedResourcesClient.ListByPrivateLinkScope") + 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.ListByPrivateLinkScope(ctx, resourceGroupName, scopeName) + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopeoperationstatus.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopeoperationstatus.go new file mode 100644 index 000000000000..a29fa9edf886 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopeoperationstatus.go @@ -0,0 +1,118 @@ +package insights + +// 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" +) + +// PrivateLinkScopeOperationStatusClient is the monitor Management Client +type PrivateLinkScopeOperationStatusClient struct { + BaseClient +} + +// NewPrivateLinkScopeOperationStatusClient creates an instance of the PrivateLinkScopeOperationStatusClient client. +func NewPrivateLinkScopeOperationStatusClient(subscriptionID string) PrivateLinkScopeOperationStatusClient { + return NewPrivateLinkScopeOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkScopeOperationStatusClientWithBaseURI creates an instance of the PrivateLinkScopeOperationStatusClient +// 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 NewPrivateLinkScopeOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopeOperationStatusClient { + return PrivateLinkScopeOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the status of an azure asynchronous operation associated with a private link scope operation. +// Parameters: +// asyncOperationID - the operation Id. +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string) (result OperationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopeOperationStatusClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.PrivateLinkScopeOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, asyncOperationID, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopeOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkScopeOperationStatusClient) GetPreparer(ctx context.Context, asyncOperationID string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "asyncOperationId": autorest.Encode("path", asyncOperationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}", 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 PrivateLinkScopeOperationStatusClient) 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 PrivateLinkScopeOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopes.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopes.go new file mode 100644 index 000000000000..fc2796420366 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/privatelinkscopes.go @@ -0,0 +1,629 @@ +package insights + +// 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" +) + +// PrivateLinkScopesClient is the monitor Management Client +type PrivateLinkScopesClient struct { + BaseClient +} + +// NewPrivateLinkScopesClient creates an instance of the PrivateLinkScopesClient client. +func NewPrivateLinkScopesClient(subscriptionID string) PrivateLinkScopesClient { + return NewPrivateLinkScopesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkScopesClientWithBaseURI creates an instance of the PrivateLinkScopesClient 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 NewPrivateLinkScopesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkScopesClient { + return PrivateLinkScopesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for +// InstrumentationKey nor AppId in the Put operation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// azureMonitorPrivateLinkScopePayload - properties that need to be specified to create or update a Azure +// Monitor PrivateLinkScope. +func (client PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (result AzureMonitorPrivateLinkScope, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: azureMonitorPrivateLinkScopePayload, + Constraints: []validation.Constraint{{Target: "azureMonitorPrivateLinkScopePayload.AzureMonitorPrivateLinkScopeProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.PrivateLinkScopesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateLinkScopesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", pathParameters), + autorest.WithJSON(azureMonitorPrivateLinkScopePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkScopesClient) 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 PrivateLinkScopesClient) CreateOrUpdateResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Azure Monitor PrivateLinkScope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +func (client PrivateLinkScopesClient) Delete(ctx context.Context, resourceGroupName string, scopeName string) (result PrivateLinkScopesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.PrivateLinkScopesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, scopeName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateLinkScopesClient) DeletePreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) DeleteSender(req *http.Request) (future PrivateLinkScopesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateLinkScopesClient) 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 returns a Azure Monitor PrivateLinkScope. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +func (client PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string) (result AzureMonitorPrivateLinkScope, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.PrivateLinkScopesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, scopeName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkScopesClient) GetPreparer(ctx context.Context, resourceGroupName string, scopeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) GetResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of all Azure Monitor PrivateLinkScopes within a subscription. +func (client PrivateLinkScopesClient) List(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.List") + defer func() { + sc := -1 + if result.amplslr.Response.Response != nil { + sc = result.amplslr.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("insights.PrivateLinkScopesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.amplslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure sending request") + return + } + + result.amplslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "List", resp, "Failure responding to request") + return + } + if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkScopesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { + req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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, "insights.PrivateLinkScopesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkScopesClient) ListComplete(ctx context.Context) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 +} + +// ListByResourceGroup gets a list of Azure Monitor PrivateLinkScopes within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client PrivateLinkScopesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.amplslr.Response.Response != nil { + sc = result.amplslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.PrivateLinkScopesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.amplslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.amplslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.amplslr.hasNextLink() && result.amplslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PrivateLinkScopesClient) 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 = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes", 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 PrivateLinkScopesClient) 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 PrivateLinkScopesClient) ListByResourceGroupResponder(resp *http.Response) (result AzureMonitorPrivateLinkScopeListResult, 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 PrivateLinkScopesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AzureMonitorPrivateLinkScopeListResult) (result AzureMonitorPrivateLinkScopeListResult, err error) { + req, err := lastResults.azureMonitorPrivateLinkScopeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "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, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkScopesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AzureMonitorPrivateLinkScopeListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.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 +} + +// UpdateTags updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// scopeName - the name of the Azure Monitor PrivateLinkScope resource. +// privateLinkScopeTags - updated tag information to set into the PrivateLinkScope instance. +func (client PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (result AzureMonitorPrivateLinkScope, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkScopesClient.UpdateTags") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.PrivateLinkScopesClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, scopeName, privateLinkScopeTags) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.PrivateLinkScopesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client PrivateLinkScopesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeName": autorest.Encode("path", scopeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-10-17-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}", pathParameters), + autorest.WithJSON(privateLinkScopeTags), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkScopesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client PrivateLinkScopesClient) UpdateTagsResponder(resp *http.Response) (result AzureMonitorPrivateLinkScope, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/scheduledqueryrules.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/scheduledqueryrules.go new file mode 100644 index 000000000000..22b09a5f8997 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/scheduledqueryrules.go @@ -0,0 +1,558 @@ +package insights + +// 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" +) + +// ScheduledQueryRulesClient is the monitor Management Client +type ScheduledQueryRulesClient struct { + BaseClient +} + +// NewScheduledQueryRulesClient creates an instance of the ScheduledQueryRulesClient client. +func NewScheduledQueryRulesClient(subscriptionID string) ScheduledQueryRulesClient { + return NewScheduledQueryRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScheduledQueryRulesClientWithBaseURI creates an instance of the ScheduledQueryRulesClient 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 NewScheduledQueryRulesClientWithBaseURI(baseURI string, subscriptionID string) ScheduledQueryRulesClient { + return ScheduledQueryRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an log search rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// parameters - the parameters of the rule to create or update. +func (client ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (result LogSearchRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LogSearchRule", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Source.DataSourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.LogSearchRule.Schedule", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.LogSearchRule.Schedule.FrequencyInMinutes", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.LogSearchRule.Schedule.TimeWindowInMinutes", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ScheduledQueryRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) CreateOrUpdateResponder(resp *http.Response) (result LogSearchRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Log Search rule +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ScheduledQueryRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets an Log Search rule +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +func (client ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string) (result LogSearchRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ScheduledQueryRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) GetResponder(resp *http.Response) (result LogSearchRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list the Log Search rules within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// filter - the filter to apply on the operation. For more information please see +// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx +func (client ScheduledQueryRulesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result LogSearchRuleResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListByResourceGroup") + 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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListByResourceGroup", err.Error()) + } + + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ScheduledQueryRulesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListByResourceGroupResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription list the Log Search rules within a subscription group. +// Parameters: +// filter - the filter to apply on the operation. For more information please see +// https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx +func (client ScheduledQueryRulesClient) ListBySubscription(ctx context.Context, filter string) (result LogSearchRuleResourceCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.ListBySubscription") + 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}}}}); err != nil { + return result, validation.NewError("insights.ScheduledQueryRulesClient", "ListBySubscription", err.Error()) + } + + req, err := client.ListBySubscriptionPreparer(ctx, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ScheduledQueryRulesClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-16" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules", 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 ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) ListBySubscriptionResponder(resp *http.Response) (result LogSearchRuleResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update log search Rule. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// ruleName - the name of the rule. +// parameters - the parameters of the rule to update. +func (client ScheduledQueryRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (result LogSearchRuleResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledQueryRulesClient.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("insights.ScheduledQueryRulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, ruleName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.ScheduledQueryRulesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ScheduledQueryRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, ruleName string, parameters LogSearchRuleResourcePatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-04-16" + 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.Insights/scheduledQueryRules/{ruleName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ScheduledQueryRulesClient) 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 ScheduledQueryRulesClient) UpdateResponder(resp *http.Response) (result LogSearchRuleResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/tenantactivitylogs.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/tenantactivitylogs.go new file mode 100644 index 000000000000..7c6ee7981381 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/tenantactivitylogs.go @@ -0,0 +1,168 @@ +package insights + +// 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" +) + +// TenantActivityLogsClient is the monitor Management Client +type TenantActivityLogsClient struct { + BaseClient +} + +// NewTenantActivityLogsClient creates an instance of the TenantActivityLogsClient client. +func NewTenantActivityLogsClient(subscriptionID string) TenantActivityLogsClient { + return NewTenantActivityLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTenantActivityLogsClientWithBaseURI creates an instance of the TenantActivityLogsClient 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 NewTenantActivityLogsClientWithBaseURI(baseURI string, subscriptionID string) TenantActivityLogsClient { + return TenantActivityLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets the Activity Logs for the Tenant.
Everything that is applicable to the API to get the Activity Logs for +// the subscription is applicable to this API (the parameters, $filter, etc.).
One thing to point out here is that +// this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that +// were generated at the tenant level. +// Parameters: +// filter - reduces the set of data collected.
The **$filter** is very restricted and allows only the +// following patterns.
- List events for a resource group: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceGroupName eq +// ''.
- List events for resource: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation' and resourceUri eq +// ''.
- List events for a subscription: $filter=eventTimestamp ge '' and +// eventTimestamp le '' and eventChannels eq 'Admin, Operation'.
- List events for a resource +// provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq +// 'Admin, Operation' and resourceProvider eq ''.
- List events for a correlation Id: +// api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le +// '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq +// ''.
**NOTE**: No other syntax is allowed. +// selectParameter - used to fetch events with only the given properties.
The **$select** argument is a +// comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, +// *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, +// *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, +// *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* +func (client TenantActivityLogsClient) List(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.List") + defer func() { + sc := -1 + if result.edc.Response.Response != nil { + sc = result.edc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.edc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure sending request") + return + } + + result.edc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "List", resp, "Failure responding to request") + return + } + if result.edc.hasNextLink() && result.edc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TenantActivityLogsClient) ListPreparer(ctx context.Context, filter string, selectParameter string) (*http.Request, error) { + const APIVersion = "2015-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Insights/eventtypes/management/values"), + 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 TenantActivityLogsClient) 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 TenantActivityLogsClient) ListResponder(resp *http.Response) (result EventDataCollection, 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 TenantActivityLogsClient) listNextResults(ctx context.Context, lastResults EventDataCollection) (result EventDataCollection, err error) { + req, err := lastResults.eventDataCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "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, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.TenantActivityLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TenantActivityLogsClient) ListComplete(ctx context.Context, filter string, selectParameter string) (result EventDataCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TenantActivityLogsClient.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, filter, selectParameter) + return +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/version.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/version.go new file mode 100644 index 000000000000..c7a848b05901 --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/version.go @@ -0,0 +1,19 @@ +package insights + +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() + " insights/2021-09-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/monitor/mgmt/2021-09-01-preview/insights/vminsights.go b/services/preview/monitor/mgmt/2021-09-01-preview/insights/vminsights.go new file mode 100644 index 000000000000..3787cb6fc53e --- /dev/null +++ b/services/preview/monitor/mgmt/2021-09-01-preview/insights/vminsights.go @@ -0,0 +1,105 @@ +package insights + +// 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" +) + +// VMInsightsClient is the monitor Management Client +type VMInsightsClient struct { + BaseClient +} + +// NewVMInsightsClient creates an instance of the VMInsightsClient client. +func NewVMInsightsClient(subscriptionID string) VMInsightsClient { + return NewVMInsightsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVMInsightsClientWithBaseURI creates an instance of the VMInsightsClient 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 NewVMInsightsClientWithBaseURI(baseURI string, subscriptionID string) VMInsightsClient { + return VMInsightsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetOnboardingStatus retrieves the VM Insights onboarding status for the specified resource or resource scope. +// Parameters: +// resourceURI - the fully qualified Azure Resource manager identifier of the resource, or scope, whose status +// to retrieve. +func (client VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string) (result VMInsightsOnboardingStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMInsightsClient.GetOnboardingStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetOnboardingStatusPreparer(ctx, resourceURI) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetOnboardingStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure sending request") + return + } + + result, err = client.GetOnboardingStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.VMInsightsClient", "GetOnboardingStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetOnboardingStatusPreparer prepares the GetOnboardingStatus request. +func (client VMInsightsClient) GetOnboardingStatusPreparer(ctx context.Context, resourceURI string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceUri": resourceURI, + } + + const APIVersion = "2018-11-27-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOnboardingStatusSender sends the GetOnboardingStatus request. The method will close the +// http.Response Body if it receives an error. +func (client VMInsightsClient) GetOnboardingStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetOnboardingStatusResponder handles the response to the GetOnboardingStatus request. The method always +// closes the http.Response Body. +func (client VMInsightsClient) GetOnboardingStatusResponder(resp *http.Response) (result VMInsightsOnboardingStatus, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json new file mode 100644 index 000000000000..af90b2cc0c51 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "81ab10cd9d46a85258b710c6150ec48021c6d202", + "readme": "/_/azure-rest-api-specs/specification/streamanalytics/resource-manager/readme.md", + "tag": "package-pure-2020-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-pure-2020-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/streamanalytics/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/client.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/client.go new file mode 100644 index 000000000000..c7d923921899 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/client.go @@ -0,0 +1,41 @@ +// Package streamanalytics implements the Azure ARM Streamanalytics service API version 2020-03-01. +// +// Stream Analytics Client +package streamanalytics + +// 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 Streamanalytics + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Streamanalytics. +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/streamanalytics/mgmt/2020-03-01/streamanalytics/clusters.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/clusters.go new file mode 100644 index 000000000000..65f6b03ff92a --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/clusters.go @@ -0,0 +1,793 @@ +package streamanalytics + +// 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" +) + +// ClustersClient is the stream Analytics Client +type ClustersClient struct { + BaseClient +} + +// NewClustersClient creates an instance of the ClustersClient client. +func NewClustersClient(subscriptionID string) ClustersClient { + return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClustersClientWithBaseURI creates an instance of the ClustersClient 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 NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a Stream Analytics Cluster or replaces an already existing cluster. +// Parameters: +// cluster - the definition of the cluster that will be used to create a new cluster or replace the existing +// one. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// ifMatch - the ETag of the resource. Omit this value to always overwrite the current record set. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new resource to be created, but to prevent updating an existing record +// set. Other values will result in a 412 Pre-condition Failed response. +func (client ClustersClient) CreateOrUpdate(ctx context.Context, cluster Cluster, resourceGroupName string, clusterName string, ifMatch string, ifNoneMatch string) (result ClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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: cluster, + Constraints: []validation.Constraint{{Target: "cluster.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cluster.Sku.Capacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "cluster.Sku.Capacity", Name: validation.InclusiveMaximum, Rule: int64(216), Chain: nil}, + {Target: "cluster.Sku.Capacity", Name: validation.InclusiveMinimum, Rule: int64(36), Chain: nil}, + }}, + }}}}, + {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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.ClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, cluster, resourceGroupName, clusterName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, cluster Cluster, resourceGroupName string, clusterName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + cluster.Etag = 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.StreamAnalytics/clusters/{clusterName}", pathParameters), + autorest.WithJSON(cluster), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + 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 ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.ClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/clusters/{clusterName}", 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 ClustersClient) DeleteSender(req *http.Request) (future ClustersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.ClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/clusters/{clusterName}", 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 ClustersClient) 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 ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists all of the clusters in the given resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.ClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.clr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) 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-03-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.StreamAnalytics/clusters", 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 ClustersClient) 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 ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, 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 ClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "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, "streamanalytics.ClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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 lists all of the clusters in the given subscription. +func (client ClustersClient) ListBySubscription(ctx context.Context) (result ClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListBySubscription") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.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("streamanalytics.ClustersClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.clr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ClustersClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters", 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 ClustersClient) 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 ClustersClient) ListBySubscriptionResponder(resp *http.Response) (result ClusterListResult, 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 ClustersClient) listBySubscriptionNextResults(ctx context.Context, lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "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, "streamanalytics.ClustersClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListBySubscriptionComplete(ctx context.Context) (result ClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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 +} + +// ListStreamingJobs lists all of the streaming jobs in the given cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client ClustersClient) ListStreamingJobs(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterJobListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListStreamingJobs") + defer func() { + sc := -1 + if result.cjlr.Response.Response != nil { + sc = result.cjlr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.ClustersClient", "ListStreamingJobs", err.Error()) + } + + result.fn = client.listStreamingJobsNextResults + req, err := client.ListStreamingJobsPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListStreamingJobs", nil, "Failure preparing request") + return + } + + resp, err := client.ListStreamingJobsSender(req) + if err != nil { + result.cjlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListStreamingJobs", resp, "Failure sending request") + return + } + + result.cjlr, err = client.ListStreamingJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "ListStreamingJobs", resp, "Failure responding to request") + return + } + if result.cjlr.hasNextLink() && result.cjlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListStreamingJobsPreparer prepares the ListStreamingJobs request. +func (client ClustersClient) ListStreamingJobsPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/clusters/{clusterName}/listStreamingJobs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListStreamingJobsSender sends the ListStreamingJobs request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListStreamingJobsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListStreamingJobsResponder handles the response to the ListStreamingJobs request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListStreamingJobsResponder(resp *http.Response) (result ClusterJobListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listStreamingJobsNextResults retrieves the next set of results, if any. +func (client ClustersClient) listStreamingJobsNextResults(ctx context.Context, lastResults ClusterJobListResult) (result ClusterJobListResult, err error) { + req, err := lastResults.clusterJobListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "listStreamingJobsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListStreamingJobsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "listStreamingJobsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListStreamingJobsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "listStreamingJobsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListStreamingJobsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListStreamingJobsComplete(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterJobListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListStreamingJobs") + 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.ListStreamingJobs(ctx, resourceGroupName, clusterName) + return +} + +// Update updates an existing cluster. This can be used to partially update (ie. update one or two properties) a +// cluster without affecting the rest of the cluster definition. +// Parameters: +// cluster - the properties specified here will overwrite the corresponding properties in the existing cluster +// (ie. Those properties will be updated). +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// ifMatch - the ETag of the resource. Omit this value to always overwrite the current record set. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client ClustersClient) Update(ctx context.Context, cluster Cluster, resourceGroupName string, clusterName string, ifMatch string) (result ClustersUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.ClustersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, cluster, resourceGroupName, clusterName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(ctx context.Context, cluster Cluster, resourceGroupName string, clusterName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + cluster.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}", pathParameters), + autorest.WithJSON(cluster), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 ClustersClient) UpdateSender(req *http.Request) (future ClustersUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go new file mode 100644 index 000000000000..ed5cd317d0de --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/enums.go @@ -0,0 +1,446 @@ +package streamanalytics + +// 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. + +// AuthenticationMode enumerates the values for authentication mode. +type AuthenticationMode string + +const ( + // AuthenticationModeConnectionString ... + AuthenticationModeConnectionString AuthenticationMode = "ConnectionString" + // AuthenticationModeMsi ... + AuthenticationModeMsi AuthenticationMode = "Msi" + // AuthenticationModeUserToken ... + AuthenticationModeUserToken AuthenticationMode = "UserToken" +) + +// PossibleAuthenticationModeValues returns an array of possible values for the AuthenticationMode const type. +func PossibleAuthenticationModeValues() []AuthenticationMode { + return []AuthenticationMode{AuthenticationModeConnectionString, AuthenticationModeMsi, AuthenticationModeUserToken} +} + +// BindingType enumerates the values for binding type. +type BindingType string + +const ( + // BindingTypeFunctionRetrieveDefaultDefinitionParameters ... + BindingTypeFunctionRetrieveDefaultDefinitionParameters BindingType = "FunctionRetrieveDefaultDefinitionParameters" + // BindingTypeMicrosoftMachineLearningWebService ... + BindingTypeMicrosoftMachineLearningWebService BindingType = "Microsoft.MachineLearning/WebService" + // BindingTypeMicrosoftStreamAnalyticsJavascriptUdf ... + BindingTypeMicrosoftStreamAnalyticsJavascriptUdf BindingType = "Microsoft.StreamAnalytics/JavascriptUdf" +) + +// PossibleBindingTypeValues returns an array of possible values for the BindingType const type. +func PossibleBindingTypeValues() []BindingType { + return []BindingType{BindingTypeFunctionRetrieveDefaultDefinitionParameters, BindingTypeMicrosoftMachineLearningWebService, BindingTypeMicrosoftStreamAnalyticsJavascriptUdf} +} + +// ClusterProvisioningState enumerates the values for cluster provisioning state. +type ClusterProvisioningState string + +const ( + // ClusterProvisioningStateCanceled The cluster provisioning was canceled. + ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled" + // ClusterProvisioningStateFailed The cluster provisioning failed. + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + // ClusterProvisioningStateInProgress The cluster provisioning was inprogress. + ClusterProvisioningStateInProgress ClusterProvisioningState = "InProgress" + // ClusterProvisioningStateSucceeded The cluster provisioning succeeded. + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" +) + +// PossibleClusterProvisioningStateValues returns an array of possible values for the ClusterProvisioningState const type. +func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { + return []ClusterProvisioningState{ClusterProvisioningStateCanceled, ClusterProvisioningStateFailed, ClusterProvisioningStateInProgress, ClusterProvisioningStateSucceeded} +} + +// ClusterSkuName enumerates the values for cluster sku name. +type ClusterSkuName string + +const ( + // ClusterSkuNameDefault The default SKU. + ClusterSkuNameDefault ClusterSkuName = "Default" +) + +// PossibleClusterSkuNameValues returns an array of possible values for the ClusterSkuName const type. +func PossibleClusterSkuNameValues() []ClusterSkuName { + return []ClusterSkuName{ClusterSkuNameDefault} +} + +// CompatibilityLevel enumerates the values for compatibility level. +type CompatibilityLevel string + +const ( + // CompatibilityLevelOneFullStopTwo ... + CompatibilityLevelOneFullStopTwo CompatibilityLevel = "1.2" + // CompatibilityLevelOneFullStopZero ... + CompatibilityLevelOneFullStopZero CompatibilityLevel = "1.0" +) + +// PossibleCompatibilityLevelValues returns an array of possible values for the CompatibilityLevel const type. +func PossibleCompatibilityLevelValues() []CompatibilityLevel { + return []CompatibilityLevel{CompatibilityLevelOneFullStopTwo, CompatibilityLevelOneFullStopZero} +} + +// CompressionType enumerates the values for compression type. +type CompressionType string + +const ( + // CompressionTypeDeflate ... + CompressionTypeDeflate CompressionType = "Deflate" + // CompressionTypeGZip ... + CompressionTypeGZip CompressionType = "GZip" + // CompressionTypeNone ... + CompressionTypeNone CompressionType = "None" +) + +// PossibleCompressionTypeValues returns an array of possible values for the CompressionType const type. +func PossibleCompressionTypeValues() []CompressionType { + return []CompressionType{CompressionTypeDeflate, CompressionTypeGZip, CompressionTypeNone} +} + +// ContentStoragePolicy enumerates the values for content storage policy. +type ContentStoragePolicy string + +const ( + // ContentStoragePolicyJobStorageAccount ... + ContentStoragePolicyJobStorageAccount ContentStoragePolicy = "JobStorageAccount" + // ContentStoragePolicySystemAccount ... + ContentStoragePolicySystemAccount ContentStoragePolicy = "SystemAccount" +) + +// PossibleContentStoragePolicyValues returns an array of possible values for the ContentStoragePolicy const type. +func PossibleContentStoragePolicyValues() []ContentStoragePolicy { + return []ContentStoragePolicy{ContentStoragePolicyJobStorageAccount, ContentStoragePolicySystemAccount} +} + +// Encoding enumerates the values for encoding. +type Encoding string + +const ( + // EncodingUTF8 ... + EncodingUTF8 Encoding = "UTF8" +) + +// PossibleEncodingValues returns an array of possible values for the Encoding const type. +func PossibleEncodingValues() []Encoding { + return []Encoding{EncodingUTF8} +} + +// EventSerializationType enumerates the values for event serialization type. +type EventSerializationType string + +const ( + // EventSerializationTypeAvro ... + EventSerializationTypeAvro EventSerializationType = "Avro" + // EventSerializationTypeCsv ... + EventSerializationTypeCsv EventSerializationType = "Csv" + // EventSerializationTypeJSON ... + EventSerializationTypeJSON EventSerializationType = "Json" + // EventSerializationTypeParquet ... + EventSerializationTypeParquet EventSerializationType = "Parquet" +) + +// PossibleEventSerializationTypeValues returns an array of possible values for the EventSerializationType const type. +func PossibleEventSerializationTypeValues() []EventSerializationType { + return []EventSerializationType{EventSerializationTypeAvro, EventSerializationTypeCsv, EventSerializationTypeJSON, EventSerializationTypeParquet} +} + +// EventsOutOfOrderPolicy enumerates the values for events out of order policy. +type EventsOutOfOrderPolicy string + +const ( + // EventsOutOfOrderPolicyAdjust ... + EventsOutOfOrderPolicyAdjust EventsOutOfOrderPolicy = "Adjust" + // EventsOutOfOrderPolicyDrop ... + EventsOutOfOrderPolicyDrop EventsOutOfOrderPolicy = "Drop" +) + +// PossibleEventsOutOfOrderPolicyValues returns an array of possible values for the EventsOutOfOrderPolicy const type. +func PossibleEventsOutOfOrderPolicyValues() []EventsOutOfOrderPolicy { + return []EventsOutOfOrderPolicy{EventsOutOfOrderPolicyAdjust, EventsOutOfOrderPolicyDrop} +} + +// JobState enumerates the values for job state. +type JobState string + +const ( + // JobStateCreated The job is currently in the Created state. + JobStateCreated JobState = "Created" + // JobStateDegraded The job is currently in the Degraded state. + JobStateDegraded JobState = "Degraded" + // JobStateDeleting The job is currently in the Deleting state. + JobStateDeleting JobState = "Deleting" + // JobStateFailed The job is currently in the Failed state. + JobStateFailed JobState = "Failed" + // JobStateRestarting The job is currently in the Restarting state. + JobStateRestarting JobState = "Restarting" + // JobStateRunning The job is currently in the Running state. + JobStateRunning JobState = "Running" + // JobStateScaling The job is currently in the Scaling state. + JobStateScaling JobState = "Scaling" + // JobStateStarting The job is currently in the Starting state. + JobStateStarting JobState = "Starting" + // JobStateStopped The job is currently in the Stopped state. + JobStateStopped JobState = "Stopped" + // JobStateStopping The job is currently in the Stopping state. + JobStateStopping JobState = "Stopping" +) + +// PossibleJobStateValues returns an array of possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{JobStateCreated, JobStateDegraded, JobStateDeleting, JobStateFailed, JobStateRestarting, JobStateRunning, JobStateScaling, JobStateStarting, JobStateStopped, JobStateStopping} +} + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeCloud ... + JobTypeCloud JobType = "Cloud" + // JobTypeEdge ... + JobTypeEdge JobType = "Edge" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{JobTypeCloud, JobTypeEdge} +} + +// JSONOutputSerializationFormat enumerates the values for json output serialization format. +type JSONOutputSerializationFormat string + +const ( + // JSONOutputSerializationFormatArray ... + JSONOutputSerializationFormatArray JSONOutputSerializationFormat = "Array" + // JSONOutputSerializationFormatLineSeparated ... + JSONOutputSerializationFormatLineSeparated JSONOutputSerializationFormat = "LineSeparated" +) + +// PossibleJSONOutputSerializationFormatValues returns an array of possible values for the JSONOutputSerializationFormat const type. +func PossibleJSONOutputSerializationFormatValues() []JSONOutputSerializationFormat { + return []JSONOutputSerializationFormat{JSONOutputSerializationFormatArray, JSONOutputSerializationFormatLineSeparated} +} + +// OutputErrorPolicy enumerates the values for output error policy. +type OutputErrorPolicy string + +const ( + // OutputErrorPolicyDrop ... + OutputErrorPolicyDrop OutputErrorPolicy = "Drop" + // OutputErrorPolicyStop ... + OutputErrorPolicyStop OutputErrorPolicy = "Stop" +) + +// PossibleOutputErrorPolicyValues returns an array of possible values for the OutputErrorPolicy const type. +func PossibleOutputErrorPolicyValues() []OutputErrorPolicy { + return []OutputErrorPolicy{OutputErrorPolicyDrop, OutputErrorPolicyStop} +} + +// OutputStartMode enumerates the values for output start mode. +type OutputStartMode string + +const ( + // OutputStartModeCustomTime ... + OutputStartModeCustomTime OutputStartMode = "CustomTime" + // OutputStartModeJobStartTime ... + OutputStartModeJobStartTime OutputStartMode = "JobStartTime" + // OutputStartModeLastOutputEventTime ... + OutputStartModeLastOutputEventTime OutputStartMode = "LastOutputEventTime" +) + +// PossibleOutputStartModeValues returns an array of possible values for the OutputStartMode const type. +func PossibleOutputStartModeValues() []OutputStartMode { + return []OutputStartMode{OutputStartModeCustomTime, OutputStartModeJobStartTime, OutputStartModeLastOutputEventTime} +} + +// RefreshType enumerates the values for refresh type. +type RefreshType string + +const ( + // RefreshTypeRefreshPeriodicallyWithDelta ... + RefreshTypeRefreshPeriodicallyWithDelta RefreshType = "RefreshPeriodicallyWithDelta" + // RefreshTypeRefreshPeriodicallyWithFull ... + RefreshTypeRefreshPeriodicallyWithFull RefreshType = "RefreshPeriodicallyWithFull" + // RefreshTypeStatic ... + RefreshTypeStatic RefreshType = "Static" +) + +// PossibleRefreshTypeValues returns an array of possible values for the RefreshType const type. +func PossibleRefreshTypeValues() []RefreshType { + return []RefreshType{RefreshTypeRefreshPeriodicallyWithDelta, RefreshTypeRefreshPeriodicallyWithFull, RefreshTypeStatic} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameStandard ... + SkuNameStandard SkuName = "Standard" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameStandard} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeAvro ... + TypeAvro Type = "Avro" + // TypeCsv ... + TypeCsv Type = "Csv" + // TypeJSON ... + TypeJSON Type = "Json" + // TypeParquet ... + TypeParquet Type = "Parquet" + // TypeSerialization ... + TypeSerialization Type = "Serialization" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeAvro, TypeCsv, TypeJSON, TypeParquet, TypeSerialization} +} + +// TypeBasicFunctionBinding enumerates the values for type basic function binding. +type TypeBasicFunctionBinding string + +const ( + // TypeBasicFunctionBindingTypeFunctionBinding ... + TypeBasicFunctionBindingTypeFunctionBinding TypeBasicFunctionBinding = "FunctionBinding" + // TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService ... + TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService TypeBasicFunctionBinding = "Microsoft.MachineLearning/WebService" + // TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf ... + TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf TypeBasicFunctionBinding = "Microsoft.StreamAnalytics/JavascriptUdf" +) + +// PossibleTypeBasicFunctionBindingValues returns an array of possible values for the TypeBasicFunctionBinding const type. +func PossibleTypeBasicFunctionBindingValues() []TypeBasicFunctionBinding { + return []TypeBasicFunctionBinding{TypeBasicFunctionBindingTypeFunctionBinding, TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService, TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf} +} + +// TypeBasicFunctionProperties enumerates the values for type basic function properties. +type TypeBasicFunctionProperties string + +const ( + // TypeBasicFunctionPropertiesTypeFunctionProperties ... + TypeBasicFunctionPropertiesTypeFunctionProperties TypeBasicFunctionProperties = "FunctionProperties" + // TypeBasicFunctionPropertiesTypeScalar ... + TypeBasicFunctionPropertiesTypeScalar TypeBasicFunctionProperties = "Scalar" +) + +// PossibleTypeBasicFunctionPropertiesValues returns an array of possible values for the TypeBasicFunctionProperties const type. +func PossibleTypeBasicFunctionPropertiesValues() []TypeBasicFunctionProperties { + return []TypeBasicFunctionProperties{TypeBasicFunctionPropertiesTypeFunctionProperties, TypeBasicFunctionPropertiesTypeScalar} +} + +// TypeBasicInputProperties enumerates the values for type basic input properties. +type TypeBasicInputProperties string + +const ( + // TypeBasicInputPropertiesTypeInputProperties ... + TypeBasicInputPropertiesTypeInputProperties TypeBasicInputProperties = "InputProperties" + // TypeBasicInputPropertiesTypeReference ... + TypeBasicInputPropertiesTypeReference TypeBasicInputProperties = "Reference" + // TypeBasicInputPropertiesTypeStream ... + TypeBasicInputPropertiesTypeStream TypeBasicInputProperties = "Stream" +) + +// PossibleTypeBasicInputPropertiesValues returns an array of possible values for the TypeBasicInputProperties const type. +func PossibleTypeBasicInputPropertiesValues() []TypeBasicInputProperties { + return []TypeBasicInputProperties{TypeBasicInputPropertiesTypeInputProperties, TypeBasicInputPropertiesTypeReference, TypeBasicInputPropertiesTypeStream} +} + +// TypeBasicOutputDataSource enumerates the values for type basic output data source. +type TypeBasicOutputDataSource string + +const ( + // TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts ... + TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts TypeBasicOutputDataSource = "Microsoft.DataLake/Accounts" + // TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub ... + TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub TypeBasicOutputDataSource = "Microsoft.EventHub/EventHub" + // TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub ... + TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicOutputDataSource = "Microsoft.ServiceBus/EventHub" + // TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue ... + TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue TypeBasicOutputDataSource = "Microsoft.ServiceBus/Queue" + // TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic ... + TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic TypeBasicOutputDataSource = "Microsoft.ServiceBus/Topic" + // TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase ... + TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase TypeBasicOutputDataSource = "Microsoft.Sql/Server/Database" + // TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse ... + TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse TypeBasicOutputDataSource = "Microsoft.Sql/Server/DataWarehouse" + // TypeBasicOutputDataSourceTypeMicrosoftStorageBlob ... + TypeBasicOutputDataSourceTypeMicrosoftStorageBlob TypeBasicOutputDataSource = "Microsoft.Storage/Blob" + // TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB ... + TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB TypeBasicOutputDataSource = "Microsoft.Storage/DocumentDB" + // TypeBasicOutputDataSourceTypeMicrosoftStorageTable ... + TypeBasicOutputDataSourceTypeMicrosoftStorageTable TypeBasicOutputDataSource = "Microsoft.Storage/Table" + // TypeBasicOutputDataSourceTypeOutputDataSource ... + TypeBasicOutputDataSourceTypeOutputDataSource TypeBasicOutputDataSource = "OutputDataSource" + // TypeBasicOutputDataSourceTypePowerBI ... + TypeBasicOutputDataSourceTypePowerBI TypeBasicOutputDataSource = "PowerBI" +) + +// PossibleTypeBasicOutputDataSourceValues returns an array of possible values for the TypeBasicOutputDataSource const type. +func PossibleTypeBasicOutputDataSourceValues() []TypeBasicOutputDataSource { + return []TypeBasicOutputDataSource{TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts, TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub, TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub, TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue, TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic, TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase, TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse, TypeBasicOutputDataSourceTypeMicrosoftStorageBlob, TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB, TypeBasicOutputDataSourceTypeMicrosoftStorageTable, TypeBasicOutputDataSourceTypeOutputDataSource, TypeBasicOutputDataSourceTypePowerBI} +} + +// TypeBasicReferenceInputDataSource enumerates the values for type basic reference input data source. +type TypeBasicReferenceInputDataSource string + +const ( + // TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase ... + TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase TypeBasicReferenceInputDataSource = "Microsoft.Sql/Server/Database" + // TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob ... + TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob TypeBasicReferenceInputDataSource = "Microsoft.Storage/Blob" + // TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource ... + TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource TypeBasicReferenceInputDataSource = "ReferenceInputDataSource" +) + +// PossibleTypeBasicReferenceInputDataSourceValues returns an array of possible values for the TypeBasicReferenceInputDataSource const type. +func PossibleTypeBasicReferenceInputDataSourceValues() []TypeBasicReferenceInputDataSource { + return []TypeBasicReferenceInputDataSource{TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase, TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob, TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource} +} + +// TypeBasicStreamInputDataSource enumerates the values for type basic stream input data source. +type TypeBasicStreamInputDataSource string + +const ( + // TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs ... + TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs TypeBasicStreamInputDataSource = "Microsoft.Devices/IotHubs" + // TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub ... + TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub TypeBasicStreamInputDataSource = "Microsoft.EventHub/EventHub" + // TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub ... + TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub TypeBasicStreamInputDataSource = "Microsoft.ServiceBus/EventHub" + // TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob ... + TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob TypeBasicStreamInputDataSource = "Microsoft.Storage/Blob" + // TypeBasicStreamInputDataSourceTypeStreamInputDataSource ... + TypeBasicStreamInputDataSourceTypeStreamInputDataSource TypeBasicStreamInputDataSource = "StreamInputDataSource" +) + +// PossibleTypeBasicStreamInputDataSourceValues returns an array of possible values for the TypeBasicStreamInputDataSource const type. +func PossibleTypeBasicStreamInputDataSourceValues() []TypeBasicStreamInputDataSource { + return []TypeBasicStreamInputDataSource{TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs, TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub, TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub, TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob, TypeBasicStreamInputDataSourceTypeStreamInputDataSource} +} + +// UdfType enumerates the values for udf type. +type UdfType string + +const ( + // UdfTypeScalar ... + UdfTypeScalar UdfType = "Scalar" +) + +// PossibleUdfTypeValues returns an array of possible values for the UdfType const type. +func PossibleUdfTypeValues() []UdfType { + return []UdfType{UdfTypeScalar} +} diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/functions.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/functions.go new file mode 100644 index 000000000000..4cc821335fed --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/functions.go @@ -0,0 +1,743 @@ +package streamanalytics + +// 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" +) + +// FunctionsClient is the stream Analytics Client +type FunctionsClient struct { + BaseClient +} + +// NewFunctionsClient creates an instance of the FunctionsClient client. +func NewFunctionsClient(subscriptionID string) FunctionsClient { + return NewFunctionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFunctionsClientWithBaseURI creates an instance of the FunctionsClient 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 NewFunctionsClientWithBaseURI(baseURI string, subscriptionID string) FunctionsClient { + return FunctionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates a function or replaces an already existing function under an existing streaming job. +// Parameters: +// function - the definition of the function that will be used to create a new function or replace the existing +// one under the streaming job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// functionName - the name of the function. +// ifMatch - the ETag of the function. Omit this value to always overwrite the current function. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new function to be created, but to prevent updating an existing +// function. Other values will result in a 412 Pre-condition Failed response. +func (client FunctionsClient) CreateOrReplace(ctx context.Context, function Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (result Function, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.CreateOrReplace") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "CreateOrReplace", err.Error()) + } + + req, err := client.CreateOrReplacePreparer(ctx, function, resourceGroupName, jobName, functionName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client FunctionsClient) CreateOrReplacePreparer(ctx context.Context, function Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters), + autorest.WithJSON(function), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client FunctionsClient) CreateOrReplaceResponder(resp *http.Response) (result Function, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a function from the streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// functionName - the name of the function. +func (client FunctionsClient) Delete(ctx context.Context, resourceGroupName string, jobName string, functionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, jobName, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FunctionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, jobName string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", 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 FunctionsClient) 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 FunctionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details about the specified function. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// functionName - the name of the function. +func (client FunctionsClient) Get(ctx context.Context, resourceGroupName string, jobName string, functionName string) (result Function, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, jobName, functionName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FunctionsClient) GetPreparer(ctx context.Context, resourceGroupName string, jobName string, functionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", 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 FunctionsClient) 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 FunctionsClient) GetResponder(resp *http.Response) (result Function, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJob lists all of the functions under the specified streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// selectParameter - the $select OData query parameter. This is a comma-separated list of structural properties +// to include in the response, or "*" to include all properties. By default, all properties are returned except +// diagnostics. Currently only accepts '*' as a valid value. +func (client FunctionsClient) ListByStreamingJob(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result FunctionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.ListByStreamingJob") + defer func() { + sc := -1 + if result.flr.Response.Response != nil { + sc = result.flr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "ListByStreamingJob", err.Error()) + } + + result.fn = client.listByStreamingJobNextResults + req, err := client.ListByStreamingJobPreparer(ctx, resourceGroupName, jobName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.flr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure sending request") + return + } + + result.flr, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure responding to request") + return + } + if result.flr.hasNextLink() && result.flr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByStreamingJobPreparer prepares the ListByStreamingJob request. +func (client FunctionsClient) ListByStreamingJobPreparer(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always +// closes the http.Response Body. +func (client FunctionsClient) ListByStreamingJobResponder(resp *http.Response) (result FunctionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByStreamingJobNextResults retrieves the next set of results, if any. +func (client FunctionsClient) listByStreamingJobNextResults(ctx context.Context, lastResults FunctionListResult) (result FunctionListResult, err error) { + req, err := lastResults.functionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "listByStreamingJobNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "listByStreamingJobNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "listByStreamingJobNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByStreamingJobComplete enumerates all values, automatically crossing page boundaries as required. +func (client FunctionsClient) ListByStreamingJobComplete(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result FunctionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.ListByStreamingJob") + 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.ListByStreamingJob(ctx, resourceGroupName, jobName, selectParameter) + return +} + +// RetrieveDefaultDefinition retrieves the default definition of a function based on the parameters specified. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// functionName - the name of the function. +// functionRetrieveDefaultDefinitionParameters - parameters used to specify the type of function to retrieve +// the default definition for. +func (client FunctionsClient) RetrieveDefaultDefinition(ctx context.Context, resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *BasicFunctionRetrieveDefaultDefinitionParameters) (result Function, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.RetrieveDefaultDefinition") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", err.Error()) + } + + req, err := client.RetrieveDefaultDefinitionPreparer(ctx, resourceGroupName, jobName, functionName, functionRetrieveDefaultDefinitionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", nil, "Failure preparing request") + return + } + + resp, err := client.RetrieveDefaultDefinitionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", resp, "Failure sending request") + return + } + + result, err = client.RetrieveDefaultDefinitionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", resp, "Failure responding to request") + return + } + + return +} + +// RetrieveDefaultDefinitionPreparer prepares the RetrieveDefaultDefinition request. +func (client FunctionsClient) RetrieveDefaultDefinitionPreparer(ctx context.Context, resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *BasicFunctionRetrieveDefaultDefinitionParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if functionRetrieveDefaultDefinitionParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(functionRetrieveDefaultDefinitionParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RetrieveDefaultDefinitionSender sends the RetrieveDefaultDefinition request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) RetrieveDefaultDefinitionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RetrieveDefaultDefinitionResponder handles the response to the RetrieveDefaultDefinition request. The method always +// closes the http.Response Body. +func (client FunctionsClient) RetrieveDefaultDefinitionResponder(resp *http.Response) (result Function, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Test tests if the information provided for a function is valid. This can range from testing the connection to the +// underlying web service behind the function or making sure the function code provided is syntactically correct. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// functionName - the name of the function. +// function - if the function specified does not already exist, this parameter must contain the full function +// definition intended to be tested. If the function specified already exists, this parameter can be left null +// to test the existing function as is or if specified, the properties specified will overwrite the +// corresponding properties in the existing function (exactly like a PATCH operation) and the resulting +// function will be tested. +func (client FunctionsClient) Test(ctx context.Context, resourceGroupName string, jobName string, functionName string, function *Function) (result FunctionsTestFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.Test") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "Test", err.Error()) + } + + req, err := client.TestPreparer(ctx, resourceGroupName, jobName, functionName, function) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", nil, "Failure preparing request") + return + } + + result, err = client.TestSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", result.Response(), "Failure sending request") + return + } + + return +} + +// TestPreparer prepares the Test request. +func (client FunctionsClient) TestPreparer(ctx context.Context, resourceGroupName string, jobName string, functionName string, function *Function) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if function != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(function)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TestSender sends the Test request. The method will close the +// http.Response Body if it receives an error. +func (client FunctionsClient) TestSender(req *http.Request) (future FunctionsTestFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// TestResponder handles the response to the Test request. The method always +// closes the http.Response Body. +func (client FunctionsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing function under an existing streaming job. This can be used to partially update (ie. +// update one or two properties) a function without affecting the rest the job or function definition. +// Parameters: +// function - a function object. The properties specified here will overwrite the corresponding properties in +// the existing function (ie. Those properties will be updated). Any properties that are set to null here will +// mean that the corresponding property in the existing function will remain the same and not change as a +// result of this PATCH operation. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// functionName - the name of the function. +// ifMatch - the ETag of the function. Omit this value to always overwrite the current function. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client FunctionsClient) Update(ctx context.Context, function Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (result Function, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.FunctionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, function, resourceGroupName, jobName, functionName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FunctionsClient) UpdatePreparer(ctx context.Context, function Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "functionName": autorest.Encode("path", functionName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters), + autorest.WithJSON(function), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 FunctionsClient) 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 FunctionsClient) UpdateResponder(resp *http.Response) (result Function, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/inputs.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/inputs.go new file mode 100644 index 000000000000..0ca5c1e15010 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/inputs.go @@ -0,0 +1,646 @@ +package streamanalytics + +// 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" +) + +// InputsClient is the stream Analytics Client +type InputsClient struct { + BaseClient +} + +// NewInputsClient creates an instance of the InputsClient client. +func NewInputsClient(subscriptionID string) InputsClient { + return NewInputsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInputsClientWithBaseURI creates an instance of the InputsClient 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 NewInputsClientWithBaseURI(baseURI string, subscriptionID string) InputsClient { + return InputsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates an input or replaces an already existing input under an existing streaming job. +// Parameters: +// input - the definition of the input that will be used to create a new input or replace the existing one +// under the streaming job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// inputName - the name of the input. +// ifMatch - the ETag of the input. Omit this value to always overwrite the current input. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new input to be created, but to prevent updating an existing input. +// Other values will result in a 412 Pre-condition Failed response. +func (client InputsClient) CreateOrReplace(ctx context.Context, input Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (result Input, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.CreateOrReplace") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.InputsClient", "CreateOrReplace", err.Error()) + } + + req, err := client.CreateOrReplacePreparer(ctx, input, resourceGroupName, jobName, inputName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client InputsClient) CreateOrReplacePreparer(ctx context.Context, input Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client InputsClient) CreateOrReplaceResponder(resp *http.Response) (result Input, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an input from the streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// inputName - the name of the input. +func (client InputsClient) Delete(ctx context.Context, resourceGroupName string, jobName string, inputName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.InputsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, jobName, inputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client InputsClient) DeletePreparer(ctx context.Context, resourceGroupName string, jobName string, inputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", 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 InputsClient) 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 InputsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details about the specified input. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// inputName - the name of the input. +func (client InputsClient) Get(ctx context.Context, resourceGroupName string, jobName string, inputName string) (result Input, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.InputsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, jobName, inputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client InputsClient) GetPreparer(ctx context.Context, resourceGroupName string, jobName string, inputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", 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 InputsClient) 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 InputsClient) GetResponder(resp *http.Response) (result Input, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJob lists all of the inputs under the specified streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// selectParameter - the $select OData query parameter. This is a comma-separated list of structural properties +// to include in the response, or "*" to include all properties. By default, all properties are returned except +// diagnostics. Currently only accepts '*' as a valid value. +func (client InputsClient) ListByStreamingJob(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result InputListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.ListByStreamingJob") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.InputsClient", "ListByStreamingJob", err.Error()) + } + + result.fn = client.listByStreamingJobNextResults + req, err := client.ListByStreamingJobPreparer(ctx, resourceGroupName, jobName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByStreamingJobPreparer prepares the ListByStreamingJob request. +func (client InputsClient) ListByStreamingJobPreparer(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always +// closes the http.Response Body. +func (client InputsClient) ListByStreamingJobResponder(resp *http.Response) (result InputListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByStreamingJobNextResults retrieves the next set of results, if any. +func (client InputsClient) listByStreamingJobNextResults(ctx context.Context, lastResults InputListResult) (result InputListResult, err error) { + req, err := lastResults.inputListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "listByStreamingJobNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "listByStreamingJobNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "listByStreamingJobNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByStreamingJobComplete enumerates all values, automatically crossing page boundaries as required. +func (client InputsClient) ListByStreamingJobComplete(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result InputListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.ListByStreamingJob") + 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.ListByStreamingJob(ctx, resourceGroupName, jobName, selectParameter) + return +} + +// Test tests whether an input’s datasource is reachable and usable by the Azure Stream Analytics service. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// inputName - the name of the input. +// input - if the input specified does not already exist, this parameter must contain the full input definition +// intended to be tested. If the input specified already exists, this parameter can be left null to test the +// existing input as is or if specified, the properties specified will overwrite the corresponding properties +// in the existing input (exactly like a PATCH operation) and the resulting input will be tested. +func (client InputsClient) Test(ctx context.Context, resourceGroupName string, jobName string, inputName string, input *Input) (result InputsTestFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.Test") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.InputsClient", "Test", err.Error()) + } + + req, err := client.TestPreparer(ctx, resourceGroupName, jobName, inputName, input) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", nil, "Failure preparing request") + return + } + + result, err = client.TestSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", result.Response(), "Failure sending request") + return + } + + return +} + +// TestPreparer prepares the Test request. +func (client InputsClient) TestPreparer(ctx context.Context, resourceGroupName string, jobName string, inputName string, input *Input) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if input != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(input)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TestSender sends the Test request. The method will close the +// http.Response Body if it receives an error. +func (client InputsClient) TestSender(req *http.Request) (future InputsTestFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// TestResponder handles the response to the Test request. The method always +// closes the http.Response Body. +func (client InputsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing input under an existing streaming job. This can be used to partially update (ie. update +// one or two properties) an input without affecting the rest the job or input definition. +// Parameters: +// input - an Input object. The properties specified here will overwrite the corresponding properties in the +// existing input (ie. Those properties will be updated). Any properties that are set to null here will mean +// that the corresponding property in the existing input will remain the same and not change as a result of +// this PATCH operation. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// inputName - the name of the input. +// ifMatch - the ETag of the input. Omit this value to always overwrite the current input. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client InputsClient) Update(ctx context.Context, input Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (result Input, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.InputsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, input, resourceGroupName, jobName, inputName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client InputsClient) UpdatePreparer(ctx context.Context, input Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inputName": autorest.Encode("path", inputName), + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 InputsClient) 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 InputsClient) UpdateResponder(resp *http.Response) (result Input, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go new file mode 100644 index 000000000000..b83507cf399d --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/models.go @@ -0,0 +1,7319 @@ +package streamanalytics + +// 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/streamanalytics/mgmt/2020-03-01/streamanalytics" + +// AvroSerialization describes how data from an input is serialized or how data is serialized when written +// to an output in Avro format. +type AvroSerialization struct { + // Properties - The properties that are associated with the Avro serialization type. Required on PUT (CreateOrReplace) requests. + Properties interface{} `json:"properties,omitempty"` + // Type - Possible values include: 'TypeSerialization', 'TypeAvro', 'TypeJSON', 'TypeCsv', 'TypeParquet' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvroSerialization. +func (as AvroSerialization) MarshalJSON() ([]byte, error) { + as.Type = TypeAvro + objectMap := make(map[string]interface{}) + if as.Properties != nil { + objectMap["properties"] = as.Properties + } + if as.Type != "" { + objectMap["type"] = as.Type + } + return json.Marshal(objectMap) +} + +// AsAvroSerialization is the BasicSerialization implementation for AvroSerialization. +func (as AvroSerialization) AsAvroSerialization() (*AvroSerialization, bool) { + return &as, true +} + +// AsJSONSerialization is the BasicSerialization implementation for AvroSerialization. +func (as AvroSerialization) AsJSONSerialization() (*JSONSerialization, bool) { + return nil, false +} + +// AsCsvSerialization is the BasicSerialization implementation for AvroSerialization. +func (as AvroSerialization) AsCsvSerialization() (*CsvSerialization, bool) { + return nil, false +} + +// AsParquetSerialization is the BasicSerialization implementation for AvroSerialization. +func (as AvroSerialization) AsParquetSerialization() (*ParquetSerialization, bool) { + return nil, false +} + +// AsSerialization is the BasicSerialization implementation for AvroSerialization. +func (as AvroSerialization) AsSerialization() (*Serialization, bool) { + return nil, false +} + +// AsBasicSerialization is the BasicSerialization implementation for AvroSerialization. +func (as AvroSerialization) AsBasicSerialization() (BasicSerialization, bool) { + return &as, true +} + +// AzureDataLakeStoreOutputDataSource describes an Azure Data Lake Store output data source. +type AzureDataLakeStoreOutputDataSource struct { + // AzureDataLakeStoreOutputDataSourceProperties - The properties that are associated with an Azure Data Lake Store output. Required on PUT (CreateOrReplace) requests. + *AzureDataLakeStoreOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) MarshalJSON() ([]byte, error) { + adlsods.Type = TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts + objectMap := make(map[string]interface{}) + if adlsods.AzureDataLakeStoreOutputDataSourceProperties != nil { + objectMap["properties"] = adlsods.AzureDataLakeStoreOutputDataSourceProperties + } + if adlsods.Type != "" { + objectMap["type"] = adlsods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return &adlsods, true +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for AzureDataLakeStoreOutputDataSource. +func (adlsods AzureDataLakeStoreOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &adlsods, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureDataLakeStoreOutputDataSource struct. +func (adlsods *AzureDataLakeStoreOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureDataLakeStoreOutputDataSourceProperties AzureDataLakeStoreOutputDataSourceProperties + err = json.Unmarshal(*v, &azureDataLakeStoreOutputDataSourceProperties) + if err != nil { + return err + } + adlsods.AzureDataLakeStoreOutputDataSourceProperties = &azureDataLakeStoreOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adlsods.Type = typeVar + } + } + } + + return nil +} + +// AzureDataLakeStoreOutputDataSourceProperties the properties that are associated with an Azure Data Lake +// Store. +type AzureDataLakeStoreOutputDataSourceProperties struct { + // AccountName - The name of the Azure Data Lake Store account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` + // TenantID - The tenant id of the user used to obtain the refresh token. Required on PUT (CreateOrReplace) requests. + TenantID *string `json:"tenantId,omitempty"` + // FilePathPrefix - The location of the file to which the output should be written to. Required on PUT (CreateOrReplace) requests. + FilePathPrefix *string `json:"filePathPrefix,omitempty"` + // DateFormat - The date format. Wherever {date} appears in filePathPrefix, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + // TimeFormat - The time format. Wherever {time} appears in filePathPrefix, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` + // RefreshToken - A refresh token that can be used to obtain a valid access token that can then be used to authenticate with the data source. A valid refresh token is currently only obtainable via the Azure Portal. It is recommended to put a dummy string value here when creating the data source and then going to the Azure Portal to authenticate the data source which will update this property with a valid refresh token. Required on PUT (CreateOrReplace) requests. + RefreshToken *string `json:"refreshToken,omitempty"` + // TokenUserPrincipalName - The user principal name (UPN) of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh token. + TokenUserPrincipalName *string `json:"tokenUserPrincipalName,omitempty"` + // TokenUserDisplayName - The user display name of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh token. + TokenUserDisplayName *string `json:"tokenUserDisplayName,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionBinding the binding to an Azure Machine Learning web service. +type AzureMachineLearningWebServiceFunctionBinding struct { + // AzureMachineLearningWebServiceFunctionBindingProperties - The binding properties associated with an Azure Machine learning web service. + *AzureMachineLearningWebServiceFunctionBindingProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicFunctionBindingTypeFunctionBinding', 'TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf', 'TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService' + Type TypeBasicFunctionBinding `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureMachineLearningWebServiceFunctionBinding. +func (amlwsfb AzureMachineLearningWebServiceFunctionBinding) MarshalJSON() ([]byte, error) { + amlwsfb.Type = TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService + objectMap := make(map[string]interface{}) + if amlwsfb.AzureMachineLearningWebServiceFunctionBindingProperties != nil { + objectMap["properties"] = amlwsfb.AzureMachineLearningWebServiceFunctionBindingProperties + } + if amlwsfb.Type != "" { + objectMap["type"] = amlwsfb.Type + } + return json.Marshal(objectMap) +} + +// AsJavaScriptFunctionBinding is the BasicFunctionBinding implementation for AzureMachineLearningWebServiceFunctionBinding. +func (amlwsfb AzureMachineLearningWebServiceFunctionBinding) AsJavaScriptFunctionBinding() (*JavaScriptFunctionBinding, bool) { + return nil, false +} + +// AsAzureMachineLearningWebServiceFunctionBinding is the BasicFunctionBinding implementation for AzureMachineLearningWebServiceFunctionBinding. +func (amlwsfb AzureMachineLearningWebServiceFunctionBinding) AsAzureMachineLearningWebServiceFunctionBinding() (*AzureMachineLearningWebServiceFunctionBinding, bool) { + return &amlwsfb, true +} + +// AsFunctionBinding is the BasicFunctionBinding implementation for AzureMachineLearningWebServiceFunctionBinding. +func (amlwsfb AzureMachineLearningWebServiceFunctionBinding) AsFunctionBinding() (*FunctionBinding, bool) { + return nil, false +} + +// AsBasicFunctionBinding is the BasicFunctionBinding implementation for AzureMachineLearningWebServiceFunctionBinding. +func (amlwsfb AzureMachineLearningWebServiceFunctionBinding) AsBasicFunctionBinding() (BasicFunctionBinding, bool) { + return &amlwsfb, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureMachineLearningWebServiceFunctionBinding struct. +func (amlwsfb *AzureMachineLearningWebServiceFunctionBinding) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureMachineLearningWebServiceFunctionBindingProperties AzureMachineLearningWebServiceFunctionBindingProperties + err = json.Unmarshal(*v, &azureMachineLearningWebServiceFunctionBindingProperties) + if err != nil { + return err + } + amlwsfb.AzureMachineLearningWebServiceFunctionBindingProperties = &azureMachineLearningWebServiceFunctionBindingProperties + } + case "type": + if v != nil { + var typeVar TypeBasicFunctionBinding + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + amlwsfb.Type = typeVar + } + } + } + + return nil +} + +// AzureMachineLearningWebServiceFunctionBindingProperties the binding properties associated with an Azure +// Machine learning web service. +type AzureMachineLearningWebServiceFunctionBindingProperties struct { + // Endpoint - The Request-Response execute endpoint of the Azure Machine Learning web service. Find out more here: https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-consume-web-services#request-response-service-rrs + Endpoint *string `json:"endpoint,omitempty"` + // APIKey - The API key used to authenticate with Request-Response endpoint. + APIKey *string `json:"apiKey,omitempty"` + // Inputs - The inputs for the Azure Machine Learning web service endpoint. + Inputs *AzureMachineLearningWebServiceInputs `json:"inputs,omitempty"` + // Outputs - A list of outputs from the Azure Machine Learning web service endpoint execution. + Outputs *[]AzureMachineLearningWebServiceOutputColumn `json:"outputs,omitempty"` + // BatchSize - Number between 1 and 10000 describing maximum number of rows for every Azure ML RRS execute request. Default is 1000. + BatchSize *int32 `json:"batchSize,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionBindingRetrievalProperties the binding retrieval properties +// associated with an Azure Machine learning web service. +type AzureMachineLearningWebServiceFunctionBindingRetrievalProperties struct { + // ExecuteEndpoint - The Request-Response execute endpoint of the Azure Machine Learning web service. Find out more here: https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-consume-web-services#request-response-service-rrs + ExecuteEndpoint *string `json:"executeEndpoint,omitempty"` + // UdfType - The function type. Possible values include: 'UdfTypeScalar' + UdfType UdfType `json:"udfType,omitempty"` +} + +// AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters the parameters needed to +// retrieve the default function definition for an Azure Machine Learning web service function. +type AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters struct { + // AzureMachineLearningWebServiceFunctionBindingRetrievalProperties - The binding retrieval properties associated with an Azure Machine learning web service. + *AzureMachineLearningWebServiceFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` + // BindingType - Possible values include: 'BindingTypeFunctionRetrieveDefaultDefinitionParameters', 'BindingTypeMicrosoftMachineLearningWebService', 'BindingTypeMicrosoftStreamAnalyticsJavascriptUdf' + BindingType BindingType `json:"bindingType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters. +func (amlwsfrddp AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + amlwsfrddp.BindingType = BindingTypeMicrosoftMachineLearningWebService + objectMap := make(map[string]interface{}) + if amlwsfrddp.AzureMachineLearningWebServiceFunctionBindingRetrievalProperties != nil { + objectMap["bindingRetrievalProperties"] = amlwsfrddp.AzureMachineLearningWebServiceFunctionBindingRetrievalProperties + } + if amlwsfrddp.BindingType != "" { + objectMap["bindingType"] = amlwsfrddp.BindingType + } + return json.Marshal(objectMap) +} + +// AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters. +func (amlwsfrddp AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters) AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters() (*AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters, bool) { + return &amlwsfrddp, true +} + +// AsJavaScriptFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters. +func (amlwsfrddp AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters) AsJavaScriptFunctionRetrieveDefaultDefinitionParameters() (*JavaScriptFunctionRetrieveDefaultDefinitionParameters, bool) { + return nil, false +} + +// AsFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters. +func (amlwsfrddp AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters) AsFunctionRetrieveDefaultDefinitionParameters() (*FunctionRetrieveDefaultDefinitionParameters, bool) { + return nil, false +} + +// AsBasicFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters. +func (amlwsfrddp AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters) AsBasicFunctionRetrieveDefaultDefinitionParameters() (BasicFunctionRetrieveDefaultDefinitionParameters, bool) { + return &amlwsfrddp, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters struct. +func (amlwsfrddp *AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "bindingRetrievalProperties": + if v != nil { + var azureMachineLearningWebServiceFunctionBindingRetrievalProperties AzureMachineLearningWebServiceFunctionBindingRetrievalProperties + err = json.Unmarshal(*v, &azureMachineLearningWebServiceFunctionBindingRetrievalProperties) + if err != nil { + return err + } + amlwsfrddp.AzureMachineLearningWebServiceFunctionBindingRetrievalProperties = &azureMachineLearningWebServiceFunctionBindingRetrievalProperties + } + case "bindingType": + if v != nil { + var bindingType BindingType + err = json.Unmarshal(*v, &bindingType) + if err != nil { + return err + } + amlwsfrddp.BindingType = bindingType + } + } + } + + return nil +} + +// AzureMachineLearningWebServiceInputColumn describes an input column for the Azure Machine Learning web +// service endpoint. +type AzureMachineLearningWebServiceInputColumn struct { + // Name - The name of the input column. + Name *string `json:"name,omitempty"` + // DataType - The (Azure Machine Learning supported) data type of the input column. A list of valid Azure Machine Learning data types are described at https://msdn.microsoft.com/en-us/library/azure/dn905923.aspx . + DataType *string `json:"dataType,omitempty"` + // MapTo - The zero based index of the function parameter this input maps to. + MapTo *int32 `json:"mapTo,omitempty"` +} + +// AzureMachineLearningWebServiceInputs the inputs for the Azure Machine Learning web service endpoint. +type AzureMachineLearningWebServiceInputs struct { + // Name - The name of the input. This is the name provided while authoring the endpoint. + Name *string `json:"name,omitempty"` + // ColumnNames - A list of input columns for the Azure Machine Learning web service endpoint. + ColumnNames *[]AzureMachineLearningWebServiceInputColumn `json:"columnNames,omitempty"` +} + +// AzureMachineLearningWebServiceOutputColumn describes an output column for the Azure Machine Learning web +// service endpoint. +type AzureMachineLearningWebServiceOutputColumn struct { + // Name - The name of the output column. + Name *string `json:"name,omitempty"` + // DataType - The (Azure Machine Learning supported) data type of the output column. A list of valid Azure Machine Learning data types are described at https://msdn.microsoft.com/en-us/library/azure/dn905923.aspx . + DataType *string `json:"dataType,omitempty"` +} + +// AzureSQLDatabaseDataSourceProperties the properties that are associated with an Azure SQL database data +// source. +type AzureSQLDatabaseDataSourceProperties struct { + // Server - The name of the SQL server containing the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Server *string `json:"server,omitempty"` + // Database - The name of the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + // User - The user name that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + User *string `json:"user,omitempty"` + // Password - The password that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Password *string `json:"password,omitempty"` + // Table - The name of the table in the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + // MaxBatchCount - Max Batch count for write to Sql database, the default value is 10,000. Optional on PUT requests. + MaxBatchCount *float64 `json:"maxBatchCount,omitempty"` + // MaxWriterCount - Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. + MaxWriterCount *float64 `json:"maxWriterCount,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// AzureSQLDatabaseOutputDataSource describes an Azure SQL database output data source. +type AzureSQLDatabaseOutputDataSource struct { + // AzureSQLDatabaseOutputDataSourceProperties - The properties that are associated with an Azure SQL database output. Required on PUT (CreateOrReplace) requests. + *AzureSQLDatabaseOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) MarshalJSON() ([]byte, error) { + asdods.Type = TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase + objectMap := make(map[string]interface{}) + if asdods.AzureSQLDatabaseOutputDataSourceProperties != nil { + objectMap["properties"] = asdods.AzureSQLDatabaseOutputDataSourceProperties + } + if asdods.Type != "" { + objectMap["type"] = asdods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return &asdods, true +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for AzureSQLDatabaseOutputDataSource. +func (asdods AzureSQLDatabaseOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &asdods, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureSQLDatabaseOutputDataSource struct. +func (asdods *AzureSQLDatabaseOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureSQLDatabaseOutputDataSourceProperties AzureSQLDatabaseOutputDataSourceProperties + err = json.Unmarshal(*v, &azureSQLDatabaseOutputDataSourceProperties) + if err != nil { + return err + } + asdods.AzureSQLDatabaseOutputDataSourceProperties = &azureSQLDatabaseOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asdods.Type = typeVar + } + } + } + + return nil +} + +// AzureSQLDatabaseOutputDataSourceProperties the properties that are associated with an Azure SQL database +// output. +type AzureSQLDatabaseOutputDataSourceProperties struct { + // Server - The name of the SQL server containing the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Server *string `json:"server,omitempty"` + // Database - The name of the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + // User - The user name that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + User *string `json:"user,omitempty"` + // Password - The password that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Password *string `json:"password,omitempty"` + // Table - The name of the table in the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + // MaxBatchCount - Max Batch count for write to Sql database, the default value is 10,000. Optional on PUT requests. + MaxBatchCount *float64 `json:"maxBatchCount,omitempty"` + // MaxWriterCount - Max Writer count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. + MaxWriterCount *float64 `json:"maxWriterCount,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// AzureSQLReferenceInputDataSource describes an Azure SQL database reference input data source. +type AzureSQLReferenceInputDataSource struct { + // AzureSQLReferenceInputDataSourceProperties - The properties that are associated with SQL DB input containing reference data. Required on PUT (CreateOrReplace) requests. + *AzureSQLReferenceInputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource', 'TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicReferenceInputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureSQLReferenceInputDataSource. +func (asrids AzureSQLReferenceInputDataSource) MarshalJSON() ([]byte, error) { + asrids.Type = TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase + objectMap := make(map[string]interface{}) + if asrids.AzureSQLReferenceInputDataSourceProperties != nil { + objectMap["properties"] = asrids.AzureSQLReferenceInputDataSourceProperties + } + if asrids.Type != "" { + objectMap["type"] = asrids.Type + } + return json.Marshal(objectMap) +} + +// AsAzureSQLReferenceInputDataSource is the BasicReferenceInputDataSource implementation for AzureSQLReferenceInputDataSource. +func (asrids AzureSQLReferenceInputDataSource) AsAzureSQLReferenceInputDataSource() (*AzureSQLReferenceInputDataSource, bool) { + return &asrids, true +} + +// AsBlobReferenceInputDataSource is the BasicReferenceInputDataSource implementation for AzureSQLReferenceInputDataSource. +func (asrids AzureSQLReferenceInputDataSource) AsBlobReferenceInputDataSource() (*BlobReferenceInputDataSource, bool) { + return nil, false +} + +// AsReferenceInputDataSource is the BasicReferenceInputDataSource implementation for AzureSQLReferenceInputDataSource. +func (asrids AzureSQLReferenceInputDataSource) AsReferenceInputDataSource() (*ReferenceInputDataSource, bool) { + return nil, false +} + +// AsBasicReferenceInputDataSource is the BasicReferenceInputDataSource implementation for AzureSQLReferenceInputDataSource. +func (asrids AzureSQLReferenceInputDataSource) AsBasicReferenceInputDataSource() (BasicReferenceInputDataSource, bool) { + return &asrids, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureSQLReferenceInputDataSource struct. +func (asrids *AzureSQLReferenceInputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureSQLReferenceInputDataSourceProperties AzureSQLReferenceInputDataSourceProperties + err = json.Unmarshal(*v, &azureSQLReferenceInputDataSourceProperties) + if err != nil { + return err + } + asrids.AzureSQLReferenceInputDataSourceProperties = &azureSQLReferenceInputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicReferenceInputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asrids.Type = typeVar + } + } + } + + return nil +} + +// AzureSQLReferenceInputDataSourceProperties the properties that are associated with SQL DB input +// containing reference data. Required on PUT (CreateOrReplace) requests. +type AzureSQLReferenceInputDataSourceProperties struct { + // Server - This element is associated with the datasource element. This is the name of the server that contains the database that will be written to. + Server *string `json:"server,omitempty"` + // Database - This element is associated with the datasource element. This is the name of the database that output will be written to. + Database *string `json:"database,omitempty"` + // User - This element is associated with the datasource element. This is the user name that will be used to connect to the SQL Database instance. + User *string `json:"user,omitempty"` + // Password - This element is associated with the datasource element. This is the password that will be used to connect to the SQL Database instance. + Password *string `json:"password,omitempty"` + // Table - This element is associated with the datasource element. The name of the table in the Azure SQL database.. + Table *string `json:"table,omitempty"` + // RefreshType - Indicates the type of data refresh option. Possible values include: 'RefreshTypeStatic', 'RefreshTypeRefreshPeriodicallyWithFull', 'RefreshTypeRefreshPeriodicallyWithDelta' + RefreshType RefreshType `json:"refreshType,omitempty"` + // RefreshRate - This element is associated with the datasource element. This indicates how frequently the data will be fetched from the database. It is of DateTime format. + RefreshRate *string `json:"refreshRate,omitempty"` + // FullSnapshotQuery - This element is associated with the datasource element. This query is used to fetch data from the sql database. + FullSnapshotQuery *string `json:"fullSnapshotQuery,omitempty"` + // DeltaSnapshotQuery - This element is associated with the datasource element. This query is used to fetch incremental changes from the SQL database. To use this option, we recommend using temporal tables in Azure SQL Database. + DeltaSnapshotQuery *string `json:"deltaSnapshotQuery,omitempty"` +} + +// AzureSynapseDataSourceProperties the properties that are associated with an Azure SQL database data +// source. +type AzureSynapseDataSourceProperties struct { + // Server - The name of the SQL server containing the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Server *string `json:"server,omitempty"` + // Database - The name of the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + // Table - The name of the table in the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + // User - The user name that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + User *string `json:"user,omitempty"` + // Password - The password that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Password *string `json:"password,omitempty"` +} + +// AzureSynapseOutputDataSource describes an Azure Synapse output data source. +type AzureSynapseOutputDataSource struct { + // AzureSynapseOutputDataSourceProperties - The properties that are associated with an Azure Synapse output. Required on PUT (CreateOrReplace) requests. + *AzureSynapseOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) MarshalJSON() ([]byte, error) { + asods.Type = TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse + objectMap := make(map[string]interface{}) + if asods.AzureSynapseOutputDataSourceProperties != nil { + objectMap["properties"] = asods.AzureSynapseOutputDataSourceProperties + } + if asods.Type != "" { + objectMap["type"] = asods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return &asods, true +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for AzureSynapseOutputDataSource. +func (asods AzureSynapseOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &asods, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureSynapseOutputDataSource struct. +func (asods *AzureSynapseOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureSynapseOutputDataSourceProperties AzureSynapseOutputDataSourceProperties + err = json.Unmarshal(*v, &azureSynapseOutputDataSourceProperties) + if err != nil { + return err + } + asods.AzureSynapseOutputDataSourceProperties = &azureSynapseOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asods.Type = typeVar + } + } + } + + return nil +} + +// AzureSynapseOutputDataSourceProperties the properties that are associated with an Azure Synapse output. +type AzureSynapseOutputDataSourceProperties struct { + // Server - The name of the SQL server containing the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Server *string `json:"server,omitempty"` + // Database - The name of the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + // Table - The name of the table in the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + // User - The user name that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + User *string `json:"user,omitempty"` + // Password - The password that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Password *string `json:"password,omitempty"` +} + +// AzureTableOutputDataSource describes an Azure Table output data source. +type AzureTableOutputDataSource struct { + // AzureTableOutputDataSourceProperties - The properties that are associated with an Azure Table output. Required on PUT (CreateOrReplace) requests. + *AzureTableOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) MarshalJSON() ([]byte, error) { + atods.Type = TypeBasicOutputDataSourceTypeMicrosoftStorageTable + objectMap := make(map[string]interface{}) + if atods.AzureTableOutputDataSourceProperties != nil { + objectMap["properties"] = atods.AzureTableOutputDataSourceProperties + } + if atods.Type != "" { + objectMap["type"] = atods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return &atods, true +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for AzureTableOutputDataSource. +func (atods AzureTableOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &atods, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureTableOutputDataSource struct. +func (atods *AzureTableOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureTableOutputDataSourceProperties AzureTableOutputDataSourceProperties + err = json.Unmarshal(*v, &azureTableOutputDataSourceProperties) + if err != nil { + return err + } + atods.AzureTableOutputDataSourceProperties = &azureTableOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + atods.Type = typeVar + } + } + } + + return nil +} + +// AzureTableOutputDataSourceProperties the properties that are associated with an Azure Table output. +type AzureTableOutputDataSourceProperties struct { + // AccountName - The name of the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` + // AccountKey - The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` + // Table - The name of the Azure Table. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + // PartitionKey - This element indicates the name of a column from the SELECT statement in the query that will be used as the partition key for the Azure Table. Required on PUT (CreateOrReplace) requests. + PartitionKey *string `json:"partitionKey,omitempty"` + // RowKey - This element indicates the name of a column from the SELECT statement in the query that will be used as the row key for the Azure Table. Required on PUT (CreateOrReplace) requests. + RowKey *string `json:"rowKey,omitempty"` + // ColumnsToRemove - If specified, each item in the array is the name of a column to remove (if present) from output event entities. + ColumnsToRemove *[]string `json:"columnsToRemove,omitempty"` + // BatchSize - The number of rows to write to the Azure Table at a time. + BatchSize *int32 `json:"batchSize,omitempty"` +} + +// BlobDataSourceProperties the properties that are associated with a blob data source. +type BlobDataSourceProperties struct { + // StorageAccounts - A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + // Container - The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. + Container *string `json:"container,omitempty"` + // PathPattern - The blob path pattern. Not a regular expression. It represents a pattern against which blob names will be matched to determine whether or not they should be included as input or output to the job. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for a more detailed explanation and example. + PathPattern *string `json:"pathPattern,omitempty"` + // DateFormat - The date format. Wherever {date} appears in pathPattern, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// BlobOutputDataSource describes a blob output data source. +type BlobOutputDataSource struct { + // BlobOutputDataSourceProperties - The properties that are associated with a blob output. Required on PUT (CreateOrReplace) requests. + *BlobOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobOutputDataSource. +func (bods BlobOutputDataSource) MarshalJSON() ([]byte, error) { + bods.Type = TypeBasicOutputDataSourceTypeMicrosoftStorageBlob + objectMap := make(map[string]interface{}) + if bods.BlobOutputDataSourceProperties != nil { + objectMap["properties"] = bods.BlobOutputDataSourceProperties + } + if bods.Type != "" { + objectMap["type"] = bods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return &bods, true +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for BlobOutputDataSource. +func (bods BlobOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &bods, true +} + +// UnmarshalJSON is the custom unmarshaler for BlobOutputDataSource struct. +func (bods *BlobOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var blobOutputDataSourceProperties BlobOutputDataSourceProperties + err = json.Unmarshal(*v, &blobOutputDataSourceProperties) + if err != nil { + return err + } + bods.BlobOutputDataSourceProperties = &blobOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bods.Type = typeVar + } + } + } + + return nil +} + +// BlobOutputDataSourceProperties the properties that are associated with a blob output. +type BlobOutputDataSourceProperties struct { + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` + // StorageAccounts - A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + // Container - The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. + Container *string `json:"container,omitempty"` + // PathPattern - The blob path pattern. Not a regular expression. It represents a pattern against which blob names will be matched to determine whether or not they should be included as input or output to the job. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for a more detailed explanation and example. + PathPattern *string `json:"pathPattern,omitempty"` + // DateFormat - The date format. Wherever {date} appears in pathPattern, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// BlobReferenceInputDataSource describes a blob input data source that contains reference data. +type BlobReferenceInputDataSource struct { + // BlobReferenceInputDataSourceProperties - The properties that are associated with a blob input containing reference data. Required on PUT (CreateOrReplace) requests. + *BlobReferenceInputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource', 'TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicReferenceInputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobReferenceInputDataSource. +func (brids BlobReferenceInputDataSource) MarshalJSON() ([]byte, error) { + brids.Type = TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob + objectMap := make(map[string]interface{}) + if brids.BlobReferenceInputDataSourceProperties != nil { + objectMap["properties"] = brids.BlobReferenceInputDataSourceProperties + } + if brids.Type != "" { + objectMap["type"] = brids.Type + } + return json.Marshal(objectMap) +} + +// AsAzureSQLReferenceInputDataSource is the BasicReferenceInputDataSource implementation for BlobReferenceInputDataSource. +func (brids BlobReferenceInputDataSource) AsAzureSQLReferenceInputDataSource() (*AzureSQLReferenceInputDataSource, bool) { + return nil, false +} + +// AsBlobReferenceInputDataSource is the BasicReferenceInputDataSource implementation for BlobReferenceInputDataSource. +func (brids BlobReferenceInputDataSource) AsBlobReferenceInputDataSource() (*BlobReferenceInputDataSource, bool) { + return &brids, true +} + +// AsReferenceInputDataSource is the BasicReferenceInputDataSource implementation for BlobReferenceInputDataSource. +func (brids BlobReferenceInputDataSource) AsReferenceInputDataSource() (*ReferenceInputDataSource, bool) { + return nil, false +} + +// AsBasicReferenceInputDataSource is the BasicReferenceInputDataSource implementation for BlobReferenceInputDataSource. +func (brids BlobReferenceInputDataSource) AsBasicReferenceInputDataSource() (BasicReferenceInputDataSource, bool) { + return &brids, true +} + +// UnmarshalJSON is the custom unmarshaler for BlobReferenceInputDataSource struct. +func (brids *BlobReferenceInputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var blobReferenceInputDataSourceProperties BlobReferenceInputDataSourceProperties + err = json.Unmarshal(*v, &blobReferenceInputDataSourceProperties) + if err != nil { + return err + } + brids.BlobReferenceInputDataSourceProperties = &blobReferenceInputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicReferenceInputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + brids.Type = typeVar + } + } + } + + return nil +} + +// BlobReferenceInputDataSourceProperties the properties that are associated with a blob input containing +// reference data. +type BlobReferenceInputDataSourceProperties struct { + // StorageAccounts - A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + // Container - The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. + Container *string `json:"container,omitempty"` + // PathPattern - The blob path pattern. Not a regular expression. It represents a pattern against which blob names will be matched to determine whether or not they should be included as input or output to the job. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for a more detailed explanation and example. + PathPattern *string `json:"pathPattern,omitempty"` + // DateFormat - The date format. Wherever {date} appears in pathPattern, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// BlobStreamInputDataSource describes a blob input data source that contains stream data. +type BlobStreamInputDataSource struct { + // BlobStreamInputDataSourceProperties - The properties that are associated with a blob input containing stream data. Required on PUT (CreateOrReplace) requests. + *BlobStreamInputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicStreamInputDataSourceTypeStreamInputDataSource', 'TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs', 'TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicStreamInputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) MarshalJSON() ([]byte, error) { + bsids.Type = TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob + objectMap := make(map[string]interface{}) + if bsids.BlobStreamInputDataSourceProperties != nil { + objectMap["properties"] = bsids.BlobStreamInputDataSourceProperties + } + if bsids.Type != "" { + objectMap["type"] = bsids.Type + } + return json.Marshal(objectMap) +} + +// AsIoTHubStreamInputDataSource is the BasicStreamInputDataSource implementation for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) AsIoTHubStreamInputDataSource() (*IoTHubStreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubV2StreamInputDataSource is the BasicStreamInputDataSource implementation for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) AsEventHubV2StreamInputDataSource() (*EventHubV2StreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubStreamInputDataSource is the BasicStreamInputDataSource implementation for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) AsEventHubStreamInputDataSource() (*EventHubStreamInputDataSource, bool) { + return nil, false +} + +// AsBlobStreamInputDataSource is the BasicStreamInputDataSource implementation for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) AsBlobStreamInputDataSource() (*BlobStreamInputDataSource, bool) { + return &bsids, true +} + +// AsStreamInputDataSource is the BasicStreamInputDataSource implementation for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) AsStreamInputDataSource() (*StreamInputDataSource, bool) { + return nil, false +} + +// AsBasicStreamInputDataSource is the BasicStreamInputDataSource implementation for BlobStreamInputDataSource. +func (bsids BlobStreamInputDataSource) AsBasicStreamInputDataSource() (BasicStreamInputDataSource, bool) { + return &bsids, true +} + +// UnmarshalJSON is the custom unmarshaler for BlobStreamInputDataSource struct. +func (bsids *BlobStreamInputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var blobStreamInputDataSourceProperties BlobStreamInputDataSourceProperties + err = json.Unmarshal(*v, &blobStreamInputDataSourceProperties) + if err != nil { + return err + } + bsids.BlobStreamInputDataSourceProperties = &blobStreamInputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicStreamInputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bsids.Type = typeVar + } + } + } + + return nil +} + +// BlobStreamInputDataSourceProperties the properties that are associated with a blob input containing +// stream data. +type BlobStreamInputDataSourceProperties struct { + // SourcePartitionCount - The partition count of the blob input data source. Range 1 - 256. + SourcePartitionCount *int32 `json:"sourcePartitionCount,omitempty"` + // StorageAccounts - A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. + StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` + // Container - The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on PUT (CreateOrReplace) requests. + Container *string `json:"container,omitempty"` + // PathPattern - The blob path pattern. Not a regular expression. It represents a pattern against which blob names will be matched to determine whether or not they should be included as input or output to the job. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for a more detailed explanation and example. + PathPattern *string `json:"pathPattern,omitempty"` + // DateFormat - The date format. Wherever {date} appears in pathPattern, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + // TimeFormat - The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// Cluster a Stream Analytics Cluster object +type Cluster struct { + autorest.Response `json:"-"` + Sku *ClusterSku `json:"sku,omitempty"` + // Etag - READ-ONLY; The current entity tag for the cluster. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // ClusterProperties - The properties associated with a Stream Analytics cluster. + *ClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Sku != nil { + objectMap["sku"] = c.Sku + } + if c.ClusterProperties != nil { + objectMap["properties"] = c.ClusterProperties + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + if c.Location != nil { + objectMap["location"] = c.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Cluster struct. +func (c *Cluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ClusterSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + c.Sku = &sku + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + c.Etag = &etag + } + case "properties": + if v != nil { + var clusterProperties ClusterProperties + err = json.Unmarshal(*v, &clusterProperties) + if err != nil { + return err + } + c.ClusterProperties = &clusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + } + } + + return nil +} + +// ClusterInfo the properties associated with a Stream Analytics cluster. +type ClusterInfo struct { + // ID - The resource id of cluster. + ID *string `json:"id,omitempty"` +} + +// ClusterJob a streaming job. +type ClusterJob struct { + // ID - READ-ONLY; Resource ID of the streaming job. + ID *string `json:"id,omitempty"` + // StreamingUnits - READ-ONLY; The number of streaming units that are used by the streaming job. + StreamingUnits *int32 `json:"streamingUnits,omitempty"` + // JobState - Possible values include: 'JobStateCreated', 'JobStateStarting', 'JobStateRunning', 'JobStateStopping', 'JobStateStopped', 'JobStateDeleting', 'JobStateFailed', 'JobStateDegraded', 'JobStateRestarting', 'JobStateScaling' + JobState JobState `json:"jobState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterJob. +func (cj ClusterJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cj.JobState != "" { + objectMap["jobState"] = cj.JobState + } + return json.Marshal(objectMap) +} + +// ClusterJobListResult a list of streaming jobs. Populated by a List operation. +type ClusterJobListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of streaming jobs. + Value *[]ClusterJob `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to fetch the next set of streaming jobs. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterJobListResult. +func (cjlr ClusterJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterJobListResultIterator provides access to a complete listing of ClusterJob values. +type ClusterJobListResultIterator struct { + i int + page ClusterJobListResultPage +} + +// 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 *ClusterJobListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterJobListResultIterator.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 *ClusterJobListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ClusterJobListResultIterator) 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 ClusterJobListResultIterator) Response() ClusterJobListResult { + 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 ClusterJobListResultIterator) Value() ClusterJob { + if !iter.page.NotDone() { + return ClusterJob{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ClusterJobListResultIterator type. +func NewClusterJobListResultIterator(page ClusterJobListResultPage) ClusterJobListResultIterator { + return ClusterJobListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cjlr ClusterJobListResult) IsEmpty() bool { + return cjlr.Value == nil || len(*cjlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cjlr ClusterJobListResult) hasNextLink() bool { + return cjlr.NextLink != nil && len(*cjlr.NextLink) != 0 +} + +// clusterJobListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cjlr ClusterJobListResult) clusterJobListResultPreparer(ctx context.Context) (*http.Request, error) { + if !cjlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cjlr.NextLink))) +} + +// ClusterJobListResultPage contains a page of ClusterJob values. +type ClusterJobListResultPage struct { + fn func(context.Context, ClusterJobListResult) (ClusterJobListResult, error) + cjlr ClusterJobListResult +} + +// 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 *ClusterJobListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterJobListResultPage.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.cjlr) + if err != nil { + return err + } + page.cjlr = 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 *ClusterJobListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ClusterJobListResultPage) NotDone() bool { + return !page.cjlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ClusterJobListResultPage) Response() ClusterJobListResult { + return page.cjlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ClusterJobListResultPage) Values() []ClusterJob { + if page.cjlr.IsEmpty() { + return nil + } + return *page.cjlr.Value +} + +// Creates a new instance of the ClusterJobListResultPage type. +func NewClusterJobListResultPage(cur ClusterJobListResult, getNextPage func(context.Context, ClusterJobListResult) (ClusterJobListResult, error)) ClusterJobListResultPage { + return ClusterJobListResultPage{ + fn: getNextPage, + cjlr: cur, + } +} + +// ClusterListResult a list of clusters populated by a 'list' operation. +type ClusterListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of clusters. + Value *[]Cluster `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to fetch the next set of clusters. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterListResult. +func (clr ClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterListResultIterator provides access to a complete listing of Cluster values. +type ClusterListResultIterator struct { + i int + page ClusterListResultPage +} + +// 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 *ClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultIterator.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 *ClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ClusterListResultIterator) 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 ClusterListResultIterator) Response() ClusterListResult { + 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 ClusterListResultIterator) Value() Cluster { + if !iter.page.NotDone() { + return Cluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ClusterListResultIterator type. +func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { + return ClusterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr ClusterListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (clr ClusterListResult) hasNextLink() bool { + return clr.NextLink != nil && len(*clr.NextLink) != 0 +} + +// clusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr ClusterListResult) clusterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !clr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// ClusterListResultPage contains a page of Cluster values. +type ClusterListResultPage struct { + fn func(context.Context, ClusterListResult) (ClusterListResult, error) + clr ClusterListResult +} + +// 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 *ClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultPage.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.clr) + if err != nil { + return err + } + page.clr = 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 *ClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ClusterListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ClusterListResultPage) Response() ClusterListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ClusterListResultPage) Values() []Cluster { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// Creates a new instance of the ClusterListResultPage type. +func NewClusterListResultPage(cur ClusterListResult, getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { + return ClusterListResultPage{ + fn: getNextPage, + clr: cur, + } +} + +// ClusterProperties the properties associated with a Stream Analytics cluster. +type ClusterProperties struct { + // CreatedDate - READ-ONLY; The date this cluster was created. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ClusterID - READ-ONLY; Unique identifier for the cluster. + ClusterID *string `json:"clusterId,omitempty"` + // ProvisioningState - Possible values include: 'ClusterProvisioningStateSucceeded', 'ClusterProvisioningStateFailed', 'ClusterProvisioningStateCanceled', 'ClusterProvisioningStateInProgress' + ProvisioningState ClusterProvisioningState `json:"provisioningState,omitempty"` + // CapacityAllocated - READ-ONLY; Represents the number of streaming units currently being used on the cluster. + CapacityAllocated *int32 `json:"capacityAllocated,omitempty"` + // CapacityAssigned - READ-ONLY; Represents the sum of the SUs of all streaming jobs associated with the cluster. If all of the jobs were running, this would be the capacity allocated. + CapacityAssigned *int32 `json:"capacityAssigned,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterProperties. +func (cp ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.ProvisioningState != "" { + objectMap["provisioningState"] = cp.ProvisioningState + } + return json.Marshal(objectMap) +} + +// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (Cluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersCreateOrUpdateFuture) 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 ClustersCreateOrUpdateFuture.Result. +func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + c.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.ClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.CreateOrUpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersDeleteFuture) 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 ClustersDeleteFuture.Result. +func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.ClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ClusterSku the SKU of the cluster. This determines the size/capacity of the cluster. Required on PUT +// (CreateOrUpdate) requests. +type ClusterSku struct { + // Name - Specifies the SKU name of the cluster. Required on PUT (CreateOrUpdate) requests. Possible values include: 'ClusterSkuNameDefault' + Name ClusterSkuName `json:"name,omitempty"` + // Capacity - Denotes the number of streaming units the cluster can support. Valid values for this property are multiples of 36 with a minimum value of 36 and maximum value of 216. Required on PUT (CreateOrUpdate) requests. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ClustersClient) (Cluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ClustersUpdateFuture) 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 ClustersUpdateFuture.Result. +func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + c.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.ClustersUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.UpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// Compression describes how input data is compressed +type Compression struct { + // Type - Indicates the type of compression that the input uses. Required on PUT (CreateOrReplace) requests. Possible values include: 'CompressionTypeNone', 'CompressionTypeGZip', 'CompressionTypeDeflate' + Type CompressionType `json:"type,omitempty"` +} + +// CsvSerialization describes how data from an input is serialized or how data is serialized when written +// to an output in CSV format. +type CsvSerialization struct { + // CsvSerializationProperties - The properties that are associated with the CSV serialization type. Required on PUT (CreateOrReplace) requests. + *CsvSerializationProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeSerialization', 'TypeAvro', 'TypeJSON', 'TypeCsv', 'TypeParquet' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CsvSerialization. +func (cs CsvSerialization) MarshalJSON() ([]byte, error) { + cs.Type = TypeCsv + objectMap := make(map[string]interface{}) + if cs.CsvSerializationProperties != nil { + objectMap["properties"] = cs.CsvSerializationProperties + } + if cs.Type != "" { + objectMap["type"] = cs.Type + } + return json.Marshal(objectMap) +} + +// AsAvroSerialization is the BasicSerialization implementation for CsvSerialization. +func (cs CsvSerialization) AsAvroSerialization() (*AvroSerialization, bool) { + return nil, false +} + +// AsJSONSerialization is the BasicSerialization implementation for CsvSerialization. +func (cs CsvSerialization) AsJSONSerialization() (*JSONSerialization, bool) { + return nil, false +} + +// AsCsvSerialization is the BasicSerialization implementation for CsvSerialization. +func (cs CsvSerialization) AsCsvSerialization() (*CsvSerialization, bool) { + return &cs, true +} + +// AsParquetSerialization is the BasicSerialization implementation for CsvSerialization. +func (cs CsvSerialization) AsParquetSerialization() (*ParquetSerialization, bool) { + return nil, false +} + +// AsSerialization is the BasicSerialization implementation for CsvSerialization. +func (cs CsvSerialization) AsSerialization() (*Serialization, bool) { + return nil, false +} + +// AsBasicSerialization is the BasicSerialization implementation for CsvSerialization. +func (cs CsvSerialization) AsBasicSerialization() (BasicSerialization, bool) { + return &cs, true +} + +// UnmarshalJSON is the custom unmarshaler for CsvSerialization struct. +func (cs *CsvSerialization) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var csvSerializationProperties CsvSerializationProperties + err = json.Unmarshal(*v, &csvSerializationProperties) + if err != nil { + return err + } + cs.CsvSerializationProperties = &csvSerializationProperties + } + case "type": + if v != nil { + var typeVar Type + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cs.Type = typeVar + } + } + } + + return nil +} + +// CsvSerializationProperties the properties that are associated with the CSV serialization type. +type CsvSerializationProperties struct { + // FieldDelimiter - Specifies the delimiter that will be used to separate comma-separated value (CSV) records. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for a list of supported values. Required on PUT (CreateOrReplace) requests. + FieldDelimiter *string `json:"fieldDelimiter,omitempty"` + // Encoding - Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) requests. Possible values include: 'EncodingUTF8' + Encoding Encoding `json:"encoding,omitempty"` +} + +// DiagnosticCondition condition applicable to the resource, or to the job overall, that warrant customer +// attention. +type DiagnosticCondition struct { + // Since - READ-ONLY; The UTC timestamp of when the condition started. Customers should be able to find a corresponding event in the ops log around this time. + Since *string `json:"since,omitempty"` + // Code - READ-ONLY; The opaque diagnostic code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The human-readable message describing the condition in detail. Localized in the Accept-Language of the client request. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiagnosticCondition. +func (dc DiagnosticCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Diagnostics describes conditions applicable to the Input, Output, or the job overall, that warrant +// customer attention. +type Diagnostics struct { + // Conditions - READ-ONLY; A collection of zero or more conditions applicable to the resource, or to the job overall, that warrant customer attention. + Conditions *[]DiagnosticCondition `json:"conditions,omitempty"` +} + +// MarshalJSON is the custom marshaler for Diagnostics. +func (d Diagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DocumentDbOutputDataSource describes a DocumentDB output data source. +type DocumentDbOutputDataSource struct { + // DocumentDbOutputDataSourceProperties - The properties that are associated with a DocumentDB output. Required on PUT (CreateOrReplace) requests. + *DocumentDbOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) MarshalJSON() ([]byte, error) { + ddods.Type = TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB + objectMap := make(map[string]interface{}) + if ddods.DocumentDbOutputDataSourceProperties != nil { + objectMap["properties"] = ddods.DocumentDbOutputDataSourceProperties + } + if ddods.Type != "" { + objectMap["type"] = ddods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return &ddods, true +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for DocumentDbOutputDataSource. +func (ddods DocumentDbOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &ddods, true +} + +// UnmarshalJSON is the custom unmarshaler for DocumentDbOutputDataSource struct. +func (ddods *DocumentDbOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var documentDbOutputDataSourceProperties DocumentDbOutputDataSourceProperties + err = json.Unmarshal(*v, &documentDbOutputDataSourceProperties) + if err != nil { + return err + } + ddods.DocumentDbOutputDataSourceProperties = &documentDbOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ddods.Type = typeVar + } + } + } + + return nil +} + +// DocumentDbOutputDataSourceProperties the properties that are associated with a DocumentDB output. +type DocumentDbOutputDataSourceProperties struct { + // AccountID - The DocumentDB account name or ID. Required on PUT (CreateOrReplace) requests. + AccountID *string `json:"accountId,omitempty"` + // AccountKey - The account key for the DocumentDB account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` + // Database - The name of the DocumentDB database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + // CollectionNamePattern - The collection name pattern for the collections to be used. The collection name format can be constructed using the optional {partition} token, where partitions start from 0. See the DocumentDB section of https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for more information. Required on PUT (CreateOrReplace) requests. + CollectionNamePattern *string `json:"collectionNamePattern,omitempty"` + // PartitionKey - The name of the field in output events used to specify the key for partitioning output across collections. If 'collectionNamePattern' contains the {partition} token, this property is required to be specified. + PartitionKey *string `json:"partitionKey,omitempty"` + // DocumentID - The name of the field in output events used to specify the primary key which insert or update operations are based on. + DocumentID *string `json:"documentId,omitempty"` +} + +// Error common error representation. +type Error struct { + // Error - Error definition properties. + Error *ErrorError `json:"error,omitempty"` +} + +// ErrorDetails common error details representation. +type ErrorDetails struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` +} + +// ErrorError error definition properties. +type ErrorError struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Details - Error details. + Details *[]ErrorDetails `json:"details,omitempty"` +} + +// ErrorResponse describes the error that occurred. +type ErrorResponse struct { + // Code - READ-ONLY; Error code associated with the error that occurred. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Describes the error in detail. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorResponse. +func (er ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EventHubDataSourceProperties the common properties that are associated with Event Hub data sources. +type EventHubDataSourceProperties struct { + // EventHubName - The name of the Event Hub. Required on PUT (CreateOrReplace) requests. + EventHubName *string `json:"eventHubName,omitempty"` + // ServiceBusNamespace - The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// EventHubOutputDataSource describes an Event Hub output data source. +type EventHubOutputDataSource struct { + // EventHubOutputDataSourceProperties - The properties that are associated with an Event Hub output. Required on PUT (CreateOrReplace) requests. + *EventHubOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) MarshalJSON() ([]byte, error) { + ehods.Type = TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub + objectMap := make(map[string]interface{}) + if ehods.EventHubOutputDataSourceProperties != nil { + objectMap["properties"] = ehods.EventHubOutputDataSourceProperties + } + if ehods.Type != "" { + objectMap["type"] = ehods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return &ehods, true +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for EventHubOutputDataSource. +func (ehods EventHubOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &ehods, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubOutputDataSource struct. +func (ehods *EventHubOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventHubOutputDataSourceProperties EventHubOutputDataSourceProperties + err = json.Unmarshal(*v, &eventHubOutputDataSourceProperties) + if err != nil { + return err + } + ehods.EventHubOutputDataSourceProperties = &eventHubOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ehods.Type = typeVar + } + } + } + + return nil +} + +// EventHubOutputDataSourceProperties the properties that are associated with an Event Hub output. +type EventHubOutputDataSourceProperties struct { + // PartitionKey - The key/column that is used to determine to which partition to send event data. + PartitionKey *string `json:"partitionKey,omitempty"` + // PropertyColumns - The properties associated with this Event Hub output. + PropertyColumns *[]string `json:"propertyColumns,omitempty"` + // EventHubName - The name of the Event Hub. Required on PUT (CreateOrReplace) requests. + EventHubName *string `json:"eventHubName,omitempty"` + // ServiceBusNamespace - The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// EventHubStreamInputDataSource describes an Event Hub input data source that contains stream data. +type EventHubStreamInputDataSource struct { + // EventHubStreamInputDataSourceProperties - The properties that are associated with an Event Hub input containing stream data. Required on PUT (CreateOrReplace) requests. + *EventHubStreamInputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicStreamInputDataSourceTypeStreamInputDataSource', 'TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs', 'TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicStreamInputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) MarshalJSON() ([]byte, error) { + ehsids.Type = TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub + objectMap := make(map[string]interface{}) + if ehsids.EventHubStreamInputDataSourceProperties != nil { + objectMap["properties"] = ehsids.EventHubStreamInputDataSourceProperties + } + if ehsids.Type != "" { + objectMap["type"] = ehsids.Type + } + return json.Marshal(objectMap) +} + +// AsIoTHubStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) AsIoTHubStreamInputDataSource() (*IoTHubStreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubV2StreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) AsEventHubV2StreamInputDataSource() (*EventHubV2StreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) AsEventHubStreamInputDataSource() (*EventHubStreamInputDataSource, bool) { + return &ehsids, true +} + +// AsBlobStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) AsBlobStreamInputDataSource() (*BlobStreamInputDataSource, bool) { + return nil, false +} + +// AsStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) AsStreamInputDataSource() (*StreamInputDataSource, bool) { + return nil, false +} + +// AsBasicStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubStreamInputDataSource. +func (ehsids EventHubStreamInputDataSource) AsBasicStreamInputDataSource() (BasicStreamInputDataSource, bool) { + return &ehsids, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubStreamInputDataSource struct. +func (ehsids *EventHubStreamInputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventHubStreamInputDataSourceProperties EventHubStreamInputDataSourceProperties + err = json.Unmarshal(*v, &eventHubStreamInputDataSourceProperties) + if err != nil { + return err + } + ehsids.EventHubStreamInputDataSourceProperties = &eventHubStreamInputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicStreamInputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ehsids.Type = typeVar + } + } + } + + return nil +} + +// EventHubStreamInputDataSourceProperties the properties that are associated with a Event Hub input +// containing stream data. +type EventHubStreamInputDataSourceProperties struct { + // ConsumerGroupName - The name of an Event Hub Consumer Group that should be used to read events from the Event Hub. Specifying distinct consumer group names for multiple inputs allows each of those inputs to receive the same events from the Event Hub. If not specified, the input uses the Event Hub’s default consumer group. + ConsumerGroupName *string `json:"consumerGroupName,omitempty"` + // EventHubName - The name of the Event Hub. Required on PUT (CreateOrReplace) requests. + EventHubName *string `json:"eventHubName,omitempty"` + // ServiceBusNamespace - The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// EventHubV2OutputDataSource describes an Event Hub output data source. +type EventHubV2OutputDataSource struct { + // EventHubOutputDataSourceProperties - The properties that are associated with an Event Hub output. Required on PUT (CreateOrReplace) requests. + *EventHubOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) MarshalJSON() ([]byte, error) { + ehvods.Type = TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub + objectMap := make(map[string]interface{}) + if ehvods.EventHubOutputDataSourceProperties != nil { + objectMap["properties"] = ehvods.EventHubOutputDataSourceProperties + } + if ehvods.Type != "" { + objectMap["type"] = ehvods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return &ehvods, true +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for EventHubV2OutputDataSource. +func (ehvods EventHubV2OutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &ehvods, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubV2OutputDataSource struct. +func (ehvods *EventHubV2OutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventHubOutputDataSourceProperties EventHubOutputDataSourceProperties + err = json.Unmarshal(*v, &eventHubOutputDataSourceProperties) + if err != nil { + return err + } + ehvods.EventHubOutputDataSourceProperties = &eventHubOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ehvods.Type = typeVar + } + } + } + + return nil +} + +// EventHubV2StreamInputDataSource describes an Event Hub input data source that contains stream data. +type EventHubV2StreamInputDataSource struct { + // EventHubStreamInputDataSourceProperties - The properties that are associated with an Event Hub input containing stream data. Required on PUT (CreateOrReplace) requests. + *EventHubStreamInputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicStreamInputDataSourceTypeStreamInputDataSource', 'TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs', 'TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicStreamInputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) MarshalJSON() ([]byte, error) { + ehvsids.Type = TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub + objectMap := make(map[string]interface{}) + if ehvsids.EventHubStreamInputDataSourceProperties != nil { + objectMap["properties"] = ehvsids.EventHubStreamInputDataSourceProperties + } + if ehvsids.Type != "" { + objectMap["type"] = ehvsids.Type + } + return json.Marshal(objectMap) +} + +// AsIoTHubStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) AsIoTHubStreamInputDataSource() (*IoTHubStreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubV2StreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) AsEventHubV2StreamInputDataSource() (*EventHubV2StreamInputDataSource, bool) { + return &ehvsids, true +} + +// AsEventHubStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) AsEventHubStreamInputDataSource() (*EventHubStreamInputDataSource, bool) { + return nil, false +} + +// AsBlobStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) AsBlobStreamInputDataSource() (*BlobStreamInputDataSource, bool) { + return nil, false +} + +// AsStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) AsStreamInputDataSource() (*StreamInputDataSource, bool) { + return nil, false +} + +// AsBasicStreamInputDataSource is the BasicStreamInputDataSource implementation for EventHubV2StreamInputDataSource. +func (ehvsids EventHubV2StreamInputDataSource) AsBasicStreamInputDataSource() (BasicStreamInputDataSource, bool) { + return &ehvsids, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubV2StreamInputDataSource struct. +func (ehvsids *EventHubV2StreamInputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var eventHubStreamInputDataSourceProperties EventHubStreamInputDataSourceProperties + err = json.Unmarshal(*v, &eventHubStreamInputDataSourceProperties) + if err != nil { + return err + } + ehvsids.EventHubStreamInputDataSourceProperties = &eventHubStreamInputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicStreamInputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ehvsids.Type = typeVar + } + } + } + + return nil +} + +// Function a function object, containing all information associated with the named function. All functions +// are contained under a streaming job. +type Function struct { + autorest.Response `json:"-"` + // Properties - The properties that are associated with a function. + Properties BasicFunctionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Function. +func (f Function) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = f.Properties + if f.Name != nil { + objectMap["name"] = f.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Function struct. +func (f *Function) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicFunctionProperties(*v) + if err != nil { + return err + } + f.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + f.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + f.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + f.Type = &typeVar + } + } + } + + return nil +} + +// BasicFunctionBinding the physical binding of the function. For example, in the Azure Machine Learning web service’s +// case, this describes the endpoint. +type BasicFunctionBinding interface { + AsJavaScriptFunctionBinding() (*JavaScriptFunctionBinding, bool) + AsAzureMachineLearningWebServiceFunctionBinding() (*AzureMachineLearningWebServiceFunctionBinding, bool) + AsFunctionBinding() (*FunctionBinding, bool) +} + +// FunctionBinding the physical binding of the function. For example, in the Azure Machine Learning web +// service’s case, this describes the endpoint. +type FunctionBinding struct { + // Type - Possible values include: 'TypeBasicFunctionBindingTypeFunctionBinding', 'TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf', 'TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService' + Type TypeBasicFunctionBinding `json:"type,omitempty"` +} + +func unmarshalBasicFunctionBinding(body []byte) (BasicFunctionBinding, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf): + var jsfb JavaScriptFunctionBinding + err := json.Unmarshal(body, &jsfb) + return jsfb, err + case string(TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService): + var amlwsfb AzureMachineLearningWebServiceFunctionBinding + err := json.Unmarshal(body, &amlwsfb) + return amlwsfb, err + default: + var fb FunctionBinding + err := json.Unmarshal(body, &fb) + return fb, err + } +} +func unmarshalBasicFunctionBindingArray(body []byte) ([]BasicFunctionBinding, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fbArray := make([]BasicFunctionBinding, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fb, err := unmarshalBasicFunctionBinding(*rawMessage) + if err != nil { + return nil, err + } + fbArray[index] = fb + } + return fbArray, nil +} + +// MarshalJSON is the custom marshaler for FunctionBinding. +func (fb FunctionBinding) MarshalJSON() ([]byte, error) { + fb.Type = TypeBasicFunctionBindingTypeFunctionBinding + objectMap := make(map[string]interface{}) + if fb.Type != "" { + objectMap["type"] = fb.Type + } + return json.Marshal(objectMap) +} + +// AsJavaScriptFunctionBinding is the BasicFunctionBinding implementation for FunctionBinding. +func (fb FunctionBinding) AsJavaScriptFunctionBinding() (*JavaScriptFunctionBinding, bool) { + return nil, false +} + +// AsAzureMachineLearningWebServiceFunctionBinding is the BasicFunctionBinding implementation for FunctionBinding. +func (fb FunctionBinding) AsAzureMachineLearningWebServiceFunctionBinding() (*AzureMachineLearningWebServiceFunctionBinding, bool) { + return nil, false +} + +// AsFunctionBinding is the BasicFunctionBinding implementation for FunctionBinding. +func (fb FunctionBinding) AsFunctionBinding() (*FunctionBinding, bool) { + return &fb, true +} + +// AsBasicFunctionBinding is the BasicFunctionBinding implementation for FunctionBinding. +func (fb FunctionBinding) AsBasicFunctionBinding() (BasicFunctionBinding, bool) { + return &fb, true +} + +// FunctionInput describes one input parameter of a function. +type FunctionInput struct { + // DataType - The (Azure Stream Analytics supported) data type of the function input parameter. A list of valid Azure Stream Analytics data types are described at https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx + DataType *string `json:"dataType,omitempty"` + // IsConfigurationParameter - A flag indicating if the parameter is a configuration parameter. True if this input parameter is expected to be a constant. Default is false. + IsConfigurationParameter *bool `json:"isConfigurationParameter,omitempty"` +} + +// FunctionListResult object containing a list of functions under a streaming job. +type FunctionListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of functions under a streaming job. Populated by a 'List' operation. + Value *[]Function `json:"value,omitempty"` + // NextLink - READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FunctionListResult. +func (flr FunctionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FunctionListResultIterator provides access to a complete listing of Function values. +type FunctionListResultIterator struct { + i int + page FunctionListResultPage +} + +// 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 *FunctionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionListResultIterator.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 *FunctionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FunctionListResultIterator) 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 FunctionListResultIterator) Response() FunctionListResult { + 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 FunctionListResultIterator) Value() Function { + if !iter.page.NotDone() { + return Function{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FunctionListResultIterator type. +func NewFunctionListResultIterator(page FunctionListResultPage) FunctionListResultIterator { + return FunctionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (flr FunctionListResult) IsEmpty() bool { + return flr.Value == nil || len(*flr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (flr FunctionListResult) hasNextLink() bool { + return flr.NextLink != nil && len(*flr.NextLink) != 0 +} + +// functionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (flr FunctionListResult) functionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !flr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(flr.NextLink))) +} + +// FunctionListResultPage contains a page of Function values. +type FunctionListResultPage struct { + fn func(context.Context, FunctionListResult) (FunctionListResult, error) + flr FunctionListResult +} + +// 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 *FunctionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FunctionListResultPage.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.flr) + if err != nil { + return err + } + page.flr = 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 *FunctionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FunctionListResultPage) NotDone() bool { + return !page.flr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FunctionListResultPage) Response() FunctionListResult { + return page.flr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FunctionListResultPage) Values() []Function { + if page.flr.IsEmpty() { + return nil + } + return *page.flr.Value +} + +// Creates a new instance of the FunctionListResultPage type. +func NewFunctionListResultPage(cur FunctionListResult, getNextPage func(context.Context, FunctionListResult) (FunctionListResult, error)) FunctionListResultPage { + return FunctionListResultPage{ + fn: getNextPage, + flr: cur, + } +} + +// FunctionOutput describes the output of a function. +type FunctionOutput struct { + // DataType - The (Azure Stream Analytics supported) data type of the function output. A list of valid Azure Stream Analytics data types are described at https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx + DataType *string `json:"dataType,omitempty"` +} + +// BasicFunctionProperties the properties that are associated with a function. +type BasicFunctionProperties interface { + AsScalarFunctionProperties() (*ScalarFunctionProperties, bool) + AsFunctionProperties() (*FunctionProperties, bool) +} + +// FunctionProperties the properties that are associated with a function. +type FunctionProperties struct { + // Etag - READ-ONLY; The current entity tag for the function. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // Type - Possible values include: 'TypeBasicFunctionPropertiesTypeFunctionProperties', 'TypeBasicFunctionPropertiesTypeScalar' + Type TypeBasicFunctionProperties `json:"type,omitempty"` +} + +func unmarshalBasicFunctionProperties(body []byte) (BasicFunctionProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicFunctionPropertiesTypeScalar): + var sfp ScalarFunctionProperties + err := json.Unmarshal(body, &sfp) + return sfp, err + default: + var fp FunctionProperties + err := json.Unmarshal(body, &fp) + return fp, err + } +} +func unmarshalBasicFunctionPropertiesArray(body []byte) ([]BasicFunctionProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fpArray := make([]BasicFunctionProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fp, err := unmarshalBasicFunctionProperties(*rawMessage) + if err != nil { + return nil, err + } + fpArray[index] = fp + } + return fpArray, nil +} + +// MarshalJSON is the custom marshaler for FunctionProperties. +func (fp FunctionProperties) MarshalJSON() ([]byte, error) { + fp.Type = TypeBasicFunctionPropertiesTypeFunctionProperties + objectMap := make(map[string]interface{}) + if fp.Type != "" { + objectMap["type"] = fp.Type + } + return json.Marshal(objectMap) +} + +// AsScalarFunctionProperties is the BasicFunctionProperties implementation for FunctionProperties. +func (fp FunctionProperties) AsScalarFunctionProperties() (*ScalarFunctionProperties, bool) { + return nil, false +} + +// AsFunctionProperties is the BasicFunctionProperties implementation for FunctionProperties. +func (fp FunctionProperties) AsFunctionProperties() (*FunctionProperties, bool) { + return &fp, true +} + +// AsBasicFunctionProperties is the BasicFunctionProperties implementation for FunctionProperties. +func (fp FunctionProperties) AsBasicFunctionProperties() (BasicFunctionProperties, bool) { + return &fp, true +} + +// BasicFunctionRetrieveDefaultDefinitionParameters parameters used to specify the type of function to retrieve the +// default definition for. +type BasicFunctionRetrieveDefaultDefinitionParameters interface { + AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters() (*AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters, bool) + AsJavaScriptFunctionRetrieveDefaultDefinitionParameters() (*JavaScriptFunctionRetrieveDefaultDefinitionParameters, bool) + AsFunctionRetrieveDefaultDefinitionParameters() (*FunctionRetrieveDefaultDefinitionParameters, bool) +} + +// FunctionRetrieveDefaultDefinitionParameters parameters used to specify the type of function to retrieve the +// default definition for. +type FunctionRetrieveDefaultDefinitionParameters struct { + // BindingType - Possible values include: 'BindingTypeFunctionRetrieveDefaultDefinitionParameters', 'BindingTypeMicrosoftMachineLearningWebService', 'BindingTypeMicrosoftStreamAnalyticsJavascriptUdf' + BindingType BindingType `json:"bindingType,omitempty"` +} + +func unmarshalBasicFunctionRetrieveDefaultDefinitionParameters(body []byte) (BasicFunctionRetrieveDefaultDefinitionParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["bindingType"] { + case string(BindingTypeMicrosoftMachineLearningWebService): + var amlwsfrddp AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters + err := json.Unmarshal(body, &amlwsfrddp) + return amlwsfrddp, err + case string(BindingTypeMicrosoftStreamAnalyticsJavascriptUdf): + var jsfrddp JavaScriptFunctionRetrieveDefaultDefinitionParameters + err := json.Unmarshal(body, &jsfrddp) + return jsfrddp, err + default: + var frddp FunctionRetrieveDefaultDefinitionParameters + err := json.Unmarshal(body, &frddp) + return frddp, err + } +} +func unmarshalBasicFunctionRetrieveDefaultDefinitionParametersArray(body []byte) ([]BasicFunctionRetrieveDefaultDefinitionParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + frddpArray := make([]BasicFunctionRetrieveDefaultDefinitionParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + frddp, err := unmarshalBasicFunctionRetrieveDefaultDefinitionParameters(*rawMessage) + if err != nil { + return nil, err + } + frddpArray[index] = frddp + } + return frddpArray, nil +} + +// MarshalJSON is the custom marshaler for FunctionRetrieveDefaultDefinitionParameters. +func (frddp FunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + frddp.BindingType = BindingTypeFunctionRetrieveDefaultDefinitionParameters + objectMap := make(map[string]interface{}) + if frddp.BindingType != "" { + objectMap["bindingType"] = frddp.BindingType + } + return json.Marshal(objectMap) +} + +// AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for FunctionRetrieveDefaultDefinitionParameters. +func (frddp FunctionRetrieveDefaultDefinitionParameters) AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters() (*AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters, bool) { + return nil, false +} + +// AsJavaScriptFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for FunctionRetrieveDefaultDefinitionParameters. +func (frddp FunctionRetrieveDefaultDefinitionParameters) AsJavaScriptFunctionRetrieveDefaultDefinitionParameters() (*JavaScriptFunctionRetrieveDefaultDefinitionParameters, bool) { + return nil, false +} + +// AsFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for FunctionRetrieveDefaultDefinitionParameters. +func (frddp FunctionRetrieveDefaultDefinitionParameters) AsFunctionRetrieveDefaultDefinitionParameters() (*FunctionRetrieveDefaultDefinitionParameters, bool) { + return &frddp, true +} + +// AsBasicFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for FunctionRetrieveDefaultDefinitionParameters. +func (frddp FunctionRetrieveDefaultDefinitionParameters) AsBasicFunctionRetrieveDefaultDefinitionParameters() (BasicFunctionRetrieveDefaultDefinitionParameters, bool) { + return &frddp, true +} + +// FunctionsTestFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FunctionsTestFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FunctionsClient) (ResourceTestStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FunctionsTestFuture) 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 FunctionsTestFuture.Result. +func (future *FunctionsTestFuture) result(client FunctionsClient) (rts ResourceTestStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsTestFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rts.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.FunctionsTestFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rts.Response.Response, err = future.GetResult(sender); err == nil && rts.Response.Response.StatusCode != http.StatusNoContent { + rts, err = client.TestResponder(rts.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsTestFuture", "Result", rts.Response.Response, "Failure responding to request") + } + } + return +} + +// Identity describes how identity is verified +type Identity struct { + // TenantID - The identity tenantId + TenantID *string `json:"tenantId,omitempty"` + // PrincipalID - The identity principal ID + PrincipalID *string `json:"principalId,omitempty"` + // Type - The identity type + Type *string `json:"type,omitempty"` +} + +// Input an input object, containing all information associated with the named input. All inputs are +// contained under a streaming job. +type Input struct { + autorest.Response `json:"-"` + // Properties - The properties that are associated with an input. Required on PUT (CreateOrReplace) requests. + Properties BasicInputProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Input. +func (i Input) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = i.Properties + if i.Name != nil { + objectMap["name"] = i.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Input struct. +func (i *Input) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicInputProperties(*v) + if err != nil { + return err + } + i.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + } + } + + return nil +} + +// InputListResult object containing a list of inputs under a streaming job. +type InputListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of inputs under a streaming job. Populated by a 'List' operation. + Value *[]Input `json:"value,omitempty"` + // NextLink - READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InputListResult. +func (ilr InputListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InputListResultIterator provides access to a complete listing of Input values. +type InputListResultIterator struct { + i int + page InputListResultPage +} + +// 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 *InputListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputListResultIterator.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 *InputListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InputListResultIterator) 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 InputListResultIterator) Response() InputListResult { + 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 InputListResultIterator) Value() Input { + if !iter.page.NotDone() { + return Input{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InputListResultIterator type. +func NewInputListResultIterator(page InputListResultPage) InputListResultIterator { + return InputListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ilr InputListResult) IsEmpty() bool { + return ilr.Value == nil || len(*ilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ilr InputListResult) hasNextLink() bool { + return ilr.NextLink != nil && len(*ilr.NextLink) != 0 +} + +// inputListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ilr InputListResult) inputListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ilr.NextLink))) +} + +// InputListResultPage contains a page of Input values. +type InputListResultPage struct { + fn func(context.Context, InputListResult) (InputListResult, error) + ilr InputListResult +} + +// 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 *InputListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InputListResultPage.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.ilr) + if err != nil { + return err + } + page.ilr = 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 *InputListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InputListResultPage) NotDone() bool { + return !page.ilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InputListResultPage) Response() InputListResult { + return page.ilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InputListResultPage) Values() []Input { + if page.ilr.IsEmpty() { + return nil + } + return *page.ilr.Value +} + +// Creates a new instance of the InputListResultPage type. +func NewInputListResultPage(cur InputListResult, getNextPage func(context.Context, InputListResult) (InputListResult, error)) InputListResultPage { + return InputListResultPage{ + fn: getNextPage, + ilr: cur, + } +} + +// BasicInputProperties the properties that are associated with an input. +type BasicInputProperties interface { + AsReferenceInputProperties() (*ReferenceInputProperties, bool) + AsStreamInputProperties() (*StreamInputProperties, bool) + AsInputProperties() (*InputProperties, bool) +} + +// InputProperties the properties that are associated with an input. +type InputProperties struct { + // Serialization - Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. + Serialization BasicSerialization `json:"serialization,omitempty"` + // Diagnostics - READ-ONLY; Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + // Etag - READ-ONLY; The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // Compression - Describes how input data is compressed + Compression *Compression `json:"compression,omitempty"` + // PartitionKey - partitionKey Describes a key in the input data which is used for partitioning the input data + PartitionKey *string `json:"partitionKey,omitempty"` + // Type - Possible values include: 'TypeBasicInputPropertiesTypeInputProperties', 'TypeBasicInputPropertiesTypeReference', 'TypeBasicInputPropertiesTypeStream' + Type TypeBasicInputProperties `json:"type,omitempty"` +} + +func unmarshalBasicInputProperties(body []byte) (BasicInputProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicInputPropertiesTypeReference): + var rip ReferenceInputProperties + err := json.Unmarshal(body, &rip) + return rip, err + case string(TypeBasicInputPropertiesTypeStream): + var sip StreamInputProperties + err := json.Unmarshal(body, &sip) + return sip, err + default: + var IP InputProperties + err := json.Unmarshal(body, &IP) + return IP, err + } +} +func unmarshalBasicInputPropertiesArray(body []byte) ([]BasicInputProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + IPArray := make([]BasicInputProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + IP, err := unmarshalBasicInputProperties(*rawMessage) + if err != nil { + return nil, err + } + IPArray[index] = IP + } + return IPArray, nil +} + +// MarshalJSON is the custom marshaler for InputProperties. +func (IP InputProperties) MarshalJSON() ([]byte, error) { + IP.Type = TypeBasicInputPropertiesTypeInputProperties + objectMap := make(map[string]interface{}) + objectMap["serialization"] = IP.Serialization + if IP.Compression != nil { + objectMap["compression"] = IP.Compression + } + if IP.PartitionKey != nil { + objectMap["partitionKey"] = IP.PartitionKey + } + if IP.Type != "" { + objectMap["type"] = IP.Type + } + return json.Marshal(objectMap) +} + +// AsReferenceInputProperties is the BasicInputProperties implementation for InputProperties. +func (IP InputProperties) AsReferenceInputProperties() (*ReferenceInputProperties, bool) { + return nil, false +} + +// AsStreamInputProperties is the BasicInputProperties implementation for InputProperties. +func (IP InputProperties) AsStreamInputProperties() (*StreamInputProperties, bool) { + return nil, false +} + +// AsInputProperties is the BasicInputProperties implementation for InputProperties. +func (IP InputProperties) AsInputProperties() (*InputProperties, bool) { + return &IP, true +} + +// AsBasicInputProperties is the BasicInputProperties implementation for InputProperties. +func (IP InputProperties) AsBasicInputProperties() (BasicInputProperties, bool) { + return &IP, true +} + +// UnmarshalJSON is the custom unmarshaler for InputProperties struct. +func (IP *InputProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "serialization": + if v != nil { + serialization, err := unmarshalBasicSerialization(*v) + if err != nil { + return err + } + IP.Serialization = serialization + } + case "diagnostics": + if v != nil { + var diagnostics Diagnostics + err = json.Unmarshal(*v, &diagnostics) + if err != nil { + return err + } + IP.Diagnostics = &diagnostics + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + IP.Etag = &etag + } + case "compression": + if v != nil { + var compression Compression + err = json.Unmarshal(*v, &compression) + if err != nil { + return err + } + IP.Compression = &compression + } + case "partitionKey": + if v != nil { + var partitionKey string + err = json.Unmarshal(*v, &partitionKey) + if err != nil { + return err + } + IP.PartitionKey = &partitionKey + } + case "type": + if v != nil { + var typeVar TypeBasicInputProperties + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + IP.Type = typeVar + } + } + } + + return nil +} + +// InputsTestFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type InputsTestFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InputsClient) (ResourceTestStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InputsTestFuture) 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 InputsTestFuture.Result. +func (future *InputsTestFuture) result(client InputsClient) (rts ResourceTestStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsTestFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rts.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.InputsTestFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rts.Response.Response, err = future.GetResult(sender); err == nil && rts.Response.Response.StatusCode != http.StatusNoContent { + rts, err = client.TestResponder(rts.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.InputsTestFuture", "Result", rts.Response.Response, "Failure responding to request") + } + } + return +} + +// IoTHubStreamInputDataSource describes an IoT Hub input data source that contains stream data. +type IoTHubStreamInputDataSource struct { + // IoTHubStreamInputDataSourceProperties - The properties that are associated with an IoT Hub input containing stream data. Required on PUT (CreateOrReplace) requests. + *IoTHubStreamInputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicStreamInputDataSourceTypeStreamInputDataSource', 'TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs', 'TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicStreamInputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) MarshalJSON() ([]byte, error) { + ithsids.Type = TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs + objectMap := make(map[string]interface{}) + if ithsids.IoTHubStreamInputDataSourceProperties != nil { + objectMap["properties"] = ithsids.IoTHubStreamInputDataSourceProperties + } + if ithsids.Type != "" { + objectMap["type"] = ithsids.Type + } + return json.Marshal(objectMap) +} + +// AsIoTHubStreamInputDataSource is the BasicStreamInputDataSource implementation for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) AsIoTHubStreamInputDataSource() (*IoTHubStreamInputDataSource, bool) { + return &ithsids, true +} + +// AsEventHubV2StreamInputDataSource is the BasicStreamInputDataSource implementation for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) AsEventHubV2StreamInputDataSource() (*EventHubV2StreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubStreamInputDataSource is the BasicStreamInputDataSource implementation for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) AsEventHubStreamInputDataSource() (*EventHubStreamInputDataSource, bool) { + return nil, false +} + +// AsBlobStreamInputDataSource is the BasicStreamInputDataSource implementation for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) AsBlobStreamInputDataSource() (*BlobStreamInputDataSource, bool) { + return nil, false +} + +// AsStreamInputDataSource is the BasicStreamInputDataSource implementation for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) AsStreamInputDataSource() (*StreamInputDataSource, bool) { + return nil, false +} + +// AsBasicStreamInputDataSource is the BasicStreamInputDataSource implementation for IoTHubStreamInputDataSource. +func (ithsids IoTHubStreamInputDataSource) AsBasicStreamInputDataSource() (BasicStreamInputDataSource, bool) { + return &ithsids, true +} + +// UnmarshalJSON is the custom unmarshaler for IoTHubStreamInputDataSource struct. +func (ithsids *IoTHubStreamInputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ioTHubStreamInputDataSourceProperties IoTHubStreamInputDataSourceProperties + err = json.Unmarshal(*v, &ioTHubStreamInputDataSourceProperties) + if err != nil { + return err + } + ithsids.IoTHubStreamInputDataSourceProperties = &ioTHubStreamInputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicStreamInputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ithsids.Type = typeVar + } + } + } + + return nil +} + +// IoTHubStreamInputDataSourceProperties the properties that are associated with a IoT Hub input containing +// stream data. +type IoTHubStreamInputDataSourceProperties struct { + // IotHubNamespace - The name or the URI of the IoT Hub. Required on PUT (CreateOrReplace) requests. + IotHubNamespace *string `json:"iotHubNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the IoT Hub. This policy must contain at least the Service connect permission. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // ConsumerGroupName - The name of an IoT Hub Consumer Group that should be used to read events from the IoT Hub. If not specified, the input uses the Iot Hub’s default consumer group. + ConsumerGroupName *string `json:"consumerGroupName,omitempty"` + // Endpoint - The IoT Hub endpoint to connect to (ie. messages/events, messages/operationsMonitoringEvents, etc.). + Endpoint *string `json:"endpoint,omitempty"` +} + +// JavaScriptFunctionBinding the binding to a JavaScript function. +type JavaScriptFunctionBinding struct { + // JavaScriptFunctionBindingProperties - The binding properties associated with a JavaScript function. + *JavaScriptFunctionBindingProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicFunctionBindingTypeFunctionBinding', 'TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf', 'TypeBasicFunctionBindingTypeMicrosoftMachineLearningWebService' + Type TypeBasicFunctionBinding `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JavaScriptFunctionBinding. +func (jsfb JavaScriptFunctionBinding) MarshalJSON() ([]byte, error) { + jsfb.Type = TypeBasicFunctionBindingTypeMicrosoftStreamAnalyticsJavascriptUdf + objectMap := make(map[string]interface{}) + if jsfb.JavaScriptFunctionBindingProperties != nil { + objectMap["properties"] = jsfb.JavaScriptFunctionBindingProperties + } + if jsfb.Type != "" { + objectMap["type"] = jsfb.Type + } + return json.Marshal(objectMap) +} + +// AsJavaScriptFunctionBinding is the BasicFunctionBinding implementation for JavaScriptFunctionBinding. +func (jsfb JavaScriptFunctionBinding) AsJavaScriptFunctionBinding() (*JavaScriptFunctionBinding, bool) { + return &jsfb, true +} + +// AsAzureMachineLearningWebServiceFunctionBinding is the BasicFunctionBinding implementation for JavaScriptFunctionBinding. +func (jsfb JavaScriptFunctionBinding) AsAzureMachineLearningWebServiceFunctionBinding() (*AzureMachineLearningWebServiceFunctionBinding, bool) { + return nil, false +} + +// AsFunctionBinding is the BasicFunctionBinding implementation for JavaScriptFunctionBinding. +func (jsfb JavaScriptFunctionBinding) AsFunctionBinding() (*FunctionBinding, bool) { + return nil, false +} + +// AsBasicFunctionBinding is the BasicFunctionBinding implementation for JavaScriptFunctionBinding. +func (jsfb JavaScriptFunctionBinding) AsBasicFunctionBinding() (BasicFunctionBinding, bool) { + return &jsfb, true +} + +// UnmarshalJSON is the custom unmarshaler for JavaScriptFunctionBinding struct. +func (jsfb *JavaScriptFunctionBinding) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var javaScriptFunctionBindingProperties JavaScriptFunctionBindingProperties + err = json.Unmarshal(*v, &javaScriptFunctionBindingProperties) + if err != nil { + return err + } + jsfb.JavaScriptFunctionBindingProperties = &javaScriptFunctionBindingProperties + } + case "type": + if v != nil { + var typeVar TypeBasicFunctionBinding + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + jsfb.Type = typeVar + } + } + } + + return nil +} + +// JavaScriptFunctionBindingProperties the binding properties associated with a JavaScript function. +type JavaScriptFunctionBindingProperties struct { + // Script - The JavaScript code containing a single function definition. For example: 'function (x, y) { return x + y; }' + Script *string `json:"script,omitempty"` +} + +// JavaScriptFunctionBindingRetrievalProperties the binding retrieval properties associated with a +// JavaScript function. +type JavaScriptFunctionBindingRetrievalProperties struct { + // Script - The JavaScript code containing a single function definition. For example: 'function (x, y) { return x + y; }'. + Script *string `json:"script,omitempty"` + // UdfType - The function type. Possible values include: 'UdfTypeScalar' + UdfType UdfType `json:"udfType,omitempty"` +} + +// JavaScriptFunctionRetrieveDefaultDefinitionParameters the parameters needed to retrieve the default +// function definition for a JavaScript function. +type JavaScriptFunctionRetrieveDefaultDefinitionParameters struct { + // JavaScriptFunctionBindingRetrievalProperties - The binding retrieval properties associated with a JavaScript function. + *JavaScriptFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` + // BindingType - Possible values include: 'BindingTypeFunctionRetrieveDefaultDefinitionParameters', 'BindingTypeMicrosoftMachineLearningWebService', 'BindingTypeMicrosoftStreamAnalyticsJavascriptUdf' + BindingType BindingType `json:"bindingType,omitempty"` +} + +// MarshalJSON is the custom marshaler for JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (jsfrddp JavaScriptFunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + jsfrddp.BindingType = BindingTypeMicrosoftStreamAnalyticsJavascriptUdf + objectMap := make(map[string]interface{}) + if jsfrddp.JavaScriptFunctionBindingRetrievalProperties != nil { + objectMap["bindingRetrievalProperties"] = jsfrddp.JavaScriptFunctionBindingRetrievalProperties + } + if jsfrddp.BindingType != "" { + objectMap["bindingType"] = jsfrddp.BindingType + } + return json.Marshal(objectMap) +} + +// AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (jsfrddp JavaScriptFunctionRetrieveDefaultDefinitionParameters) AsAzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters() (*AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters, bool) { + return nil, false +} + +// AsJavaScriptFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (jsfrddp JavaScriptFunctionRetrieveDefaultDefinitionParameters) AsJavaScriptFunctionRetrieveDefaultDefinitionParameters() (*JavaScriptFunctionRetrieveDefaultDefinitionParameters, bool) { + return &jsfrddp, true +} + +// AsFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (jsfrddp JavaScriptFunctionRetrieveDefaultDefinitionParameters) AsFunctionRetrieveDefaultDefinitionParameters() (*FunctionRetrieveDefaultDefinitionParameters, bool) { + return nil, false +} + +// AsBasicFunctionRetrieveDefaultDefinitionParameters is the BasicFunctionRetrieveDefaultDefinitionParameters implementation for JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (jsfrddp JavaScriptFunctionRetrieveDefaultDefinitionParameters) AsBasicFunctionRetrieveDefaultDefinitionParameters() (BasicFunctionRetrieveDefaultDefinitionParameters, bool) { + return &jsfrddp, true +} + +// UnmarshalJSON is the custom unmarshaler for JavaScriptFunctionRetrieveDefaultDefinitionParameters struct. +func (jsfrddp *JavaScriptFunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "bindingRetrievalProperties": + if v != nil { + var javaScriptFunctionBindingRetrievalProperties JavaScriptFunctionBindingRetrievalProperties + err = json.Unmarshal(*v, &javaScriptFunctionBindingRetrievalProperties) + if err != nil { + return err + } + jsfrddp.JavaScriptFunctionBindingRetrievalProperties = &javaScriptFunctionBindingRetrievalProperties + } + case "bindingType": + if v != nil { + var bindingType BindingType + err = json.Unmarshal(*v, &bindingType) + if err != nil { + return err + } + jsfrddp.BindingType = bindingType + } + } + } + + return nil +} + +// JobStorageAccount the properties that are associated with an Azure Storage account with MSI +type JobStorageAccount struct { + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` + // AccountName - The name of the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` + // AccountKey - The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` +} + +// JSONSerialization describes how data from an input is serialized or how data is serialized when written +// to an output in JSON format. +type JSONSerialization struct { + // JSONSerializationProperties - The properties that are associated with the JSON serialization type. Required on PUT (CreateOrReplace) requests. + *JSONSerializationProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeSerialization', 'TypeAvro', 'TypeJSON', 'TypeCsv', 'TypeParquet' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JSONSerialization. +func (js JSONSerialization) MarshalJSON() ([]byte, error) { + js.Type = TypeJSON + objectMap := make(map[string]interface{}) + if js.JSONSerializationProperties != nil { + objectMap["properties"] = js.JSONSerializationProperties + } + if js.Type != "" { + objectMap["type"] = js.Type + } + return json.Marshal(objectMap) +} + +// AsAvroSerialization is the BasicSerialization implementation for JSONSerialization. +func (js JSONSerialization) AsAvroSerialization() (*AvroSerialization, bool) { + return nil, false +} + +// AsJSONSerialization is the BasicSerialization implementation for JSONSerialization. +func (js JSONSerialization) AsJSONSerialization() (*JSONSerialization, bool) { + return &js, true +} + +// AsCsvSerialization is the BasicSerialization implementation for JSONSerialization. +func (js JSONSerialization) AsCsvSerialization() (*CsvSerialization, bool) { + return nil, false +} + +// AsParquetSerialization is the BasicSerialization implementation for JSONSerialization. +func (js JSONSerialization) AsParquetSerialization() (*ParquetSerialization, bool) { + return nil, false +} + +// AsSerialization is the BasicSerialization implementation for JSONSerialization. +func (js JSONSerialization) AsSerialization() (*Serialization, bool) { + return nil, false +} + +// AsBasicSerialization is the BasicSerialization implementation for JSONSerialization. +func (js JSONSerialization) AsBasicSerialization() (BasicSerialization, bool) { + return &js, true +} + +// UnmarshalJSON is the custom unmarshaler for JSONSerialization struct. +func (js *JSONSerialization) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var JSONSerializationProperties JSONSerializationProperties + err = json.Unmarshal(*v, &JSONSerializationProperties) + if err != nil { + return err + } + js.JSONSerializationProperties = &JSONSerializationProperties + } + case "type": + if v != nil { + var typeVar Type + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + js.Type = typeVar + } + } + } + + return nil +} + +// JSONSerializationProperties the properties that are associated with the JSON serialization type. +type JSONSerializationProperties struct { + // Encoding - Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) requests. Possible values include: 'EncodingUTF8' + Encoding Encoding `json:"encoding,omitempty"` + // Format - This property only applies to JSON serialization of outputs only. It is not applicable to inputs. This property specifies the format of the JSON the output will be written in. The currently supported values are 'lineSeparated' indicating the output will be formatted by having each JSON object separated by a new line and 'array' indicating the output will be formatted as an array of JSON objects. Default value is 'lineSeparated' if left null. Possible values include: 'JSONOutputSerializationFormatLineSeparated', 'JSONOutputSerializationFormatArray' + Format JSONOutputSerializationFormat `json:"format,omitempty"` +} + +// OAuthBasedDataSourceProperties the properties that are associated with data sources that use OAuth as +// their authentication model. +type OAuthBasedDataSourceProperties struct { + // RefreshToken - A refresh token that can be used to obtain a valid access token that can then be used to authenticate with the data source. A valid refresh token is currently only obtainable via the Azure Portal. It is recommended to put a dummy string value here when creating the data source and then going to the Azure Portal to authenticate the data source which will update this property with a valid refresh token. Required on PUT (CreateOrReplace) requests. + RefreshToken *string `json:"refreshToken,omitempty"` + // TokenUserPrincipalName - The user principal name (UPN) of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh token. + TokenUserPrincipalName *string `json:"tokenUserPrincipalName,omitempty"` + // TokenUserDisplayName - The user display name of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh token. + TokenUserDisplayName *string `json:"tokenUserDisplayName,omitempty"` +} + +// Operation a Stream Analytics REST API operation +type Operation struct { + // Name - READ-ONLY; The name of the operation being performed on this particular object. + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - READ-ONLY; Contains the localized display information for this particular operation / action. + Display *OperationDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + return json.Marshal(objectMap) +} + +// OperationDisplay contains the localized display information for this particular operation / action. +type OperationDisplay struct { + // Provider - READ-ONLY; The localized friendly form of the resource provider name. + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; The localized friendly form of the resource type related to this action/operation. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The localized friendly name for the operation. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The localized friendly description for the operation. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult result of the request to list Stream Analytics operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Stream Analytics operations supported by the Microsoft.StreamAnalytics resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// Output an output object, containing all information associated with the named output. All outputs are +// contained under a streaming job. +type Output struct { + autorest.Response `json:"-"` + // OutputProperties - The properties that are associated with an output. Required on PUT (CreateOrReplace) requests. + *OutputProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Output. +func (o Output) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.OutputProperties != nil { + objectMap["properties"] = o.OutputProperties + } + if o.Name != nil { + objectMap["name"] = o.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Output struct. +func (o *Output) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var outputProperties OutputProperties + err = json.Unmarshal(*v, &outputProperties) + if err != nil { + return err + } + o.OutputProperties = &outputProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + o.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + o.Type = &typeVar + } + } + } + + return nil +} + +// BasicOutputDataSource describes the data source that output will be written to. +type BasicOutputDataSource interface { + AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) + AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) + AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) + AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) + AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) + AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) + AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) + AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) + AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) + AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) + AsBlobOutputDataSource() (*BlobOutputDataSource, bool) + AsOutputDataSource() (*OutputDataSource, bool) +} + +// OutputDataSource describes the data source that output will be written to. +type OutputDataSource struct { + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +func unmarshalBasicOutputDataSource(body []byte) (BasicOutputDataSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts): + var adlsods AzureDataLakeStoreOutputDataSource + err := json.Unmarshal(body, &adlsods) + return adlsods, err + case string(TypeBasicOutputDataSourceTypePowerBI): + var pbods PowerBIOutputDataSource + err := json.Unmarshal(body, &pbods) + return pbods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic): + var sbtods ServiceBusTopicOutputDataSource + err := json.Unmarshal(body, &sbtods) + return sbtods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue): + var sbqods ServiceBusQueueOutputDataSource + err := json.Unmarshal(body, &sbqods) + return sbqods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB): + var ddods DocumentDbOutputDataSource + err := json.Unmarshal(body, &ddods) + return ddods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse): + var asods AzureSynapseOutputDataSource + err := json.Unmarshal(body, &asods) + return asods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase): + var asdods AzureSQLDatabaseOutputDataSource + err := json.Unmarshal(body, &asdods) + return asdods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub): + var ehvods EventHubV2OutputDataSource + err := json.Unmarshal(body, &ehvods) + return ehvods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub): + var ehods EventHubOutputDataSource + err := json.Unmarshal(body, &ehods) + return ehods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftStorageTable): + var atods AzureTableOutputDataSource + err := json.Unmarshal(body, &atods) + return atods, err + case string(TypeBasicOutputDataSourceTypeMicrosoftStorageBlob): + var bods BlobOutputDataSource + err := json.Unmarshal(body, &bods) + return bods, err + default: + var ods OutputDataSource + err := json.Unmarshal(body, &ods) + return ods, err + } +} +func unmarshalBasicOutputDataSourceArray(body []byte) ([]BasicOutputDataSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + odsArray := make([]BasicOutputDataSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ods, err := unmarshalBasicOutputDataSource(*rawMessage) + if err != nil { + return nil, err + } + odsArray[index] = ods + } + return odsArray, nil +} + +// MarshalJSON is the custom marshaler for OutputDataSource. +func (ods OutputDataSource) MarshalJSON() ([]byte, error) { + ods.Type = TypeBasicOutputDataSourceTypeOutputDataSource + objectMap := make(map[string]interface{}) + if ods.Type != "" { + objectMap["type"] = ods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return &ods, true +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for OutputDataSource. +func (ods OutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &ods, true +} + +// OutputListResult object containing a list of outputs under a streaming job. +type OutputListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of outputs under a streaming job. Populated by a 'List' operation. + Value *[]Output `json:"value,omitempty"` + // NextLink - READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutputListResult. +func (olr OutputListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OutputListResultIterator provides access to a complete listing of Output values. +type OutputListResultIterator struct { + i int + page OutputListResultPage +} + +// 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 *OutputListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputListResultIterator.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 *OutputListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutputListResultIterator) 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 OutputListResultIterator) Response() OutputListResult { + 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 OutputListResultIterator) Value() Output { + if !iter.page.NotDone() { + return Output{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutputListResultIterator type. +func NewOutputListResultIterator(page OutputListResultPage) OutputListResultIterator { + return OutputListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OutputListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OutputListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// outputListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OutputListResult) outputListResultPreparer(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))) +} + +// OutputListResultPage contains a page of Output values. +type OutputListResultPage struct { + fn func(context.Context, OutputListResult) (OutputListResult, error) + olr OutputListResult +} + +// 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 *OutputListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputListResultPage.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 *OutputListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutputListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutputListResultPage) Response() OutputListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutputListResultPage) Values() []Output { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OutputListResultPage type. +func NewOutputListResultPage(cur OutputListResult, getNextPage func(context.Context, OutputListResult) (OutputListResult, error)) OutputListResultPage { + return OutputListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OutputProperties the properties that are associated with an output. +type OutputProperties struct { + // Datasource - Describes the data source that output will be written to. Required on PUT (CreateOrReplace) requests. + Datasource BasicOutputDataSource `json:"datasource,omitempty"` + // TimeWindow - The time frame for filtering Stream Analytics job outputs. + TimeWindow *string `json:"timeWindow,omitempty"` + // SizeWindow - The size window to constrain a Stream Analytics output to. + SizeWindow *float64 `json:"sizeWindow,omitempty"` + // Serialization - Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. + Serialization BasicSerialization `json:"serialization,omitempty"` + // Diagnostics - READ-ONLY; Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + // Etag - READ-ONLY; The current entity tag for the output. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutputProperties. +func (op OutputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["datasource"] = op.Datasource + if op.TimeWindow != nil { + objectMap["timeWindow"] = op.TimeWindow + } + if op.SizeWindow != nil { + objectMap["sizeWindow"] = op.SizeWindow + } + objectMap["serialization"] = op.Serialization + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OutputProperties struct. +func (op *OutputProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "datasource": + if v != nil { + datasource, err := unmarshalBasicOutputDataSource(*v) + if err != nil { + return err + } + op.Datasource = datasource + } + case "timeWindow": + if v != nil { + var timeWindow string + err = json.Unmarshal(*v, &timeWindow) + if err != nil { + return err + } + op.TimeWindow = &timeWindow + } + case "sizeWindow": + if v != nil { + var sizeWindow float64 + err = json.Unmarshal(*v, &sizeWindow) + if err != nil { + return err + } + op.SizeWindow = &sizeWindow + } + case "serialization": + if v != nil { + serialization, err := unmarshalBasicSerialization(*v) + if err != nil { + return err + } + op.Serialization = serialization + } + case "diagnostics": + if v != nil { + var diagnostics Diagnostics + err = json.Unmarshal(*v, &diagnostics) + if err != nil { + return err + } + op.Diagnostics = &diagnostics + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + op.Etag = &etag + } + } + } + + return nil +} + +// OutputsTestFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type OutputsTestFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OutputsClient) (ResourceTestStatus, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OutputsTestFuture) 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 OutputsTestFuture.Result. +func (future *OutputsTestFuture) result(client OutputsClient) (rts ResourceTestStatus, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsTestFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rts.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.OutputsTestFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rts.Response.Response, err = future.GetResult(sender); err == nil && rts.Response.Response.StatusCode != http.StatusNoContent { + rts, err = client.TestResponder(rts.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsTestFuture", "Result", rts.Response.Response, "Failure responding to request") + } + } + return +} + +// ParquetSerialization describes how data from an input is serialized or how data is serialized when +// written to an output in Parquet format. +type ParquetSerialization struct { + // Properties - The properties that are associated with the Parquet serialization type. Required on PUT (CreateOrReplace) requests. + Properties interface{} `json:"properties,omitempty"` + // Type - Possible values include: 'TypeSerialization', 'TypeAvro', 'TypeJSON', 'TypeCsv', 'TypeParquet' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ParquetSerialization. +func (ps ParquetSerialization) MarshalJSON() ([]byte, error) { + ps.Type = TypeParquet + objectMap := make(map[string]interface{}) + if ps.Properties != nil { + objectMap["properties"] = ps.Properties + } + if ps.Type != "" { + objectMap["type"] = ps.Type + } + return json.Marshal(objectMap) +} + +// AsAvroSerialization is the BasicSerialization implementation for ParquetSerialization. +func (ps ParquetSerialization) AsAvroSerialization() (*AvroSerialization, bool) { + return nil, false +} + +// AsJSONSerialization is the BasicSerialization implementation for ParquetSerialization. +func (ps ParquetSerialization) AsJSONSerialization() (*JSONSerialization, bool) { + return nil, false +} + +// AsCsvSerialization is the BasicSerialization implementation for ParquetSerialization. +func (ps ParquetSerialization) AsCsvSerialization() (*CsvSerialization, bool) { + return nil, false +} + +// AsParquetSerialization is the BasicSerialization implementation for ParquetSerialization. +func (ps ParquetSerialization) AsParquetSerialization() (*ParquetSerialization, bool) { + return &ps, true +} + +// AsSerialization is the BasicSerialization implementation for ParquetSerialization. +func (ps ParquetSerialization) AsSerialization() (*Serialization, bool) { + return nil, false +} + +// AsBasicSerialization is the BasicSerialization implementation for ParquetSerialization. +func (ps ParquetSerialization) AsBasicSerialization() (BasicSerialization, bool) { + return &ps, true +} + +// PowerBIOutputDataSource describes a Power BI output data source. +type PowerBIOutputDataSource struct { + // PowerBIOutputDataSourceProperties - The properties that are associated with a Power BI output. Required on PUT (CreateOrReplace) requests. + *PowerBIOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) MarshalJSON() ([]byte, error) { + pbods.Type = TypeBasicOutputDataSourceTypePowerBI + objectMap := make(map[string]interface{}) + if pbods.PowerBIOutputDataSourceProperties != nil { + objectMap["properties"] = pbods.PowerBIOutputDataSourceProperties + } + if pbods.Type != "" { + objectMap["type"] = pbods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return &pbods, true +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for PowerBIOutputDataSource. +func (pbods PowerBIOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &pbods, true +} + +// UnmarshalJSON is the custom unmarshaler for PowerBIOutputDataSource struct. +func (pbods *PowerBIOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var powerBIOutputDataSourceProperties PowerBIOutputDataSourceProperties + err = json.Unmarshal(*v, &powerBIOutputDataSourceProperties) + if err != nil { + return err + } + pbods.PowerBIOutputDataSourceProperties = &powerBIOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pbods.Type = typeVar + } + } + } + + return nil +} + +// PowerBIOutputDataSourceProperties the properties that are associated with a Power BI output. +type PowerBIOutputDataSourceProperties struct { + // Dataset - The name of the Power BI dataset. Required on PUT (CreateOrReplace) requests. + Dataset *string `json:"dataset,omitempty"` + // Table - The name of the Power BI table under the specified dataset. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + // GroupID - The ID of the Power BI group. + GroupID *string `json:"groupId,omitempty"` + // GroupName - The name of the Power BI group. Use this property to help remember which specific Power BI group id was used. + GroupName *string `json:"groupName,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` + // RefreshToken - A refresh token that can be used to obtain a valid access token that can then be used to authenticate with the data source. A valid refresh token is currently only obtainable via the Azure Portal. It is recommended to put a dummy string value here when creating the data source and then going to the Azure Portal to authenticate the data source which will update this property with a valid refresh token. Required on PUT (CreateOrReplace) requests. + RefreshToken *string `json:"refreshToken,omitempty"` + // TokenUserPrincipalName - The user principal name (UPN) of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh token. + TokenUserPrincipalName *string `json:"tokenUserPrincipalName,omitempty"` + // TokenUserDisplayName - The user display name of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh token. + TokenUserDisplayName *string `json:"tokenUserDisplayName,omitempty"` +} + +// PrivateEndpoint complete information about the private endpoint. +type PrivateEndpoint struct { + autorest.Response `json:"-"` + // PrivateEndpointProperties - The properties associated with a private endpoint. + *PrivateEndpointProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; Unique opaque string (generally a GUID) that represents the metadata state of the resource (private endpoint) and changes whenever the resource is updated. Required on PUT (CreateOrUpdate) requests. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PrivateEndpointProperties != nil { + objectMap["properties"] = peVar.PrivateEndpointProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpoint struct. +func (peVar *PrivateEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointProperties PrivateEndpointProperties + err = json.Unmarshal(*v, &privateEndpointProperties) + if err != nil { + return err + } + peVar.PrivateEndpointProperties = &privateEndpointProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peVar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peVar.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointListResult a list of private endpoints. +type PrivateEndpointListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of private endpoints. + Value *[]PrivateEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to fetch the next set of private endpoints. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointListResult. +func (pelr PrivateEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointListResultIterator provides access to a complete listing of PrivateEndpoint values. +type PrivateEndpointListResultIterator struct { + i int + page PrivateEndpointListResultPage +} + +// 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 *PrivateEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultIterator.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 *PrivateEndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointListResultIterator) 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 PrivateEndpointListResultIterator) Response() PrivateEndpointListResult { + 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 PrivateEndpointListResultIterator) Value() PrivateEndpoint { + if !iter.page.NotDone() { + return PrivateEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointListResultIterator type. +func NewPrivateEndpointListResultIterator(page PrivateEndpointListResultPage) PrivateEndpointListResultIterator { + return PrivateEndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pelr PrivateEndpointListResult) IsEmpty() bool { + return pelr.Value == nil || len(*pelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pelr PrivateEndpointListResult) hasNextLink() bool { + return pelr.NextLink != nil && len(*pelr.NextLink) != 0 +} + +// privateEndpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pelr PrivateEndpointListResult) privateEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pelr.NextLink))) +} + +// PrivateEndpointListResultPage contains a page of PrivateEndpoint values. +type PrivateEndpointListResultPage struct { + fn func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error) + pelr PrivateEndpointListResult +} + +// 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 *PrivateEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultPage.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.pelr) + if err != nil { + return err + } + page.pelr = 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 *PrivateEndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointListResultPage) NotDone() bool { + return !page.pelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointListResultPage) Response() PrivateEndpointListResult { + return page.pelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointListResultPage) Values() []PrivateEndpoint { + if page.pelr.IsEmpty() { + return nil + } + return *page.pelr.Value +} + +// Creates a new instance of the PrivateEndpointListResultPage type. +func NewPrivateEndpointListResultPage(cur PrivateEndpointListResult, getNextPage func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error)) PrivateEndpointListResultPage { + return PrivateEndpointListResultPage{ + fn: getNextPage, + pelr: cur, + } +} + +// PrivateEndpointProperties the properties associated with a private endpoint. +type PrivateEndpointProperties struct { + // CreatedDate - READ-ONLY; The date when this private endpoint was created. + CreatedDate *string `json:"createdDate,omitempty"` + // ManualPrivateLinkServiceConnections - A list of connections to the remote resource. Immutable after it is set. + ManualPrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointProperties. +func (pep PrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pep.ManualPrivateLinkServiceConnections != nil { + objectMap["manualPrivateLinkServiceConnections"] = pep.ManualPrivateLinkServiceConnections + } + return json.Marshal(objectMap) +} + +// PrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PrivateEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointsDeleteFuture) 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 PrivateEndpointsDeleteFuture.Result. +func (future *PrivateEndpointsDeleteFuture) result(client PrivateEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.PrivateEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkConnectionState a collection of read-only information about the state of the connection to +// the private remote resource. +type PrivateLinkConnectionState struct { + // Status - READ-ONLY; Indicates whether the connection has been Approved/Rejected/Removed by the owner of the remote resource/service. + Status *string `json:"status,omitempty"` + // Description - READ-ONLY; The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkConnectionState. +func (plcs PrivateLinkConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnection a grouping of information about the connection to the remote resource. +type PrivateLinkServiceConnection struct { + // PrivateLinkServiceConnectionProperties - Bag of properties defining a privatelinkServiceConnection. + *PrivateLinkServiceConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnection. +func (plsc PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsc.PrivateLinkServiceConnectionProperties != nil { + objectMap["properties"] = plsc.PrivateLinkServiceConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceConnection struct. +func (plsc *PrivateLinkServiceConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkServiceConnectionProperties PrivateLinkServiceConnectionProperties + err = json.Unmarshal(*v, &privateLinkServiceConnectionProperties) + if err != nil { + return err + } + plsc.PrivateLinkServiceConnectionProperties = &privateLinkServiceConnectionProperties + } + } + } + + return nil +} + +// PrivateLinkServiceConnectionProperties bag of properties defining a privatelinkServiceConnection. +type PrivateLinkServiceConnectionProperties struct { + // PrivateLinkServiceID - The resource id of the private link service. Required on PUT (CreateOrUpdate) requests. + PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` + // GroupIds - The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. Required on PUT (CreateOrUpdate) requests. + GroupIds *[]string `json:"groupIds,omitempty"` + // RequestMessage - READ-ONLY; A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. + RequestMessage *string `json:"requestMessage,omitempty"` + // PrivateLinkServiceConnectionState - A collection of read-only information about the state of the connection to the private remote resource. + PrivateLinkServiceConnectionState *PrivateLinkConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionProperties. +func (plscp PrivateLinkServiceConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscp.PrivateLinkServiceID != nil { + objectMap["privateLinkServiceId"] = plscp.PrivateLinkServiceID + } + if plscp.GroupIds != nil { + objectMap["groupIds"] = plscp.GroupIds + } + if plscp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = plscp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicReferenceInputDataSource describes an input data source that contains reference data. +type BasicReferenceInputDataSource interface { + AsAzureSQLReferenceInputDataSource() (*AzureSQLReferenceInputDataSource, bool) + AsBlobReferenceInputDataSource() (*BlobReferenceInputDataSource, bool) + AsReferenceInputDataSource() (*ReferenceInputDataSource, bool) +} + +// ReferenceInputDataSource describes an input data source that contains reference data. +type ReferenceInputDataSource struct { + // Type - Possible values include: 'TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource', 'TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicReferenceInputDataSource `json:"type,omitempty"` +} + +func unmarshalBasicReferenceInputDataSource(body []byte) (BasicReferenceInputDataSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicReferenceInputDataSourceTypeMicrosoftSQLServerDatabase): + var asrids AzureSQLReferenceInputDataSource + err := json.Unmarshal(body, &asrids) + return asrids, err + case string(TypeBasicReferenceInputDataSourceTypeMicrosoftStorageBlob): + var brids BlobReferenceInputDataSource + err := json.Unmarshal(body, &brids) + return brids, err + default: + var rids ReferenceInputDataSource + err := json.Unmarshal(body, &rids) + return rids, err + } +} +func unmarshalBasicReferenceInputDataSourceArray(body []byte) ([]BasicReferenceInputDataSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ridsArray := make([]BasicReferenceInputDataSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rids, err := unmarshalBasicReferenceInputDataSource(*rawMessage) + if err != nil { + return nil, err + } + ridsArray[index] = rids + } + return ridsArray, nil +} + +// MarshalJSON is the custom marshaler for ReferenceInputDataSource. +func (rids ReferenceInputDataSource) MarshalJSON() ([]byte, error) { + rids.Type = TypeBasicReferenceInputDataSourceTypeReferenceInputDataSource + objectMap := make(map[string]interface{}) + if rids.Type != "" { + objectMap["type"] = rids.Type + } + return json.Marshal(objectMap) +} + +// AsAzureSQLReferenceInputDataSource is the BasicReferenceInputDataSource implementation for ReferenceInputDataSource. +func (rids ReferenceInputDataSource) AsAzureSQLReferenceInputDataSource() (*AzureSQLReferenceInputDataSource, bool) { + return nil, false +} + +// AsBlobReferenceInputDataSource is the BasicReferenceInputDataSource implementation for ReferenceInputDataSource. +func (rids ReferenceInputDataSource) AsBlobReferenceInputDataSource() (*BlobReferenceInputDataSource, bool) { + return nil, false +} + +// AsReferenceInputDataSource is the BasicReferenceInputDataSource implementation for ReferenceInputDataSource. +func (rids ReferenceInputDataSource) AsReferenceInputDataSource() (*ReferenceInputDataSource, bool) { + return &rids, true +} + +// AsBasicReferenceInputDataSource is the BasicReferenceInputDataSource implementation for ReferenceInputDataSource. +func (rids ReferenceInputDataSource) AsBasicReferenceInputDataSource() (BasicReferenceInputDataSource, bool) { + return &rids, true +} + +// ReferenceInputProperties the properties that are associated with an input containing reference data. +type ReferenceInputProperties struct { + // Datasource - Describes an input data source that contains reference data. Required on PUT (CreateOrReplace) requests. + Datasource BasicReferenceInputDataSource `json:"datasource,omitempty"` + // Serialization - Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. + Serialization BasicSerialization `json:"serialization,omitempty"` + // Diagnostics - READ-ONLY; Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + // Etag - READ-ONLY; The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // Compression - Describes how input data is compressed + Compression *Compression `json:"compression,omitempty"` + // PartitionKey - partitionKey Describes a key in the input data which is used for partitioning the input data + PartitionKey *string `json:"partitionKey,omitempty"` + // Type - Possible values include: 'TypeBasicInputPropertiesTypeInputProperties', 'TypeBasicInputPropertiesTypeReference', 'TypeBasicInputPropertiesTypeStream' + Type TypeBasicInputProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReferenceInputProperties. +func (rip ReferenceInputProperties) MarshalJSON() ([]byte, error) { + rip.Type = TypeBasicInputPropertiesTypeReference + objectMap := make(map[string]interface{}) + objectMap["datasource"] = rip.Datasource + objectMap["serialization"] = rip.Serialization + if rip.Compression != nil { + objectMap["compression"] = rip.Compression + } + if rip.PartitionKey != nil { + objectMap["partitionKey"] = rip.PartitionKey + } + if rip.Type != "" { + objectMap["type"] = rip.Type + } + return json.Marshal(objectMap) +} + +// AsReferenceInputProperties is the BasicInputProperties implementation for ReferenceInputProperties. +func (rip ReferenceInputProperties) AsReferenceInputProperties() (*ReferenceInputProperties, bool) { + return &rip, true +} + +// AsStreamInputProperties is the BasicInputProperties implementation for ReferenceInputProperties. +func (rip ReferenceInputProperties) AsStreamInputProperties() (*StreamInputProperties, bool) { + return nil, false +} + +// AsInputProperties is the BasicInputProperties implementation for ReferenceInputProperties. +func (rip ReferenceInputProperties) AsInputProperties() (*InputProperties, bool) { + return nil, false +} + +// AsBasicInputProperties is the BasicInputProperties implementation for ReferenceInputProperties. +func (rip ReferenceInputProperties) AsBasicInputProperties() (BasicInputProperties, bool) { + return &rip, true +} + +// UnmarshalJSON is the custom unmarshaler for ReferenceInputProperties struct. +func (rip *ReferenceInputProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "datasource": + if v != nil { + datasource, err := unmarshalBasicReferenceInputDataSource(*v) + if err != nil { + return err + } + rip.Datasource = datasource + } + case "serialization": + if v != nil { + serialization, err := unmarshalBasicSerialization(*v) + if err != nil { + return err + } + rip.Serialization = serialization + } + case "diagnostics": + if v != nil { + var diagnostics Diagnostics + err = json.Unmarshal(*v, &diagnostics) + if err != nil { + return err + } + rip.Diagnostics = &diagnostics + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rip.Etag = &etag + } + case "compression": + if v != nil { + var compression Compression + err = json.Unmarshal(*v, &compression) + if err != nil { + return err + } + rip.Compression = &compression + } + case "partitionKey": + if v != nil { + var partitionKey string + err = json.Unmarshal(*v, &partitionKey) + if err != nil { + return err + } + rip.PartitionKey = &partitionKey + } + case "type": + if v != nil { + var typeVar TypeBasicInputProperties + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rip.Type = typeVar + } + } + } + + return nil +} + +// Resource the base resource definition +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceTestStatus describes the status of the test operation along with error information, if +// applicable. +type ResourceTestStatus struct { + autorest.Response `json:"-"` + // Status - READ-ONLY; The status of the test operation. + Status *string `json:"status,omitempty"` + // Error - READ-ONLY; Describes the error that occurred. + Error *ErrorResponse `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceTestStatus. +func (rts ResourceTestStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ScalarFunctionConfiguration describes the configuration of the scalar function. +type ScalarFunctionConfiguration struct { + // Inputs - A list of inputs describing the parameters of the function. + Inputs *[]FunctionInput `json:"inputs,omitempty"` + // Output - The output of the function. + Output *FunctionOutput `json:"output,omitempty"` + // Binding - The physical binding of the function. For example, in the Azure Machine Learning web service’s case, this describes the endpoint. + Binding BasicFunctionBinding `json:"binding,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ScalarFunctionConfiguration struct. +func (sfc *ScalarFunctionConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "inputs": + if v != nil { + var inputs []FunctionInput + err = json.Unmarshal(*v, &inputs) + if err != nil { + return err + } + sfc.Inputs = &inputs + } + case "output": + if v != nil { + var output FunctionOutput + err = json.Unmarshal(*v, &output) + if err != nil { + return err + } + sfc.Output = &output + } + case "binding": + if v != nil { + binding, err := unmarshalBasicFunctionBinding(*v) + if err != nil { + return err + } + sfc.Binding = binding + } + } + } + + return nil +} + +// ScalarFunctionProperties the properties that are associated with a scalar function. +type ScalarFunctionProperties struct { + // ScalarFunctionConfiguration - Describes the configuration of the scalar function. + *ScalarFunctionConfiguration `json:"properties,omitempty"` + // Etag - READ-ONLY; The current entity tag for the function. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // Type - Possible values include: 'TypeBasicFunctionPropertiesTypeFunctionProperties', 'TypeBasicFunctionPropertiesTypeScalar' + Type TypeBasicFunctionProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScalarFunctionProperties. +func (sfp ScalarFunctionProperties) MarshalJSON() ([]byte, error) { + sfp.Type = TypeBasicFunctionPropertiesTypeScalar + objectMap := make(map[string]interface{}) + if sfp.ScalarFunctionConfiguration != nil { + objectMap["properties"] = sfp.ScalarFunctionConfiguration + } + if sfp.Type != "" { + objectMap["type"] = sfp.Type + } + return json.Marshal(objectMap) +} + +// AsScalarFunctionProperties is the BasicFunctionProperties implementation for ScalarFunctionProperties. +func (sfp ScalarFunctionProperties) AsScalarFunctionProperties() (*ScalarFunctionProperties, bool) { + return &sfp, true +} + +// AsFunctionProperties is the BasicFunctionProperties implementation for ScalarFunctionProperties. +func (sfp ScalarFunctionProperties) AsFunctionProperties() (*FunctionProperties, bool) { + return nil, false +} + +// AsBasicFunctionProperties is the BasicFunctionProperties implementation for ScalarFunctionProperties. +func (sfp ScalarFunctionProperties) AsBasicFunctionProperties() (BasicFunctionProperties, bool) { + return &sfp, true +} + +// UnmarshalJSON is the custom unmarshaler for ScalarFunctionProperties struct. +func (sfp *ScalarFunctionProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var scalarFunctionConfiguration ScalarFunctionConfiguration + err = json.Unmarshal(*v, &scalarFunctionConfiguration) + if err != nil { + return err + } + sfp.ScalarFunctionConfiguration = &scalarFunctionConfiguration + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sfp.Etag = &etag + } + case "type": + if v != nil { + var typeVar TypeBasicFunctionProperties + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sfp.Type = typeVar + } + } + } + + return nil +} + +// ScaleStreamingJobParameters parameters supplied to the Scale Streaming Job operation. +type ScaleStreamingJobParameters struct { + // StreamingUnits - Specifies the number of streaming units that the streaming job will scale to. + StreamingUnits *int32 `json:"streamingUnits,omitempty"` +} + +// BasicSerialization describes how data from an input is serialized or how data is serialized when written to an +// output. +type BasicSerialization interface { + AsAvroSerialization() (*AvroSerialization, bool) + AsJSONSerialization() (*JSONSerialization, bool) + AsCsvSerialization() (*CsvSerialization, bool) + AsParquetSerialization() (*ParquetSerialization, bool) + AsSerialization() (*Serialization, bool) +} + +// Serialization describes how data from an input is serialized or how data is serialized when written to an +// output. +type Serialization struct { + // Type - Possible values include: 'TypeSerialization', 'TypeAvro', 'TypeJSON', 'TypeCsv', 'TypeParquet' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicSerialization(body []byte) (BasicSerialization, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeAvro): + var as AvroSerialization + err := json.Unmarshal(body, &as) + return as, err + case string(TypeJSON): + var js JSONSerialization + err := json.Unmarshal(body, &js) + return js, err + case string(TypeCsv): + var cs CsvSerialization + err := json.Unmarshal(body, &cs) + return cs, err + case string(TypeParquet): + var ps ParquetSerialization + err := json.Unmarshal(body, &ps) + return ps, err + default: + var s Serialization + err := json.Unmarshal(body, &s) + return s, err + } +} +func unmarshalBasicSerializationArray(body []byte) ([]BasicSerialization, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sArray := make([]BasicSerialization, len(rawMessages)) + + for index, rawMessage := range rawMessages { + s, err := unmarshalBasicSerialization(*rawMessage) + if err != nil { + return nil, err + } + sArray[index] = s + } + return sArray, nil +} + +// MarshalJSON is the custom marshaler for Serialization. +func (s Serialization) MarshalJSON() ([]byte, error) { + s.Type = TypeSerialization + objectMap := make(map[string]interface{}) + if s.Type != "" { + objectMap["type"] = s.Type + } + return json.Marshal(objectMap) +} + +// AsAvroSerialization is the BasicSerialization implementation for Serialization. +func (s Serialization) AsAvroSerialization() (*AvroSerialization, bool) { + return nil, false +} + +// AsJSONSerialization is the BasicSerialization implementation for Serialization. +func (s Serialization) AsJSONSerialization() (*JSONSerialization, bool) { + return nil, false +} + +// AsCsvSerialization is the BasicSerialization implementation for Serialization. +func (s Serialization) AsCsvSerialization() (*CsvSerialization, bool) { + return nil, false +} + +// AsParquetSerialization is the BasicSerialization implementation for Serialization. +func (s Serialization) AsParquetSerialization() (*ParquetSerialization, bool) { + return nil, false +} + +// AsSerialization is the BasicSerialization implementation for Serialization. +func (s Serialization) AsSerialization() (*Serialization, bool) { + return &s, true +} + +// AsBasicSerialization is the BasicSerialization implementation for Serialization. +func (s Serialization) AsBasicSerialization() (BasicSerialization, bool) { + return &s, true +} + +// ServiceBusDataSourceProperties the common properties that are associated with Service Bus data sources +// (Queues, Topics, Event Hubs, etc.). +type ServiceBusDataSourceProperties struct { + // ServiceBusNamespace - The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// ServiceBusQueueOutputDataSource describes a Service Bus Queue output data source. +type ServiceBusQueueOutputDataSource struct { + // ServiceBusQueueOutputDataSourceProperties - The properties that are associated with a Service Bus Queue output. Required on PUT (CreateOrReplace) requests. + *ServiceBusQueueOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) MarshalJSON() ([]byte, error) { + sbqods.Type = TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue + objectMap := make(map[string]interface{}) + if sbqods.ServiceBusQueueOutputDataSourceProperties != nil { + objectMap["properties"] = sbqods.ServiceBusQueueOutputDataSourceProperties + } + if sbqods.Type != "" { + objectMap["type"] = sbqods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return &sbqods, true +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for ServiceBusQueueOutputDataSource. +func (sbqods ServiceBusQueueOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &sbqods, true +} + +// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueOutputDataSource struct. +func (sbqods *ServiceBusQueueOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceBusQueueOutputDataSourceProperties ServiceBusQueueOutputDataSourceProperties + err = json.Unmarshal(*v, &serviceBusQueueOutputDataSourceProperties) + if err != nil { + return err + } + sbqods.ServiceBusQueueOutputDataSourceProperties = &serviceBusQueueOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sbqods.Type = typeVar + } + } + } + + return nil +} + +// ServiceBusQueueOutputDataSourceProperties the properties that are associated with a Service Bus Queue +// output. +type ServiceBusQueueOutputDataSourceProperties struct { + // QueueName - The name of the Service Bus Queue. Required on PUT (CreateOrReplace) requests. + QueueName *string `json:"queueName,omitempty"` + // PropertyColumns - A string array of the names of output columns to be attached to Service Bus messages as custom properties. + PropertyColumns *[]string `json:"propertyColumns,omitempty"` + // SystemPropertyColumns - The system properties associated with the Service Bus Queue. The following system properties are supported: ReplyToSessionId, ContentType, To, Subject, CorrelationId, TimeToLive, PartitionKey, SessionId, ScheduledEnqueueTime, MessageId, ReplyTo, Label, ScheduledEnqueueTimeUtc. + SystemPropertyColumns interface{} `json:"systemPropertyColumns,omitempty"` + // ServiceBusNamespace - The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// ServiceBusTopicOutputDataSource describes a Service Bus Topic output data source. +type ServiceBusTopicOutputDataSource struct { + // ServiceBusTopicOutputDataSourceProperties - The properties that are associated with a Service Bus Topic output. Required on PUT (CreateOrReplace) requests. + *ServiceBusTopicOutputDataSourceProperties `json:"properties,omitempty"` + // Type - Possible values include: 'TypeBasicOutputDataSourceTypeOutputDataSource', 'TypeBasicOutputDataSourceTypeMicrosoftDataLakeAccounts', 'TypeBasicOutputDataSourceTypePowerBI', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusQueue', 'TypeBasicOutputDataSourceTypeMicrosoftStorageDocumentDB', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDataWarehouse', 'TypeBasicOutputDataSourceTypeMicrosoftSQLServerDatabase', 'TypeBasicOutputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicOutputDataSourceTypeMicrosoftStorageTable', 'TypeBasicOutputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicOutputDataSource `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) MarshalJSON() ([]byte, error) { + sbtods.Type = TypeBasicOutputDataSourceTypeMicrosoftServiceBusTopic + objectMap := make(map[string]interface{}) + if sbtods.ServiceBusTopicOutputDataSourceProperties != nil { + objectMap["properties"] = sbtods.ServiceBusTopicOutputDataSourceProperties + } + if sbtods.Type != "" { + objectMap["type"] = sbtods.Type + } + return json.Marshal(objectMap) +} + +// AsAzureDataLakeStoreOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsAzureDataLakeStoreOutputDataSource() (*AzureDataLakeStoreOutputDataSource, bool) { + return nil, false +} + +// AsPowerBIOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsPowerBIOutputDataSource() (*PowerBIOutputDataSource, bool) { + return nil, false +} + +// AsServiceBusTopicOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsServiceBusTopicOutputDataSource() (*ServiceBusTopicOutputDataSource, bool) { + return &sbtods, true +} + +// AsServiceBusQueueOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsServiceBusQueueOutputDataSource() (*ServiceBusQueueOutputDataSource, bool) { + return nil, false +} + +// AsDocumentDbOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsDocumentDbOutputDataSource() (*DocumentDbOutputDataSource, bool) { + return nil, false +} + +// AsAzureSynapseOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsAzureSynapseOutputDataSource() (*AzureSynapseOutputDataSource, bool) { + return nil, false +} + +// AsAzureSQLDatabaseOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsAzureSQLDatabaseOutputDataSource() (*AzureSQLDatabaseOutputDataSource, bool) { + return nil, false +} + +// AsEventHubV2OutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsEventHubV2OutputDataSource() (*EventHubV2OutputDataSource, bool) { + return nil, false +} + +// AsEventHubOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsEventHubOutputDataSource() (*EventHubOutputDataSource, bool) { + return nil, false +} + +// AsAzureTableOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsAzureTableOutputDataSource() (*AzureTableOutputDataSource, bool) { + return nil, false +} + +// AsBlobOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsBlobOutputDataSource() (*BlobOutputDataSource, bool) { + return nil, false +} + +// AsOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsOutputDataSource() (*OutputDataSource, bool) { + return nil, false +} + +// AsBasicOutputDataSource is the BasicOutputDataSource implementation for ServiceBusTopicOutputDataSource. +func (sbtods ServiceBusTopicOutputDataSource) AsBasicOutputDataSource() (BasicOutputDataSource, bool) { + return &sbtods, true +} + +// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicOutputDataSource struct. +func (sbtods *ServiceBusTopicOutputDataSource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceBusTopicOutputDataSourceProperties ServiceBusTopicOutputDataSourceProperties + err = json.Unmarshal(*v, &serviceBusTopicOutputDataSourceProperties) + if err != nil { + return err + } + sbtods.ServiceBusTopicOutputDataSourceProperties = &serviceBusTopicOutputDataSourceProperties + } + case "type": + if v != nil { + var typeVar TypeBasicOutputDataSource + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sbtods.Type = typeVar + } + } + } + + return nil +} + +// ServiceBusTopicOutputDataSourceProperties the properties that are associated with a Service Bus Topic +// output. +type ServiceBusTopicOutputDataSourceProperties struct { + // TopicName - The name of the Service Bus Topic. Required on PUT (CreateOrReplace) requests. + TopicName *string `json:"topicName,omitempty"` + // PropertyColumns - A string array of the names of output columns to be attached to Service Bus messages as custom properties. + PropertyColumns *[]string `json:"propertyColumns,omitempty"` + // SystemPropertyColumns - The system properties associated with the Service Bus Topic Output. The following system properties are supported: ReplyToSessionId, ContentType, To, Subject, CorrelationId, TimeToLive, PartitionKey, SessionId, ScheduledEnqueueTime, MessageId, ReplyTo, Label, ScheduledEnqueueTimeUtc. + SystemPropertyColumns map[string]*string `json:"systemPropertyColumns"` + // ServiceBusNamespace - The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + // SharedAccessPolicyName - The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` + // SharedAccessPolicyKey - The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + // AuthenticationMode - Authentication Mode. Possible values include: 'AuthenticationModeMsi', 'AuthenticationModeUserToken', 'AuthenticationModeConnectionString' + AuthenticationMode AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceBusTopicOutputDataSourceProperties. +func (sbtodsp ServiceBusTopicOutputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sbtodsp.TopicName != nil { + objectMap["topicName"] = sbtodsp.TopicName + } + if sbtodsp.PropertyColumns != nil { + objectMap["propertyColumns"] = sbtodsp.PropertyColumns + } + if sbtodsp.SystemPropertyColumns != nil { + objectMap["systemPropertyColumns"] = sbtodsp.SystemPropertyColumns + } + if sbtodsp.ServiceBusNamespace != nil { + objectMap["serviceBusNamespace"] = sbtodsp.ServiceBusNamespace + } + if sbtodsp.SharedAccessPolicyName != nil { + objectMap["sharedAccessPolicyName"] = sbtodsp.SharedAccessPolicyName + } + if sbtodsp.SharedAccessPolicyKey != nil { + objectMap["sharedAccessPolicyKey"] = sbtodsp.SharedAccessPolicyKey + } + if sbtodsp.AuthenticationMode != "" { + objectMap["authenticationMode"] = sbtodsp.AuthenticationMode + } + return json.Marshal(objectMap) +} + +// Sku the properties that are associated with a SKU. +type Sku struct { + // Name - The name of the SKU. Required on PUT (CreateOrReplace) requests. Possible values include: 'SkuNameStandard' + Name SkuName `json:"name,omitempty"` +} + +// StartStreamingJobParameters parameters supplied to the Start Streaming Job operation. +type StartStreamingJobParameters struct { + // OutputStartMode - Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the outputStartTime property, or start from the last event output time. Possible values include: 'OutputStartModeJobStartTime', 'OutputStartModeCustomTime', 'OutputStartModeLastOutputEventTime' + OutputStartMode OutputStartMode `json:"outputStartMode,omitempty"` + // OutputStartTime - Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event stream will start whenever the streaming job is started. This property must have a value if outputStartMode is set to CustomTime. + OutputStartTime *date.Time `json:"outputStartTime,omitempty"` +} + +// StorageAccount the properties that are associated with an Azure Storage account +type StorageAccount struct { + // AccountName - The name of the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` + // AccountKey - The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` +} + +// StreamingJob a streaming job object, containing all information associated with the named streaming job. +type StreamingJob struct { + autorest.Response `json:"-"` + // StreamingJobProperties - The properties that are associated with a streaming job. Required on PUT (CreateOrReplace) requests. + *StreamingJobProperties `json:"properties,omitempty"` + // Identity - Describes the system-assigned managed identity assigned to this job that can be used to authenticate with inputs and outputs. + Identity *Identity `json:"identity,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StreamingJob. +func (sj StreamingJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sj.StreamingJobProperties != nil { + objectMap["properties"] = sj.StreamingJobProperties + } + if sj.Identity != nil { + objectMap["identity"] = sj.Identity + } + if sj.Tags != nil { + objectMap["tags"] = sj.Tags + } + if sj.Location != nil { + objectMap["location"] = sj.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StreamingJob struct. +func (sj *StreamingJob) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var streamingJobProperties StreamingJobProperties + err = json.Unmarshal(*v, &streamingJobProperties) + if err != nil { + return err + } + sj.StreamingJobProperties = &streamingJobProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + sj.Identity = &identity + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sj.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sj.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sj.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sj.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sj.Type = &typeVar + } + } + } + + return nil +} + +// StreamingJobListResult object containing a list of streaming jobs. +type StreamingJobListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of streaming jobs. Populated by a 'List' operation. + Value *[]StreamingJob `json:"value,omitempty"` + // NextLink - READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for StreamingJobListResult. +func (sjlr StreamingJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StreamingJobListResultIterator provides access to a complete listing of StreamingJob values. +type StreamingJobListResultIterator struct { + i int + page StreamingJobListResultPage +} + +// 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 *StreamingJobListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobListResultIterator.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 *StreamingJobListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StreamingJobListResultIterator) 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 StreamingJobListResultIterator) Response() StreamingJobListResult { + 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 StreamingJobListResultIterator) Value() StreamingJob { + if !iter.page.NotDone() { + return StreamingJob{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StreamingJobListResultIterator type. +func NewStreamingJobListResultIterator(page StreamingJobListResultPage) StreamingJobListResultIterator { + return StreamingJobListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sjlr StreamingJobListResult) IsEmpty() bool { + return sjlr.Value == nil || len(*sjlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sjlr StreamingJobListResult) hasNextLink() bool { + return sjlr.NextLink != nil && len(*sjlr.NextLink) != 0 +} + +// streamingJobListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sjlr StreamingJobListResult) streamingJobListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sjlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sjlr.NextLink))) +} + +// StreamingJobListResultPage contains a page of StreamingJob values. +type StreamingJobListResultPage struct { + fn func(context.Context, StreamingJobListResult) (StreamingJobListResult, error) + sjlr StreamingJobListResult +} + +// 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 *StreamingJobListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobListResultPage.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.sjlr) + if err != nil { + return err + } + page.sjlr = 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 *StreamingJobListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StreamingJobListResultPage) NotDone() bool { + return !page.sjlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StreamingJobListResultPage) Response() StreamingJobListResult { + return page.sjlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StreamingJobListResultPage) Values() []StreamingJob { + if page.sjlr.IsEmpty() { + return nil + } + return *page.sjlr.Value +} + +// Creates a new instance of the StreamingJobListResultPage type. +func NewStreamingJobListResultPage(cur StreamingJobListResult, getNextPage func(context.Context, StreamingJobListResult) (StreamingJobListResult, error)) StreamingJobListResultPage { + return StreamingJobListResultPage{ + fn: getNextPage, + sjlr: cur, + } +} + +// StreamingJobProperties the properties that are associated with a streaming job. +type StreamingJobProperties struct { + // Sku - Describes the SKU of the streaming job. Required on PUT (CreateOrReplace) requests. + Sku *Sku `json:"sku,omitempty"` + // JobID - READ-ONLY; A GUID uniquely identifying the streaming job. This GUID is generated upon creation of the streaming job. + JobID *string `json:"jobId,omitempty"` + // ProvisioningState - READ-ONLY; Describes the provisioning status of the streaming job. + ProvisioningState *string `json:"provisioningState,omitempty"` + // JobState - READ-ONLY; Describes the state of the streaming job. + JobState *string `json:"jobState,omitempty"` + // JobType - Describes the type of the job. Valid modes are `Cloud` and 'Edge'. Possible values include: 'JobTypeCloud', 'JobTypeEdge' + JobType JobType `json:"jobType,omitempty"` + // OutputStartMode - This property should only be utilized when it is desired that the job be started immediately upon creation. Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the outputStartTime property, or start from the last event output time. Possible values include: 'OutputStartModeJobStartTime', 'OutputStartModeCustomTime', 'OutputStartModeLastOutputEventTime' + OutputStartMode OutputStartMode `json:"outputStartMode,omitempty"` + // OutputStartTime - Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event stream will start whenever the streaming job is started. This property must have a value if outputStartMode is set to CustomTime. + OutputStartTime *date.Time `json:"outputStartTime,omitempty"` + // LastOutputEventTime - READ-ONLY; Value is either an ISO-8601 formatted timestamp indicating the last output event time of the streaming job or null indicating that output has not yet been produced. In case of multiple outputs or multiple streams, this shows the latest value in that set. + LastOutputEventTime *date.Time `json:"lastOutputEventTime,omitempty"` + // EventsOutOfOrderPolicy - Indicates the policy to apply to events that arrive out of order in the input event stream. Possible values include: 'EventsOutOfOrderPolicyAdjust', 'EventsOutOfOrderPolicyDrop' + EventsOutOfOrderPolicy EventsOutOfOrderPolicy `json:"eventsOutOfOrderPolicy,omitempty"` + // OutputErrorPolicy - Indicates the policy to apply to events that arrive at the output and cannot be written to the external storage due to being malformed (missing column values, column values of wrong type or size). Possible values include: 'OutputErrorPolicyStop', 'OutputErrorPolicyDrop' + OutputErrorPolicy OutputErrorPolicy `json:"outputErrorPolicy,omitempty"` + // EventsOutOfOrderMaxDelayInSeconds - The maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. + EventsOutOfOrderMaxDelayInSeconds *int32 `json:"eventsOutOfOrderMaxDelayInSeconds,omitempty"` + // EventsLateArrivalMaxDelayInSeconds - The maximum tolerable delay in seconds where events arriving late could be included. Supported range is -1 to 1814399 (20.23:59:59 days) and -1 is used to specify wait indefinitely. If the property is absent, it is interpreted to have a value of -1. + EventsLateArrivalMaxDelayInSeconds *int32 `json:"eventsLateArrivalMaxDelayInSeconds,omitempty"` + // DataLocale - The data locale of the stream analytics job. Value should be the name of a supported .NET Culture from the set https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx. Defaults to 'en-US' if none specified. + DataLocale *string `json:"dataLocale,omitempty"` + // CompatibilityLevel - Controls certain runtime behaviors of the streaming job. Possible values include: 'CompatibilityLevelOneFullStopZero', 'CompatibilityLevelOneFullStopTwo' + CompatibilityLevel CompatibilityLevel `json:"compatibilityLevel,omitempty"` + // CreatedDate - READ-ONLY; Value is an ISO-8601 formatted UTC timestamp indicating when the streaming job was created. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // Inputs - A list of one or more inputs to the streaming job. The name property for each input is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual input. + Inputs *[]Input `json:"inputs,omitempty"` + // Transformation - Indicates the query and the number of streaming units to use for the streaming job. The name property of the transformation is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. + Transformation *Transformation `json:"transformation,omitempty"` + // Outputs - A list of one or more outputs for the streaming job. The name property for each output is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual output. + Outputs *[]Output `json:"outputs,omitempty"` + // Functions - A list of one or more functions for the streaming job. The name property for each function is required when specifying this property in a PUT request. This property cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. + Functions *[]Function `json:"functions,omitempty"` + // Etag - READ-ONLY; The current entity tag for the streaming job. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // JobStorageAccount - The properties that are associated with an Azure Storage account with MSI + JobStorageAccount *JobStorageAccount `json:"jobStorageAccount,omitempty"` + // ContentStoragePolicy - Valid values are JobStorageAccount and SystemAccount. If set to JobStorageAccount, this requires the user to also specify jobStorageAccount property. Possible values include: 'ContentStoragePolicySystemAccount', 'ContentStoragePolicyJobStorageAccount' + ContentStoragePolicy ContentStoragePolicy `json:"contentStoragePolicy,omitempty"` + // Cluster - The cluster which streaming jobs will run on. + Cluster *ClusterInfo `json:"cluster,omitempty"` +} + +// MarshalJSON is the custom marshaler for StreamingJobProperties. +func (sjp StreamingJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sjp.Sku != nil { + objectMap["sku"] = sjp.Sku + } + if sjp.JobType != "" { + objectMap["jobType"] = sjp.JobType + } + if sjp.OutputStartMode != "" { + objectMap["outputStartMode"] = sjp.OutputStartMode + } + if sjp.OutputStartTime != nil { + objectMap["outputStartTime"] = sjp.OutputStartTime + } + if sjp.EventsOutOfOrderPolicy != "" { + objectMap["eventsOutOfOrderPolicy"] = sjp.EventsOutOfOrderPolicy + } + if sjp.OutputErrorPolicy != "" { + objectMap["outputErrorPolicy"] = sjp.OutputErrorPolicy + } + if sjp.EventsOutOfOrderMaxDelayInSeconds != nil { + objectMap["eventsOutOfOrderMaxDelayInSeconds"] = sjp.EventsOutOfOrderMaxDelayInSeconds + } + if sjp.EventsLateArrivalMaxDelayInSeconds != nil { + objectMap["eventsLateArrivalMaxDelayInSeconds"] = sjp.EventsLateArrivalMaxDelayInSeconds + } + if sjp.DataLocale != nil { + objectMap["dataLocale"] = sjp.DataLocale + } + if sjp.CompatibilityLevel != "" { + objectMap["compatibilityLevel"] = sjp.CompatibilityLevel + } + if sjp.Inputs != nil { + objectMap["inputs"] = sjp.Inputs + } + if sjp.Transformation != nil { + objectMap["transformation"] = sjp.Transformation + } + if sjp.Outputs != nil { + objectMap["outputs"] = sjp.Outputs + } + if sjp.Functions != nil { + objectMap["functions"] = sjp.Functions + } + if sjp.JobStorageAccount != nil { + objectMap["jobStorageAccount"] = sjp.JobStorageAccount + } + if sjp.ContentStoragePolicy != "" { + objectMap["contentStoragePolicy"] = sjp.ContentStoragePolicy + } + if sjp.Cluster != nil { + objectMap["cluster"] = sjp.Cluster + } + return json.Marshal(objectMap) +} + +// StreamingJobsCreateOrReplaceFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StreamingJobsCreateOrReplaceFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StreamingJobsClient) (StreamingJob, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StreamingJobsCreateOrReplaceFuture) 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 StreamingJobsCreateOrReplaceFuture.Result. +func (future *StreamingJobsCreateOrReplaceFuture) result(client StreamingJobsClient) (sj StreamingJob, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsCreateOrReplaceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sj.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.StreamingJobsCreateOrReplaceFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sj.Response.Response, err = future.GetResult(sender); err == nil && sj.Response.Response.StatusCode != http.StatusNoContent { + sj, err = client.CreateOrReplaceResponder(sj.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsCreateOrReplaceFuture", "Result", sj.Response.Response, "Failure responding to request") + } + } + return +} + +// StreamingJobsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StreamingJobsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StreamingJobsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StreamingJobsDeleteFuture) 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 StreamingJobsDeleteFuture.Result. +func (future *StreamingJobsDeleteFuture) result(client StreamingJobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.StreamingJobsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// StreamingJobsScaleFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StreamingJobsScaleFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StreamingJobsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StreamingJobsScaleFuture) 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 StreamingJobsScaleFuture.Result. +func (future *StreamingJobsScaleFuture) result(client StreamingJobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsScaleFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.StreamingJobsScaleFuture") + return + } + ar.Response = future.Response() + return +} + +// StreamingJobsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StreamingJobsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StreamingJobsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StreamingJobsStartFuture) 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 StreamingJobsStartFuture.Result. +func (future *StreamingJobsStartFuture) result(client StreamingJobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.StreamingJobsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// StreamingJobsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StreamingJobsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StreamingJobsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StreamingJobsStopFuture) 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 StreamingJobsStopFuture.Result. +func (future *StreamingJobsStopFuture) result(client StreamingJobsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("streamanalytics.StreamingJobsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// BasicStreamInputDataSource describes an input data source that contains stream data. +type BasicStreamInputDataSource interface { + AsIoTHubStreamInputDataSource() (*IoTHubStreamInputDataSource, bool) + AsEventHubV2StreamInputDataSource() (*EventHubV2StreamInputDataSource, bool) + AsEventHubStreamInputDataSource() (*EventHubStreamInputDataSource, bool) + AsBlobStreamInputDataSource() (*BlobStreamInputDataSource, bool) + AsStreamInputDataSource() (*StreamInputDataSource, bool) +} + +// StreamInputDataSource describes an input data source that contains stream data. +type StreamInputDataSource struct { + // Type - Possible values include: 'TypeBasicStreamInputDataSourceTypeStreamInputDataSource', 'TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs', 'TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub', 'TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob' + Type TypeBasicStreamInputDataSource `json:"type,omitempty"` +} + +func unmarshalBasicStreamInputDataSource(body []byte) (BasicStreamInputDataSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicStreamInputDataSourceTypeMicrosoftDevicesIotHubs): + var ithsids IoTHubStreamInputDataSource + err := json.Unmarshal(body, &ithsids) + return ithsids, err + case string(TypeBasicStreamInputDataSourceTypeMicrosoftEventHubEventHub): + var ehvsids EventHubV2StreamInputDataSource + err := json.Unmarshal(body, &ehvsids) + return ehvsids, err + case string(TypeBasicStreamInputDataSourceTypeMicrosoftServiceBusEventHub): + var ehsids EventHubStreamInputDataSource + err := json.Unmarshal(body, &ehsids) + return ehsids, err + case string(TypeBasicStreamInputDataSourceTypeMicrosoftStorageBlob): + var bsids BlobStreamInputDataSource + err := json.Unmarshal(body, &bsids) + return bsids, err + default: + var sids StreamInputDataSource + err := json.Unmarshal(body, &sids) + return sids, err + } +} +func unmarshalBasicStreamInputDataSourceArray(body []byte) ([]BasicStreamInputDataSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sidsArray := make([]BasicStreamInputDataSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sids, err := unmarshalBasicStreamInputDataSource(*rawMessage) + if err != nil { + return nil, err + } + sidsArray[index] = sids + } + return sidsArray, nil +} + +// MarshalJSON is the custom marshaler for StreamInputDataSource. +func (sids StreamInputDataSource) MarshalJSON() ([]byte, error) { + sids.Type = TypeBasicStreamInputDataSourceTypeStreamInputDataSource + objectMap := make(map[string]interface{}) + if sids.Type != "" { + objectMap["type"] = sids.Type + } + return json.Marshal(objectMap) +} + +// AsIoTHubStreamInputDataSource is the BasicStreamInputDataSource implementation for StreamInputDataSource. +func (sids StreamInputDataSource) AsIoTHubStreamInputDataSource() (*IoTHubStreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubV2StreamInputDataSource is the BasicStreamInputDataSource implementation for StreamInputDataSource. +func (sids StreamInputDataSource) AsEventHubV2StreamInputDataSource() (*EventHubV2StreamInputDataSource, bool) { + return nil, false +} + +// AsEventHubStreamInputDataSource is the BasicStreamInputDataSource implementation for StreamInputDataSource. +func (sids StreamInputDataSource) AsEventHubStreamInputDataSource() (*EventHubStreamInputDataSource, bool) { + return nil, false +} + +// AsBlobStreamInputDataSource is the BasicStreamInputDataSource implementation for StreamInputDataSource. +func (sids StreamInputDataSource) AsBlobStreamInputDataSource() (*BlobStreamInputDataSource, bool) { + return nil, false +} + +// AsStreamInputDataSource is the BasicStreamInputDataSource implementation for StreamInputDataSource. +func (sids StreamInputDataSource) AsStreamInputDataSource() (*StreamInputDataSource, bool) { + return &sids, true +} + +// AsBasicStreamInputDataSource is the BasicStreamInputDataSource implementation for StreamInputDataSource. +func (sids StreamInputDataSource) AsBasicStreamInputDataSource() (BasicStreamInputDataSource, bool) { + return &sids, true +} + +// StreamInputProperties the properties that are associated with an input containing stream data. +type StreamInputProperties struct { + // Datasource - Describes an input data source that contains stream data. Required on PUT (CreateOrReplace) requests. + Datasource BasicStreamInputDataSource `json:"datasource,omitempty"` + // Serialization - Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. + Serialization BasicSerialization `json:"serialization,omitempty"` + // Diagnostics - READ-ONLY; Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. + Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + // Etag - READ-ONLY; The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` + // Compression - Describes how input data is compressed + Compression *Compression `json:"compression,omitempty"` + // PartitionKey - partitionKey Describes a key in the input data which is used for partitioning the input data + PartitionKey *string `json:"partitionKey,omitempty"` + // Type - Possible values include: 'TypeBasicInputPropertiesTypeInputProperties', 'TypeBasicInputPropertiesTypeReference', 'TypeBasicInputPropertiesTypeStream' + Type TypeBasicInputProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StreamInputProperties. +func (sip StreamInputProperties) MarshalJSON() ([]byte, error) { + sip.Type = TypeBasicInputPropertiesTypeStream + objectMap := make(map[string]interface{}) + objectMap["datasource"] = sip.Datasource + objectMap["serialization"] = sip.Serialization + if sip.Compression != nil { + objectMap["compression"] = sip.Compression + } + if sip.PartitionKey != nil { + objectMap["partitionKey"] = sip.PartitionKey + } + if sip.Type != "" { + objectMap["type"] = sip.Type + } + return json.Marshal(objectMap) +} + +// AsReferenceInputProperties is the BasicInputProperties implementation for StreamInputProperties. +func (sip StreamInputProperties) AsReferenceInputProperties() (*ReferenceInputProperties, bool) { + return nil, false +} + +// AsStreamInputProperties is the BasicInputProperties implementation for StreamInputProperties. +func (sip StreamInputProperties) AsStreamInputProperties() (*StreamInputProperties, bool) { + return &sip, true +} + +// AsInputProperties is the BasicInputProperties implementation for StreamInputProperties. +func (sip StreamInputProperties) AsInputProperties() (*InputProperties, bool) { + return nil, false +} + +// AsBasicInputProperties is the BasicInputProperties implementation for StreamInputProperties. +func (sip StreamInputProperties) AsBasicInputProperties() (BasicInputProperties, bool) { + return &sip, true +} + +// UnmarshalJSON is the custom unmarshaler for StreamInputProperties struct. +func (sip *StreamInputProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "datasource": + if v != nil { + datasource, err := unmarshalBasicStreamInputDataSource(*v) + if err != nil { + return err + } + sip.Datasource = datasource + } + case "serialization": + if v != nil { + serialization, err := unmarshalBasicSerialization(*v) + if err != nil { + return err + } + sip.Serialization = serialization + } + case "diagnostics": + if v != nil { + var diagnostics Diagnostics + err = json.Unmarshal(*v, &diagnostics) + if err != nil { + return err + } + sip.Diagnostics = &diagnostics + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sip.Etag = &etag + } + case "compression": + if v != nil { + var compression Compression + err = json.Unmarshal(*v, &compression) + if err != nil { + return err + } + sip.Compression = &compression + } + case "partitionKey": + if v != nil { + var partitionKey string + err = json.Unmarshal(*v, &partitionKey) + if err != nil { + return err + } + sip.PartitionKey = &partitionKey + } + case "type": + if v != nil { + var typeVar TypeBasicInputProperties + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sip.Type = typeVar + } + } + } + + return nil +} + +// SubResource the base sub-resource model definition. +type SubResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubResource. +func (sr SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Name != nil { + objectMap["name"] = sr.Name + } + return json.Marshal(objectMap) +} + +// SubscriptionQuota describes the current quota for the subscription. +type SubscriptionQuota struct { + // SubscriptionQuotaProperties - READ-ONLY; Describes the properties of the quota. + *SubscriptionQuotaProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubscriptionQuota. +func (sq SubscriptionQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sq.Name != nil { + objectMap["name"] = sq.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SubscriptionQuota struct. +func (sq *SubscriptionQuota) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subscriptionQuotaProperties SubscriptionQuotaProperties + err = json.Unmarshal(*v, &subscriptionQuotaProperties) + if err != nil { + return err + } + sq.SubscriptionQuotaProperties = &subscriptionQuotaProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sq.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sq.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sq.Type = &typeVar + } + } + } + + return nil +} + +// SubscriptionQuotaProperties describes the properties of the quota. +type SubscriptionQuotaProperties struct { + // MaxCount - READ-ONLY; The max permitted usage of this resource. + MaxCount *int32 `json:"maxCount,omitempty"` + // CurrentCount - READ-ONLY; The current usage of this resource. + CurrentCount *int32 `json:"currentCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubscriptionQuotaProperties. +func (sq SubscriptionQuotaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SubscriptionQuotasListResult result of the GetQuotas operation. It contains a list of quotas for the +// subscription in a particular region. +type SubscriptionQuotasListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of quotas for the subscription in a particular region. + Value *[]SubscriptionQuota `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubscriptionQuotasListResult. +func (sqlr SubscriptionQuotasListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TrackedResource the resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// Transformation a transformation object, containing all information associated with the named +// transformation. All transformations are contained under a streaming job. +type Transformation struct { + autorest.Response `json:"-"` + // TransformationProperties - The properties that are associated with a transformation. Required on PUT (CreateOrReplace) requests. + *TransformationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Transformation. +func (t Transformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TransformationProperties != nil { + objectMap["properties"] = t.TransformationProperties + } + if t.Name != nil { + objectMap["name"] = t.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Transformation struct. +func (t *Transformation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var transformationProperties TransformationProperties + err = json.Unmarshal(*v, &transformationProperties) + if err != nil { + return err + } + t.TransformationProperties = &transformationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + t.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + t.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + t.Type = &typeVar + } + } + } + + return nil +} + +// TransformationProperties the properties that are associated with a transformation. +type TransformationProperties struct { + // StreamingUnits - Specifies the number of streaming units that the streaming job uses. + StreamingUnits *int32 `json:"streamingUnits,omitempty"` + // ValidStreamingUnits - Specifies the valid streaming units a streaming job can scale to. + ValidStreamingUnits *[]int32 `json:"validStreamingUnits,omitempty"` + // Query - Specifies the query that will be run in the streaming job. You can learn more about the Stream Analytics Query Language (SAQL) here: https://msdn.microsoft.com/library/azure/dn834998 . Required on PUT (CreateOrReplace) requests. + Query *string `json:"query,omitempty"` + // Etag - READ-ONLY; The current entity tag for the transformation. This is an opaque string. You can use it to detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for TransformationProperties. +func (tp TransformationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.StreamingUnits != nil { + objectMap["streamingUnits"] = tp.StreamingUnits + } + if tp.ValidStreamingUnits != nil { + objectMap["validStreamingUnits"] = tp.ValidStreamingUnits + } + if tp.Query != nil { + objectMap["query"] = tp.Query + } + return json.Marshal(objectMap) +} diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/operations.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/operations.go new file mode 100644 index 000000000000..c15a5b378f98 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/operations.go @@ -0,0 +1,140 @@ +package streamanalytics + +// 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 stream Analytics Client +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 lists all of the available Stream Analytics related operations. +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, "streamanalytics.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, "streamanalytics.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.StreamAnalytics/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.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, "streamanalytics.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.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/streamanalytics/mgmt/2020-03-01/streamanalytics/outputs.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/outputs.go new file mode 100644 index 000000000000..39500f66c3ab --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/outputs.go @@ -0,0 +1,646 @@ +package streamanalytics + +// 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" +) + +// OutputsClient is the stream Analytics Client +type OutputsClient struct { + BaseClient +} + +// NewOutputsClient creates an instance of the OutputsClient client. +func NewOutputsClient(subscriptionID string) OutputsClient { + return NewOutputsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOutputsClientWithBaseURI creates an instance of the OutputsClient 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 NewOutputsClientWithBaseURI(baseURI string, subscriptionID string) OutputsClient { + return OutputsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates an output or replaces an already existing output under an existing streaming job. +// Parameters: +// output - the definition of the output that will be used to create a new output or replace the existing one +// under the streaming job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// outputName - the name of the output. +// ifMatch - the ETag of the output. Omit this value to always overwrite the current output. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new output to be created, but to prevent updating an existing output. +// Other values will result in a 412 Pre-condition Failed response. +func (client OutputsClient) CreateOrReplace(ctx context.Context, output Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (result Output, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.CreateOrReplace") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.OutputsClient", "CreateOrReplace", err.Error()) + } + + req, err := client.CreateOrReplacePreparer(ctx, output, resourceGroupName, jobName, outputName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client OutputsClient) CreateOrReplacePreparer(ctx context.Context, output Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters), + autorest.WithJSON(output), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client OutputsClient) CreateOrReplaceResponder(resp *http.Response) (result Output, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an output from the streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// outputName - the name of the output. +func (client OutputsClient) Delete(ctx context.Context, resourceGroupName string, jobName string, outputName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.OutputsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, jobName, outputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OutputsClient) DeletePreparer(ctx context.Context, resourceGroupName string, jobName string, outputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", 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 OutputsClient) 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 OutputsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details about the specified output. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// outputName - the name of the output. +func (client OutputsClient) Get(ctx context.Context, resourceGroupName string, jobName string, outputName string) (result Output, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.OutputsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, jobName, outputName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OutputsClient) GetPreparer(ctx context.Context, resourceGroupName string, jobName string, outputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", 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 OutputsClient) 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 OutputsClient) GetResponder(resp *http.Response) (result Output, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStreamingJob lists all of the outputs under the specified streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// selectParameter - the $select OData query parameter. This is a comma-separated list of structural properties +// to include in the response, or "*" to include all properties. By default, all properties are returned except +// diagnostics. Currently only accepts '*' as a valid value. +func (client OutputsClient) ListByStreamingJob(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result OutputListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.ListByStreamingJob") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.OutputsClient", "ListByStreamingJob", err.Error()) + } + + result.fn = client.listByStreamingJobNextResults + req, err := client.ListByStreamingJobPreparer(ctx, resourceGroupName, jobName, selectParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure sending request") + return + } + + result.olr, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByStreamingJobPreparer prepares the ListByStreamingJob request. +func (client OutputsClient) ListByStreamingJobPreparer(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(selectParameter) > 0 { + queryParameters["$select"] = autorest.Encode("query", selectParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always +// closes the http.Response Body. +func (client OutputsClient) ListByStreamingJobResponder(resp *http.Response) (result OutputListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByStreamingJobNextResults retrieves the next set of results, if any. +func (client OutputsClient) listByStreamingJobNextResults(ctx context.Context, lastResults OutputListResult) (result OutputListResult, err error) { + req, err := lastResults.outputListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "listByStreamingJobNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByStreamingJobSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "listByStreamingJobNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByStreamingJobResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "listByStreamingJobNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByStreamingJobComplete enumerates all values, automatically crossing page boundaries as required. +func (client OutputsClient) ListByStreamingJobComplete(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result OutputListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.ListByStreamingJob") + 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.ListByStreamingJob(ctx, resourceGroupName, jobName, selectParameter) + return +} + +// Test tests whether an output’s datasource is reachable and usable by the Azure Stream Analytics service. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// outputName - the name of the output. +// output - if the output specified does not already exist, this parameter must contain the full output +// definition intended to be tested. If the output specified already exists, this parameter can be left null to +// test the existing output as is or if specified, the properties specified will overwrite the corresponding +// properties in the existing output (exactly like a PATCH operation) and the resulting output will be tested. +func (client OutputsClient) Test(ctx context.Context, resourceGroupName string, jobName string, outputName string, output *Output) (result OutputsTestFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.Test") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.OutputsClient", "Test", err.Error()) + } + + req, err := client.TestPreparer(ctx, resourceGroupName, jobName, outputName, output) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", nil, "Failure preparing request") + return + } + + result, err = client.TestSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", result.Response(), "Failure sending request") + return + } + + return +} + +// TestPreparer prepares the Test request. +func (client OutputsClient) TestPreparer(ctx context.Context, resourceGroupName string, jobName string, outputName string, output *Output) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if output != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(output)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TestSender sends the Test request. The method will close the +// http.Response Body if it receives an error. +func (client OutputsClient) TestSender(req *http.Request) (future OutputsTestFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// TestResponder handles the response to the Test request. The method always +// closes the http.Response Body. +func (client OutputsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing output under an existing streaming job. This can be used to partially update (ie. update +// one or two properties) an output without affecting the rest the job or output definition. +// Parameters: +// output - an Output object. The properties specified here will overwrite the corresponding properties in the +// existing output (ie. Those properties will be updated). Any properties that are set to null here will mean +// that the corresponding property in the existing output will remain the same and not change as a result of +// this PATCH operation. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// outputName - the name of the output. +// ifMatch - the ETag of the output. Omit this value to always overwrite the current output. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client OutputsClient) Update(ctx context.Context, output Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (result Output, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutputsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.OutputsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, output, resourceGroupName, jobName, outputName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OutputsClient) UpdatePreparer(ctx context.Context, output Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "outputName": autorest.Encode("path", outputName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters), + autorest.WithJSON(output), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 OutputsClient) 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 OutputsClient) UpdateResponder(resp *http.Response) (result Output, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/privateendpoints.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/privateendpoints.go new file mode 100644 index 000000000000..2bf145f36507 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/privateendpoints.go @@ -0,0 +1,444 @@ +package streamanalytics + +// 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" +) + +// PrivateEndpointsClient is the stream Analytics Client +type PrivateEndpointsClient struct { + BaseClient +} + +// NewPrivateEndpointsClient creates an instance of the PrivateEndpointsClient client. +func NewPrivateEndpointsClient(subscriptionID string) PrivateEndpointsClient { + return NewPrivateEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointsClientWithBaseURI creates an instance of the PrivateEndpointsClient 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 NewPrivateEndpointsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointsClient { + return PrivateEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a Stream Analytics Private Endpoint or replaces an already existing Private Endpoint. +// Parameters: +// privateEndpoint - the definition of the private endpoint that will be used to create a new cluster or +// replace the existing one. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// privateEndpointName - the name of the private endpoint. +// ifMatch - the ETag of the resource. Omit this value to always overwrite the current record set. Specify the +// last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new resource to be created, but to prevent updating an existing record +// set. Other values will result in a 412 Pre-condition Failed response. +func (client PrivateEndpointsClient) CreateOrUpdate(ctx context.Context, privateEndpoint PrivateEndpoint, resourceGroupName string, clusterName string, privateEndpointName string, ifMatch string, ifNoneMatch string) (result PrivateEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.PrivateEndpointsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, privateEndpoint, resourceGroupName, clusterName, privateEndpointName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, privateEndpoint PrivateEndpoint, resourceGroupName string, clusterName string, privateEndpointName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + privateEndpoint.Etag = 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.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}", pathParameters), + autorest.WithJSON(privateEndpoint), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + 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 PrivateEndpointsClient) 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 PrivateEndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpoint, 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 delete the specified private endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// privateEndpointName - the name of the private endpoint. +func (client PrivateEndpointsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string) (result PrivateEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.PrivateEndpointsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, privateEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}", 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 PrivateEndpointsClient) DeleteSender(req *http.Request) (future PrivateEndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified Private Endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +// privateEndpointName - the name of the private endpoint. +func (client PrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string) (result PrivateEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.PrivateEndpointsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, privateEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}", 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 PrivateEndpointsClient) 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 PrivateEndpointsClient) GetResponder(resp *http.Response) (result PrivateEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster lists the private endpoints in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the cluster. +func (client PrivateEndpointsClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateEndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.ListByCluster") + defer func() { + sc := -1 + if result.pelr.Response.Response != nil { + sc = result.pelr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.PrivateEndpointsClient", "ListByCluster", err.Error()) + } + + result.fn = client.listByClusterNextResults + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.pelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "ListByCluster", resp, "Failure sending request") + return + } + + result.pelr, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "ListByCluster", resp, "Failure responding to request") + return + } + if result.pelr.hasNextLink() && result.pelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client PrivateEndpointsClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/clusters/{clusterName}/privateEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointsClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) ListByClusterResponder(resp *http.Response) (result PrivateEndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByClusterNextResults retrieves the next set of results, if any. +func (client PrivateEndpointsClient) listByClusterNextResults(ctx context.Context, lastResults PrivateEndpointListResult) (result PrivateEndpointListResult, err error) { + req, err := lastResults.privateEndpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "listByClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "listByClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.PrivateEndpointsClient", "listByClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointsClient) ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateEndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.ListByCluster") + 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.ListByCluster(ctx, resourceGroupName, clusterName) + return +} diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamanalyticsapi/interfaces.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamanalyticsapi/interfaces.go new file mode 100644 index 000000000000..b7defb0cf56f --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamanalyticsapi/interfaces.go @@ -0,0 +1,121 @@ +package streamanalyticsapi + +// 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/streamanalytics/mgmt/2020-03-01/streamanalytics" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result streamanalytics.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result streamanalytics.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*streamanalytics.OperationsClient)(nil) + +// StreamingJobsClientAPI contains the set of methods on the StreamingJobsClient type. +type StreamingJobsClientAPI interface { + CreateOrReplace(ctx context.Context, streamingJob streamanalytics.StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string) (result streamanalytics.StreamingJobsCreateOrReplaceFuture, err error) + Delete(ctx context.Context, resourceGroupName string, jobName string) (result streamanalytics.StreamingJobsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, jobName string, expand string) (result streamanalytics.StreamingJob, err error) + List(ctx context.Context, expand string) (result streamanalytics.StreamingJobListResultPage, err error) + ListComplete(ctx context.Context, expand string) (result streamanalytics.StreamingJobListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result streamanalytics.StreamingJobListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result streamanalytics.StreamingJobListResultIterator, err error) + Scale(ctx context.Context, resourceGroupName string, jobName string, scaleJobParameters *streamanalytics.ScaleStreamingJobParameters) (result streamanalytics.StreamingJobsScaleFuture, err error) + Start(ctx context.Context, resourceGroupName string, jobName string, startJobParameters *streamanalytics.StartStreamingJobParameters) (result streamanalytics.StreamingJobsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, jobName string) (result streamanalytics.StreamingJobsStopFuture, err error) + Update(ctx context.Context, streamingJob streamanalytics.StreamingJob, resourceGroupName string, jobName string, ifMatch string) (result streamanalytics.StreamingJob, err error) +} + +var _ StreamingJobsClientAPI = (*streamanalytics.StreamingJobsClient)(nil) + +// InputsClientAPI contains the set of methods on the InputsClient type. +type InputsClientAPI interface { + CreateOrReplace(ctx context.Context, input streamanalytics.Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (result streamanalytics.Input, err error) + Delete(ctx context.Context, resourceGroupName string, jobName string, inputName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, jobName string, inputName string) (result streamanalytics.Input, err error) + ListByStreamingJob(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result streamanalytics.InputListResultPage, err error) + ListByStreamingJobComplete(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result streamanalytics.InputListResultIterator, err error) + Test(ctx context.Context, resourceGroupName string, jobName string, inputName string, input *streamanalytics.Input) (result streamanalytics.InputsTestFuture, err error) + Update(ctx context.Context, input streamanalytics.Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (result streamanalytics.Input, err error) +} + +var _ InputsClientAPI = (*streamanalytics.InputsClient)(nil) + +// OutputsClientAPI contains the set of methods on the OutputsClient type. +type OutputsClientAPI interface { + CreateOrReplace(ctx context.Context, output streamanalytics.Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (result streamanalytics.Output, err error) + Delete(ctx context.Context, resourceGroupName string, jobName string, outputName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, jobName string, outputName string) (result streamanalytics.Output, err error) + ListByStreamingJob(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result streamanalytics.OutputListResultPage, err error) + ListByStreamingJobComplete(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result streamanalytics.OutputListResultIterator, err error) + Test(ctx context.Context, resourceGroupName string, jobName string, outputName string, output *streamanalytics.Output) (result streamanalytics.OutputsTestFuture, err error) + Update(ctx context.Context, output streamanalytics.Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (result streamanalytics.Output, err error) +} + +var _ OutputsClientAPI = (*streamanalytics.OutputsClient)(nil) + +// TransformationsClientAPI contains the set of methods on the TransformationsClient type. +type TransformationsClientAPI interface { + CreateOrReplace(ctx context.Context, transformation streamanalytics.Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (result streamanalytics.Transformation, err error) + Get(ctx context.Context, resourceGroupName string, jobName string, transformationName string) (result streamanalytics.Transformation, err error) + Update(ctx context.Context, transformation streamanalytics.Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (result streamanalytics.Transformation, err error) +} + +var _ TransformationsClientAPI = (*streamanalytics.TransformationsClient)(nil) + +// FunctionsClientAPI contains the set of methods on the FunctionsClient type. +type FunctionsClientAPI interface { + CreateOrReplace(ctx context.Context, function streamanalytics.Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (result streamanalytics.Function, err error) + Delete(ctx context.Context, resourceGroupName string, jobName string, functionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, jobName string, functionName string) (result streamanalytics.Function, err error) + ListByStreamingJob(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result streamanalytics.FunctionListResultPage, err error) + ListByStreamingJobComplete(ctx context.Context, resourceGroupName string, jobName string, selectParameter string) (result streamanalytics.FunctionListResultIterator, err error) + RetrieveDefaultDefinition(ctx context.Context, resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *streamanalytics.BasicFunctionRetrieveDefaultDefinitionParameters) (result streamanalytics.Function, err error) + Test(ctx context.Context, resourceGroupName string, jobName string, functionName string, function *streamanalytics.Function) (result streamanalytics.FunctionsTestFuture, err error) + Update(ctx context.Context, function streamanalytics.Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (result streamanalytics.Function, err error) +} + +var _ FunctionsClientAPI = (*streamanalytics.FunctionsClient)(nil) + +// SubscriptionsClientAPI contains the set of methods on the SubscriptionsClient type. +type SubscriptionsClientAPI interface { + ListQuotas(ctx context.Context, location string) (result streamanalytics.SubscriptionQuotasListResult, err error) +} + +var _ SubscriptionsClientAPI = (*streamanalytics.SubscriptionsClient)(nil) + +// ClustersClientAPI contains the set of methods on the ClustersClient type. +type ClustersClientAPI interface { + CreateOrUpdate(ctx context.Context, cluster streamanalytics.Cluster, resourceGroupName string, clusterName string, ifMatch string, ifNoneMatch string) (result streamanalytics.ClustersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string) (result streamanalytics.ClustersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string) (result streamanalytics.Cluster, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result streamanalytics.ClusterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result streamanalytics.ClusterListResultIterator, err error) + ListBySubscription(ctx context.Context) (result streamanalytics.ClusterListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result streamanalytics.ClusterListResultIterator, err error) + ListStreamingJobs(ctx context.Context, resourceGroupName string, clusterName string) (result streamanalytics.ClusterJobListResultPage, err error) + ListStreamingJobsComplete(ctx context.Context, resourceGroupName string, clusterName string) (result streamanalytics.ClusterJobListResultIterator, err error) + Update(ctx context.Context, cluster streamanalytics.Cluster, resourceGroupName string, clusterName string, ifMatch string) (result streamanalytics.ClustersUpdateFuture, err error) +} + +var _ ClustersClientAPI = (*streamanalytics.ClustersClient)(nil) + +// PrivateEndpointsClientAPI contains the set of methods on the PrivateEndpointsClient type. +type PrivateEndpointsClientAPI interface { + CreateOrUpdate(ctx context.Context, privateEndpoint streamanalytics.PrivateEndpoint, resourceGroupName string, clusterName string, privateEndpointName string, ifMatch string, ifNoneMatch string) (result streamanalytics.PrivateEndpoint, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string) (result streamanalytics.PrivateEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string) (result streamanalytics.PrivateEndpoint, err error) + ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result streamanalytics.PrivateEndpointListResultPage, err error) + ListByClusterComplete(ctx context.Context, resourceGroupName string, clusterName string) (result streamanalytics.PrivateEndpointListResultIterator, err error) +} + +var _ PrivateEndpointsClientAPI = (*streamanalytics.PrivateEndpointsClient)(nil) diff --git a/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamingjobs.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamingjobs.go new file mode 100644 index 000000000000..4d8ffbfb9c9b --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/streamingjobs.go @@ -0,0 +1,954 @@ +package streamanalytics + +// 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" +) + +// StreamingJobsClient is the stream Analytics Client +type StreamingJobsClient struct { + BaseClient +} + +// NewStreamingJobsClient creates an instance of the StreamingJobsClient client. +func NewStreamingJobsClient(subscriptionID string) StreamingJobsClient { + return NewStreamingJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStreamingJobsClientWithBaseURI creates an instance of the StreamingJobsClient 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 NewStreamingJobsClientWithBaseURI(baseURI string, subscriptionID string) StreamingJobsClient { + return StreamingJobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates a streaming job or replaces an already existing streaming job. +// Parameters: +// streamingJob - the definition of the streaming job that will be used to create a new streaming job or +// replace the existing one. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// ifMatch - the ETag of the streaming job. Omit this value to always overwrite the current record set. Specify +// the last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new streaming job to be created, but to prevent updating an existing +// record set. Other values will result in a 412 Pre-condition Failed response. +func (client StreamingJobsClient) CreateOrReplace(ctx context.Context, streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string) (result StreamingJobsCreateOrReplaceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.CreateOrReplace") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "CreateOrReplace", err.Error()) + } + + req, err := client.CreateOrReplacePreparer(ctx, streamingJob, resourceGroupName, jobName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrReplaceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client StreamingJobsClient) CreateOrReplacePreparer(ctx context.Context, streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}", pathParameters), + autorest.WithJSON(streamingJob), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client StreamingJobsClient) CreateOrReplaceSender(req *http.Request) (future StreamingJobsCreateOrReplaceFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) CreateOrReplaceResponder(resp *http.Response) (result StreamingJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +func (client StreamingJobsClient) Delete(ctx context.Context, resourceGroupName string, jobName string) (result StreamingJobsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client StreamingJobsClient) DeletePreparer(ctx context.Context, resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}", 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 StreamingJobsClient) DeleteSender(req *http.Request) (future StreamingJobsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details about the specified streaming job. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// expand - the $expand OData query parameter. This is a comma-separated list of additional streaming job +// properties to include in the response, beyond the default set returned when this parameter is absent. The +// default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and +// 'functions'. +func (client StreamingJobsClient) Get(ctx context.Context, resourceGroupName string, jobName string, expand string) (result StreamingJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, jobName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client StreamingJobsClient) GetPreparer(ctx context.Context, resourceGroupName string, jobName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}", 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 StreamingJobsClient) 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 StreamingJobsClient) GetResponder(resp *http.Response) (result StreamingJob, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the streaming jobs in the given subscription. +// Parameters: +// expand - the $expand OData query parameter. This is a comma-separated list of additional streaming job +// properties to include in the response, beyond the default set returned when this parameter is absent. The +// default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and +// 'functions'. +func (client StreamingJobsClient) List(ctx context.Context, expand string) (result StreamingJobListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.List") + defer func() { + sc := -1 + if result.sjlr.Response.Response != nil { + sc = result.sjlr.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("streamanalytics.StreamingJobsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sjlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure sending request") + return + } + + result.sjlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure responding to request") + return + } + if result.sjlr.hasNextLink() && result.sjlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client StreamingJobsClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs", 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 StreamingJobsClient) 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 StreamingJobsClient) ListResponder(resp *http.Response) (result StreamingJobListResult, 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 StreamingJobsClient) listNextResults(ctx context.Context, lastResults StreamingJobListResult) (result StreamingJobListResult, err error) { + req, err := lastResults.streamingJobListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "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, "streamanalytics.StreamingJobsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client StreamingJobsClient) ListComplete(ctx context.Context, expand string) (result StreamingJobListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.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, expand) + return +} + +// ListByResourceGroup lists all of the streaming jobs in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// expand - the $expand OData query parameter. This is a comma-separated list of additional streaming job +// properties to include in the response, beyond the default set returned when this parameter is absent. The +// default set is all streaming job properties other than 'inputs', 'transformation', 'outputs', and +// 'functions'. +func (client StreamingJobsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result StreamingJobListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.sjlr.Response.Response != nil { + sc = result.sjlr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.sjlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.sjlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.sjlr.hasNextLink() && result.sjlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client StreamingJobsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs", 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 StreamingJobsClient) 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 StreamingJobsClient) ListByResourceGroupResponder(resp *http.Response) (result StreamingJobListResult, 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 StreamingJobsClient) listByResourceGroupNextResults(ctx context.Context, lastResults StreamingJobListResult) (result StreamingJobListResult, err error) { + req, err := lastResults.streamingJobListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "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, "streamanalytics.StreamingJobsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client StreamingJobsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result StreamingJobListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.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, expand) + return +} + +// Scale scales a streaming job when the job is running. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// scaleJobParameters - parameters applicable to a scale streaming job operation. +func (client StreamingJobsClient) Scale(ctx context.Context, resourceGroupName string, jobName string, scaleJobParameters *ScaleStreamingJobParameters) (result StreamingJobsScaleFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.Scale") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "Scale", err.Error()) + } + + req, err := client.ScalePreparer(ctx, resourceGroupName, jobName, scaleJobParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Scale", nil, "Failure preparing request") + return + } + + result, err = client.ScaleSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Scale", result.Response(), "Failure sending request") + return + } + + return +} + +// ScalePreparer prepares the Scale request. +func (client StreamingJobsClient) ScalePreparer(ctx context.Context, resourceGroupName string, jobName string, scaleJobParameters *ScaleStreamingJobParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/scale", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if scaleJobParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(scaleJobParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ScaleSender sends the Scale request. The method will close the +// http.Response Body if it receives an error. +func (client StreamingJobsClient) ScaleSender(req *http.Request) (future StreamingJobsScaleFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ScaleResponder handles the response to the Scale request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) ScaleResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts a streaming job. Once a job is started it will start processing input events and produce output. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// startJobParameters - parameters applicable to a start streaming job operation. +func (client StreamingJobsClient) Start(ctx context.Context, resourceGroupName string, jobName string, startJobParameters *StartStreamingJobParameters) (result StreamingJobsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.Start") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, jobName, startJobParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client StreamingJobsClient) StartPreparer(ctx context.Context, resourceGroupName string, jobName string, startJobParameters *StartStreamingJobParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if startJobParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(startJobParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client StreamingJobsClient) StartSender(req *http.Request) (future StreamingJobsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops a running streaming job. This will cause a running streaming job to stop processing input events and +// producing output. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +func (client StreamingJobsClient) Stop(ctx context.Context, resourceGroupName string, jobName string) (result StreamingJobsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.Stop") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, jobName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client StreamingJobsClient) StopPreparer(ctx context.Context, resourceGroupName string, jobName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client StreamingJobsClient) StopSender(req *http.Request) (future StreamingJobsStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client StreamingJobsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates an existing streaming job. This can be used to partially update (ie. update one or two properties) a +// streaming job without affecting the rest the job definition. +// Parameters: +// streamingJob - a streaming job object. The properties specified here will overwrite the corresponding +// properties in the existing streaming job (ie. Those properties will be updated). Any properties that are set +// to null here will mean that the corresponding property in the existing input will remain the same and not +// change as a result of this PATCH operation. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// ifMatch - the ETag of the streaming job. Omit this value to always overwrite the current record set. Specify +// the last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client StreamingJobsClient) Update(ctx context.Context, streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string) (result StreamingJob, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StreamingJobsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.StreamingJobsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, streamingJob, resourceGroupName, jobName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client StreamingJobsClient) UpdatePreparer(ctx context.Context, streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}", pathParameters), + autorest.WithJSON(streamingJob), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 StreamingJobsClient) 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 StreamingJobsClient) UpdateResponder(resp *http.Response) (result StreamingJob, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/subscriptions.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/subscriptions.go new file mode 100644 index 000000000000..13f52ef9e8cc --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/subscriptions.go @@ -0,0 +1,113 @@ +package streamanalytics + +// 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" +) + +// SubscriptionsClient is the stream Analytics Client +type SubscriptionsClient struct { + BaseClient +} + +// NewSubscriptionsClient creates an instance of the SubscriptionsClient client. +func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { + return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionsClientWithBaseURI creates an instance of the SubscriptionsClient 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 NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { + return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListQuotas retrieves the subscription's current quota information in a particular region. +// Parameters: +// location - the region in which to retrieve the subscription's quota information. You can find out which +// regions Azure Stream Analytics is supported in here: https://azure.microsoft.com/en-us/regions/ +func (client SubscriptionsClient) ListQuotas(ctx context.Context, location string) (result SubscriptionQuotasListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListQuotas") + 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}}}}); err != nil { + return result, validation.NewError("streamanalytics.SubscriptionsClient", "ListQuotas", err.Error()) + } + + req, err := client.ListQuotasPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", nil, "Failure preparing request") + return + } + + resp, err := client.ListQuotasSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", resp, "Failure sending request") + return + } + + result, err = client.ListQuotasResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", resp, "Failure responding to request") + return + } + + return +} + +// ListQuotasPreparer prepares the ListQuotas request. +func (client SubscriptionsClient) ListQuotasPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListQuotasSender sends the ListQuotas request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListQuotasSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListQuotasResponder handles the response to the ListQuotas request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListQuotasResponder(resp *http.Response) (result SubscriptionQuotasListResult, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/transformations.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/transformations.go new file mode 100644 index 000000000000..1a80cd882cc0 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/transformations.go @@ -0,0 +1,326 @@ +package streamanalytics + +// 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" +) + +// TransformationsClient is the stream Analytics Client +type TransformationsClient struct { + BaseClient +} + +// NewTransformationsClient creates an instance of the TransformationsClient client. +func NewTransformationsClient(subscriptionID string) TransformationsClient { + return NewTransformationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTransformationsClientWithBaseURI creates an instance of the TransformationsClient 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 NewTransformationsClientWithBaseURI(baseURI string, subscriptionID string) TransformationsClient { + return TransformationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrReplace creates a transformation or replaces an already existing transformation under an existing streaming +// job. +// Parameters: +// transformation - the definition of the transformation that will be used to create a new transformation or +// replace the existing one under the streaming job. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// transformationName - the name of the transformation. +// ifMatch - the ETag of the transformation. Omit this value to always overwrite the current transformation. +// Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. +// ifNoneMatch - set to '*' to allow a new transformation to be created, but to prevent updating an existing +// transformation. Other values will result in a 412 Pre-condition Failed response. +func (client TransformationsClient) CreateOrReplace(ctx context.Context, transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (result Transformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransformationsClient.CreateOrReplace") + 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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.TransformationsClient", "CreateOrReplace", err.Error()) + } + + req, err := client.CreateOrReplacePreparer(ctx, transformation, resourceGroupName, jobName, transformationName, ifMatch, ifNoneMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrReplaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", resp, "Failure sending request") + return + } + + result, err = client.CreateOrReplaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrReplacePreparer prepares the CreateOrReplace request. +func (client TransformationsClient) CreateOrReplacePreparer(ctx context.Context, transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "transformationName": autorest.Encode("path", transformationName), + } + + const APIVersion = "2020-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters), + autorest.WithJSON(transformation), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + if len(ifNoneMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the +// http.Response Body if it receives an error. +func (client TransformationsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always +// closes the http.Response Body. +func (client TransformationsClient) CreateOrReplaceResponder(resp *http.Response) (result Transformation, 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 gets details about the specified transformation. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// transformationName - the name of the transformation. +func (client TransformationsClient) Get(ctx context.Context, resourceGroupName string, jobName string, transformationName string) (result Transformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransformationsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.TransformationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, jobName, transformationName) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TransformationsClient) GetPreparer(ctx context.Context, resourceGroupName string, jobName string, transformationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "transformationName": autorest.Encode("path", transformationName), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", 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 TransformationsClient) 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 TransformationsClient) GetResponder(resp *http.Response) (result Transformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates an existing transformation under an existing streaming job. This can be used to partially update (ie. +// update one or two properties) a transformation without affecting the rest the job or transformation definition. +// Parameters: +// transformation - a Transformation object. The properties specified here will overwrite the corresponding +// properties in the existing transformation (ie. Those properties will be updated). Any properties that are +// set to null here will mean that the corresponding property in the existing transformation will remain the +// same and not change as a result of this PATCH operation. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// jobName - the name of the streaming job. +// transformationName - the name of the transformation. +// ifMatch - the ETag of the transformation. Omit this value to always overwrite the current transformation. +// Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes. +func (client TransformationsClient) Update(ctx context.Context, transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (result Transformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransformationsClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("streamanalytics.TransformationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, transformation, resourceGroupName, jobName, transformationName, ifMatch) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TransformationsClient) UpdatePreparer(ctx context.Context, transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "jobName": autorest.Encode("path", jobName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "transformationName": autorest.Encode("path", transformationName), + } + + const APIVersion = "2020-03-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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters), + autorest.WithJSON(transformation), + autorest.WithQueryParameters(queryParameters)) + if len(ifMatch) > 0 { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithHeader("If-Match", autorest.String(ifMatch))) + } + 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 TransformationsClient) 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 TransformationsClient) UpdateResponder(resp *http.Response) (result Transformation, 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/streamanalytics/mgmt/2020-03-01/streamanalytics/version.go b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/version.go new file mode 100644 index 000000000000..e14484ec2646 --- /dev/null +++ b/services/streamanalytics/mgmt/2020-03-01/streamanalytics/version.go @@ -0,0 +1,19 @@ +package streamanalytics + +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() + " streamanalytics/2020-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/version/version.go b/version/version.go index 5dbb638290d7..eb714a979398 100644 --- a/version/version.go +++ b/version/version.go @@ -4,4 +4,4 @@ package version // Licensed under the MIT License. See License.txt in the project root for license information. // Number contains the semantic version of this SDK. -const Number = "v60.3.0" +const Number = "v61.0.0"